From patchwork Fri May 21 08:31:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Pan, Xinhui" X-Patchwork-Id: 12272347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B478EC433B4 for ; Fri, 21 May 2021 08:31:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 733C661057 for ; Fri, 21 May 2021 08:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 733C661057 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9923E6F5CF; Fri, 21 May 2021 08:31:44 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id D04966F5CD; Fri, 21 May 2021 08:31:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DLX0CJ2QpRQphgD4681yOzNJNJwimiafVOsQboaN0FX83ui+KKuYAdbWSnlzExnSIEqPtT23Kf5H6+a7eNiKy6OJSR70jT7dQbsJd/y5xcn2OwsBXmXWo9F1gBQco8SKFo3jW05NMiF+aeGZkbKQwIMhXnU/iZtGk3DrwxyRoIrjyKPNsq+cciMQHa7+sPPk7CiqBD8e+RR6qc0a06Cv61jGn54Db0mgNOcAUZwb2GexwJgn++BwrZ2DV+mkuROxEAKiXyQNrZ+mKhitXFYTmjdXmrV8f4NwSE3zW0dlIUleka/fagv1OUwDMiCd+Xb63p3vjIsdBo3ifKtIbskCYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FwFG/7BGaMpix5u/2gj7oszmocjpGn5biwzc0WLv0k=; b=lNRxZtu/p5vApvLPmAT76urZnxA27QBnkiM0w3e93u1GhNkAafC73Wcy+YDQaG/Q7577XY0RVDidnQElt2z6XK7Ga0YawoKirwpTefTy7f5/XCqFCedOZMZ1fwLLmUoA1y5mTMsQrZE86zlpcqINmmegNNv3eA1hyxdvMAwDLeno48463pA9DsyWBC1NReWFJbdUlPdNaRUoLV/WikJqijN11Q5RdrhxuE3gCdKtw/SPZyL0akvuh3epU+3nrzKmqMYy32pCXwjOvB17zNlzxlsXbQUT5LnoGX6F+5W6K1H29UN+Y4G11dx2bzcAZXaHFshVT6bYubKicX5rdLa4IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FwFG/7BGaMpix5u/2gj7oszmocjpGn5biwzc0WLv0k=; b=YL0Mfy6Q2plS7A/IVQ97Mv2jCD0KFHPkq9cNi3ZEfCreb/syzQUI/gdUNcG/90t7SjXyv1Yg0RZTgSRNa/NNes0G2dzVs8Du8RGhze2BuK7ofND8uAwoU3pZWxhuACqds+WGqpm33WouGQc4EMgBXKSxzZicajsPnbLGWdln/HA= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5165.namprd12.prod.outlook.com (2603:10b6:5:394::9) by DM4PR12MB5133.namprd12.prod.outlook.com (2603:10b6:5:390::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Fri, 21 May 2021 08:31:39 +0000 Received: from DM4PR12MB5165.namprd12.prod.outlook.com ([fe80::4543:6802:6acc:c92d]) by DM4PR12MB5165.namprd12.prod.outlook.com ([fe80::4543:6802:6acc:c92d%5]) with mapi id 15.20.4150.023; Fri, 21 May 2021 08:31:39 +0000 From: xinhui pan To: amd-gfx@lists.freedesktop.org Subject: [PATCH] drm/ttm: Skip swapout if ttm object is not populated Date: Fri, 21 May 2021 16:31:12 +0800 Message-Id: <20210521083112.33176-1-xinhui.pan@amd.com> X-Mailer: git-send-email 2.25.1 X-Originating-IP: [165.204.134.244] X-ClientProxiedBy: HK0PR03CA0100.apcprd03.prod.outlook.com (2603:1096:203:b0::16) To DM4PR12MB5165.namprd12.prod.outlook.com (2603:10b6:5:394::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pp-server-two.amd.com (165.204.134.244) by HK0PR03CA0100.apcprd03.prod.outlook.com (2603:1096:203:b0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Fri, 21 May 2021 08:31:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d83472a-d23e-4197-ab14-08d91c32da7f X-MS-TrafficTypeDiagnostic: DM4PR12MB5133: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w1xMcJrnahg/zG6ROCnGfbA8046D6crEV48yrwrSSALXGgClejCkQWofVQwWy1lUwgVKMUnRtt6mYilMrYSHKEKQ45rH0RMk6YfNWF5W4oujHP/B/48e4uXna8NoLBad4MFVhJ1bbLW6Wp+i2Fnb2k6uueGqWldYK6/6lh0A3qpERo77k/B6JCxipQ/T/qfrEA1Iw3i75YjNZtUj7FeFoQa0iEyGBry6wxfS51bmjjQfEUcRo+MTSf8NfuUj+QEV2Q8ViZeYrxypQm/YsMLAoLR/u/h7+rszuvKBI5OaMiwCDytR76lK1jL9x+n0f5+K5UHYHniDwSXKNzajqtzU7jxpvWfizig4C0ySbHjjRG8IJeu8VdG2ervehpMlXjvTo4N4RsBbDYF35KE9pxXgezvr48eyKuzOeD94tarxGyquuMP9RIbh0slsRDfPFA0knx/aM3dHUy4+8cw/RSeODhqPfcIH516OShQDFPYGNAebDFt5F8kruFLYEf9jFf4cGq+HJ4KmCdg066GO+MxIJvFebG1TN6LW3zWs0LGPDY+lyyNGePb5qkOr9B5wToTqI96eojnAdQ2hrzoF1drTWUD+rMuLL4yJGD4VnoPNguqSOKZu4gd9ABalOq5y6dXs4SqaCr5QCJ9KpzzONITCRA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5165.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(366004)(346002)(39860400002)(396003)(1076003)(66574015)(6916009)(38100700002)(16526019)(6666004)(186003)(38350700002)(8936002)(6486002)(316002)(956004)(2616005)(5660300002)(4326008)(66946007)(478600001)(66556008)(86362001)(66476007)(4744005)(26005)(8676002)(83380400001)(36756003)(7696005)(52116002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?1pY2dVS+c5uMjU/9xXEYap0iQ6nN9x?= =?utf-8?q?AiSiGROLz2i/26n0yxbYHyO7Wld5lB6tEUmYEJLSoCeTI3PV5MSHKC2QzXEDpxu54?= =?utf-8?q?aM1zVSfbFlVtI4Nk+bdtjGwO5w3KvbXP74eWtR0KBn43un2/PiwKjGX918BIWpw6/?= =?utf-8?q?HUHxIdPPrzE2Bqe9rC/gV3TIzQ8c1M6C9FtZ8ajVYWaHyxxmF1+Zrls4Ay4YBSqUF?= =?utf-8?q?V4pY+nuXB03X6aYEZs1YfI5/WcLbpY8XyLjBFBh+qvHyIEIrEka8sIQBvXdgPoYnl?= =?utf-8?q?V6OQRhFSfqeAZdkyvMtSbFmdBhai+FaNGs4nb63JCciDFpAktbv4B6IUJpMeCTNb7?= =?utf-8?q?HJ72wuat5Kv5NxdYCigpeD3377Yfp2NtjuQgnarcpcYpt9bZO++A3+exWRTEktQbD?= =?utf-8?q?M6T3NONynOBkLvdIg/FJE9KzceYj1SsVDsydahhthkXFbYWA1qQoeIwsQS192CkQj?= =?utf-8?q?ThBr1+HBkZyt9HLqKIbJ6nXWzwnDTmtzTifAwMbkKG1EgAvu0FrGqXt9LelZuAQwU?= =?utf-8?q?GQUX7Lvjc+AY6aRAvBlvnockV3F89pE8WdUORDtNeIqmxsqXpH7XEl6qpEIsfFoxM?= =?utf-8?q?lkKNuydIcJQdG5rLBkBtjDsfRpwd4gNLkxVAGwtXli1yg9cmTjciLBvLfrt/j1ot5?= =?utf-8?q?9MX3Ige4y6W0dQ7hcR2+uS6h6LI3/dW1S1i/A7n0onR0UEvjDDFTKxHiftoApXBK0?= =?utf-8?q?FQ9rmIKn0V9sU9QVxNDBgSIDairr3YzNxSAOQNdoTU2azLO5JTixd/dkVGK+JFAE+?= =?utf-8?q?0RkFv6mbYsexa4ImxKuqMyb9TWssyxfeVNXmIxUWuQGiBzuB1QcaM3e17dhToLTVn?= =?utf-8?q?m3hffrDYfHMQKUOOgLDhVnwb+w5RXgBqM80X80d/k95SaSfPethDrBGWGo4TpeOTD?= =?utf-8?q?yKG8xawLrhrI2ryA4zINfqUOst8hiYGp3QVPbCvf1lY8R97fOci5bfbglNxl20fy/?= =?utf-8?q?3xTYiLwY2ShBxnYvV/css1LgsxDLCmRv/jJj6xrFsTEjXGAvVTIjOTC0xSzVlaShb?= =?utf-8?q?qJg1bmhTKqWg0xqKGzFx+QFf8a829LXtL/xEnpnKj7MLY0KaXc0i5PwhYRNeqbiYp?= =?utf-8?q?rc+zxfh/nvBfUc0Zo4oLeLyb/OMJpSlHBh7e53jCNG8op4w2WQF9KJbxpC1NEF2nT?= =?utf-8?q?+Z8NTqSbTGybxi6ejo9p2T5y7L+cQcYPzJYcLdHpnx0fu/m+6MP2g0lO5z4uSBBxq?= =?utf-8?q?2C9ckJhi+jGgRqr4c6Wm16GsGBIPFYwvAv6qmTETXrpgS8QEjTQyu88JpOM8g8U6Y?= =?utf-8?q?eWsuqC8MzOnre8?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d83472a-d23e-4197-ab14-08d91c32da7f X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5165.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 08:31:39.0632 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 41sQ0phlproIOjo6D954YXsESI9Wew4JX8w70sd5H9v54mucqXPaYVbv8+M/im7W X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5133 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xinhui pan , christian.koenig@amd.com, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Swapping a ttm object which has no backend pages makes no sense. Suggested-by: Christian König Signed-off-by: xinhui pan Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index 510e3e001dab..a1dcf7d55c90 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b/drivers/gpu/drm/ttm/ttm_device.c @@ -145,7 +145,7 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, list_for_each_entry(bo, &man->lru[j], lru) { uint32_t num_pages; - if (!bo->ttm || + if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) || bo->ttm->page_flags & TTM_PAGE_FLAG_SG || bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED) continue;