From patchwork Wed Aug 8 09:59:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4788413B4 for ; Wed, 8 Aug 2018 10:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F2352A903 for ; Wed, 8 Aug 2018 10:00:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2294D2A95A; Wed, 8 Aug 2018 10:00:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA6632A903 for ; Wed, 8 Aug 2018 10:00:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F1B16E50A; Wed, 8 Aug 2018 09:59:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05on0602.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::602]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E3116E50A; Wed, 8 Aug 2018 09:59:58 +0000 (UTC) Received: from BN6PR12CA0033.namprd12.prod.outlook.com (2603:10b6:405:70::19) by CY1PR12MB0245.namprd12.prod.outlook.com (2a01:111:e400:50f9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Wed, 8 Aug 2018 09:59:55 +0000 Received: from CO1NAM03FT054.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by BN6PR12CA0033.outlook.office365.com (2603:10b6:405:70::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.19 via Frontend Transport; Wed, 8 Aug 2018 09:59:55 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT054.mail.protection.outlook.com (10.152.81.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 09:59:54 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 04:59:53 -0500 From: Huang Rui To: , Subject: [PATCH 1/5] drm/ttm: add helper structures for bulk moves on lru list Date: Wed, 8 Aug 2018 17:59:33 +0800 Message-ID: <1533722377-27020-2-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(136003)(39860400002)(346002)(396003)(2980300002)(428003)(199004)(189003)(36756003)(5820100001)(23676004)(7696005)(77096007)(76176011)(72206003)(2870700001)(68736007)(478600001)(476003)(11346002)(26005)(2906002)(86362001)(2616005)(426003)(305945005)(336012)(186003)(446003)(53936002)(97736004)(50466002)(126002)(486006)(50226002)(81166006)(8676002)(54906003)(356003)(104016004)(8936002)(105586002)(53416004)(6666003)(5660300001)(47776003)(106466001)(4326008)(316002)(81156014)(450100002)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0245; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT054; 1:uPVpINNrPVLiTh1JWCKjuYLlh3AYt54KGBPwx6zSRPkKDq87T903NY1URk/n75DTmyizv0xZN0+2kBkLQiGkv7Qbz4aT7itmOjw/rV/WdUUOZFD+rWz1M/XRlZ0GHBGC X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d6d573c-7fa0-4f5a-bb00-08d5fd15b129 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0245; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0245; 3:D02a5FklOeiSdUSPRDvMaGDGEo+1ZKqYRZQdmRu+AN1cUpPNJ0fxxaHP5ARSfZMad3jZ4GRY3QiXHn9QzoL4S9KRSoOhDuO/HQIv0cDl8c/3GSXZWeEfB0u0I3F8Ipyqsu0zfamAZBnM7uW1hRcYPoCrp1bGzhc2rPM2x6cTvECnwIEHvxNAPSjYpx6h4cNBO96zprVBdx0OcwaMO7ZG6sC4spvE4uMPzVseDTMsgZAUwM8CoqcIl44W3K8/PQl0I2gSReu9eGUxPoESixLKY7YYSHJubNw7fMAkD9L9BhFk4MJ2bZkjYzCJPLJQnYeUobKHDz/M/D1tkUXu4xgxnvtC48J5CDbh26+UXyKIhh0=; 25:gzLuIO73lWRYyzmkWjLNEiTprJULJk42xwU132bD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BirydKsXcfUMxLQGdrHyWyRp8F/6e5FqdyApe8EFub1UNo++S/xC6Qy3q2YZn8n X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93003095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:CY1PR12MB0245; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0245; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0245; 4:Qk9i+nyJZMsiFjQwR/xDzhzVj6VzGDFHMIqisOx5eH9ie+vbPvYmWlZwNcDGlvNfmu92TBAfQARTvEIXL4R1q2ApYXPnFSbcM9KChNRvN43gdVWLNPImjlf1DlVlE5AAtxMTlSWdlnB3sVpzxCOArmAzU2sQR0f/nvZMOUHyK2yTGFMXv6FsjY8em03OS7QdCV+syGhieEHkTrI7Jvl0LUcVcbsK4Yhsp+k3T56hfs4imx6LnYjz39dmue6e1aJN3W0jf741ggz+qojx7p1WOFuErIxyyhWaLCpr4+xqqMarFOU7J2kPag8iPncy71w6 X-Forefront-PRVS: 07584EDBCD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY1PR12MB0245=3B23=3A2ZhIfxu?= =?utf-8?q?/4UpQ+Muv3qL8eHh4gFxV8WnMy7ekjLLX9fuejX6LEi3k3ix9fTO0jsr94q70DYuN?= =?utf-8?q?29/lylutgGJIgUHM916YwXH7c5+QkK5gUdW7nPhwYinAkFsoDThi70llyNmPRTVpq?= =?utf-8?q?J2b6FhvJ5nOmS8hnr7ah+WwBABHc3X9Q2sdysGywSiqpxQlulA9IID5ycRSIhffA7?= =?utf-8?q?lzbpAmP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FNRo59cEmyPUnBDpTSMhtjVeSlvvfaUmLPYpZypxshIA14SL26efUBNAyOUjzsKZqP1tmojXqEDzUQ+w=; 7:mCj9EPWe3r0BqjFrLdqsAmoirEZdG2KAzQz7Clmu6IC9Oz5uRz7/43ZCoIuW9/c5RrSn5Pmc9U/+F/8F8TdYRPTNh6jTShF7FR4y6+My8+Rd01fubX1f92rK7im99C82LUs+5no/8LHeZfXDtUecx25o+Jo+T+XsY64GzRyK+9HfhJx7On/cpXRDMvALGc8LIGtkmvNSS9rPkRKETQN/6YtKUFzAHKGt9PkNuDe2R6iAWhkBNqto47Vf2sPde0Zu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0245; 20:y0uCFb1EHkZDmxsVrBymO523eS5gppQRcritEfSmtefvZkVgtw9QpYOUo3iGjBki72PHzA+UFeBjhin2gVGzgl3R6eYvVapBqhi98I7/mQOdJF7YO2MmYTLfuGisBecZOMVSS5vij4QtDo72UVZvYRJwENkLD7t1YBWJO6eh9a65i0RBALvUvpIfe1F8jVThdh0f7chpQpNlAjW5WxkKJNrWi/Ah4tgpUuukTF8U0VQJl2tAity/uPzU5SHAA3jw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 09:59:54.9048 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d6d573c-7fa0-4f5a-bb00-08d5fd15b129 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0245 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König Add bulk move pos to store the pointer of first and last buffer object. The list in between will be bulk moved on lru list. Signed-off-by: Christian König Signed-off-by: Huang Rui --- include/drm/ttm/ttm_bo_driver.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 3234cc3..e4fee8e 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -491,6 +491,34 @@ struct ttm_bo_device { }; /** + * struct ttm_lru_bulk_move_pos + * + * @first: first BO in the bulk move range + * @last: last BO in the bulk move range + * + * Positions for a lru bulk move. + */ +struct ttm_lru_bulk_move_pos { + struct ttm_buffer_object *first; + struct ttm_buffer_object *last; +}; + +/** + * struct ttm_lru_bulk_move + * + * @tt: first/last lru entry for BOs in the TT domain + * @vram: first/last lru entry for BOs in the VRAM domain + * @swap: first/last lru entry for BOs on the swap list + * + * Helper structure for bulk moves on the LRU list. + */ +struct ttm_lru_bulk_move { + struct ttm_lru_bulk_move_pos tt[TTM_MAX_BO_PRIORITY]; + struct ttm_lru_bulk_move_pos vram[TTM_MAX_BO_PRIORITY]; + struct ttm_lru_bulk_move_pos swap[TTM_MAX_BO_PRIORITY]; +}; + +/** * ttm_flag_masked * * @old: Pointer to the result and original value. From patchwork Wed Aug 8 09:59:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 399BC13AC for ; Wed, 8 Aug 2018 10:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2615F2A91C for ; Wed, 8 Aug 2018 10:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 162E22A95C; Wed, 8 Aug 2018 10:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9ED8B2A91C for ; Wed, 8 Aug 2018 10:00:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 554086E50F; Wed, 8 Aug 2018 10:00:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710073.outbound.protection.outlook.com [40.107.71.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 818736E511; Wed, 8 Aug 2018 10:00:12 +0000 (UTC) Received: from CY4PR12CA0025.namprd12.prod.outlook.com (2603:10b6:903:129::11) by CY4PR1201MB2501.namprd12.prod.outlook.com (2603:10b6:903:d1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 10:00:11 +0000 Received: from CO1NAM03FT016.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by CY4PR12CA0025.outlook.office365.com (2603:10b6:903:129::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.20 via Frontend Transport; Wed, 8 Aug 2018 10:00:10 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT016.mail.protection.outlook.com (10.152.80.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 10:00:10 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 05:00:05 -0500 From: Huang Rui To: , Subject: [PATCH 2/5] drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves Date: Wed, 8 Aug 2018 17:59:34 +0800 Message-ID: <1533722377-27020-3-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(136003)(376002)(346002)(2980300002)(428003)(189003)(199004)(53936002)(53416004)(5820100001)(6666003)(81156014)(81166006)(2616005)(478600001)(476003)(104016004)(8676002)(8936002)(126002)(486006)(2870700001)(2906002)(97736004)(450100002)(106466001)(4326008)(105586002)(110136005)(316002)(50226002)(54906003)(305945005)(47776003)(356003)(14444005)(5660300001)(86362001)(26005)(72206003)(36756003)(186003)(50466002)(77096007)(7696005)(68736007)(336012)(76176011)(11346002)(446003)(426003)(23676004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB2501; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT016; 1:BGOqp1LCZgY/NaYaNh0NbenwU7MFNYdqek1HhtEQ9Sz4myaVTZG6oub89mqKaZusLOjl8noaw5hRZotX50fwQxlv5QoL4dSIX2sZcX9KD+09EpkZjlQA5jwjZO5BFZ0D X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62e35ccc-24ff-46d3-5160-08d5fd15ba8a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:CY4PR1201MB2501; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2501; 3:1LAtyuGMoOes5avmYQZDpRJjsxlN/CkA1QfwGSier+bDFt8AQQNOjhIoq+8LYCNNgQ9WbRmGKQgl/kYiF2GWc+E2dDd9D+P9/N0U3QQX5bgFi35WYLp4ZyRdf6w1myT6YboBk3aQZwKQcVIswjEML8It+xS/OdtRuc1WdIUxx2F0y7h0gqNHDWcfsvpFoOgVaGainuUUAF0Pw1CSwRyiXBFbpGl3lGsgstITwbt7u0iKkpWSvCSz7mIBwXMJeh00krXFKdNIUYe5BsJYC552Eu7bP06DZuyibYVAY7Wmp8N3g6vdiDB1zbwZzGwRechQMeDsG8+PXDfZzMCGDYzPzCtKheodSb8LWkvNBZhpJmg=; 25:sWOn1OYEGCzvSKq+016ms5hXkRKupThc+KCqgdo+lEpG8d5z71OKzGxBPTJmfokTokAdulWdt9BIbRKDtxGuMTtgG4jIvKL1rD818IYys2r/kRjxVFFqbMA3/Tf9hEvwsQL5OkNCZS3QexP/q30ZBHD0KPY8CrR88FQ27noN2/Q8zzxTpEBVAtEuuCZVBX6vukbaoULUk7SAypreCt/2WC4EeO4GMTSUyoQvvq3YOos7N7HxcpRtPmemZD8lMKDJwccdkz6Kx7ddBow9p8q7OrqhhfMzj0wDL4cnEj9QJ9elNosjxSgQaAPyx5JpQEGS1r6Rt7jNXoSGzNut6w43Vg== X-MS-TrafficTypeDiagnostic: CY4PR1201MB2501: X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2501; 31:wGuhjkZh+4RxNurL5SuMsdI5dFtNU77i4N0Dh7H8rlEHJu/yuhpUk4tvoc9MBb0MNG7cJQnUOaPuMzW7Xhlrpa1CVmZqAtebp3ptg6ndj7O+d8/k3rf0Xec0WY65DV3/E/YXTjvj2S/qJoX8luN71SpWEmNQRyO3fXPtujhzPxRF5qU54ZyP7GtO8ufXtAJxuehk0DhlvYm9lweDkIwm/U6oTEcXI/7ENWycwg5S7aE=; 20:5Db6wWsWR89yPHiChV+jT3MqyhzgPPe68jWk1jfYRawlBD4U/CVcfmco/h1ifDvybtU8iJaTSl7HyAdDeNQOjR3kxWLP9/r4p25ZP/71IbCYc5x9OIp5d+jalHxlvqBLcMX/9Q/5tDcU0bulTUbs8iVPvsnbxEdzLUBbBtw8EUDaVWT6blkqqJ4+VSJeranOB+8zgeFLk7XvT2KTdMYWKugyEUfiLngyxdXxgeho5m/cpcUBkpkmrURFH8BBgHgajTkxqLr0E6hELFJrfgJL0g5o11JGLCPV6almLo/h6/8nPdFSMF3rhvZwljkajsGac4zV0XLe1EanthryHUvASKX7g78+asKPzlH+c/GEU1SmIPH4iOBBumIrJ3I9SRqq9ue51W30fM/N0hKnroDJulHprGSLLdqcRVFP92YUVEtqEAEVpjnfDIWOFkitQLQrQ4W0I2sDwiWkuRL8uCnVsNfTTDWqciZ3TmbeE3UoHadAWOoQSWBQ1FpM6pcpQcmR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(10201501046)(3002001)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CY4PR1201MB2501; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB2501; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2501; 4:kmrkaO8v/820l1LJfGmNr57YNPQWusM7XGz5Ri5i4sXgebZvdfUpUB2Z3b2cODNReVIFLIl4F3utWJD0fjxtK+L8E07P9QdJdBDLHjKO3FjwsK8vltjNExtDFBa2gYt3BCmriSTABpzDsG63zuUPX3Le7GDmQblTwVYh+BQCXmK0uiHSvO/I6d1axQImeUaccWJUh2oNo7baQExXKaA1CdLotYwZNPky1cxLx20cKaQSCAWHRZwONmTAjubbwlpGjcumqtAHfltGDQvwJoTUaFqdJXrJF+LahFbOdNyDbiTWzkzFulfLdapLFsWbMiM8 X-Forefront-PRVS: 07584EDBCD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY4PR1201MB2501=3B23=3A6RRtF?= =?utf-8?q?n43Aep9XBCTIP+sB9VR2cLRpFwGQWQlsZIKVq7YWZZY8Lnidtwh9Hpn6mrp1eCH0P?= =?utf-8?q?30M9x0A3ch+VV/+qn7HOgStFwaWGdgr0D7W/brAsFo3SdE98tYqHaOOQR+0HlF45g?= =?utf-8?q?Gw3jufxYxKBycUfqZrqaU1ddlVpDo/RwZO2j44pzM/8e+FQFv2imOa3qmEOvhIMtp?= =?utf-8?q?R4QrJzdSqqhfzdcDOMbRfn4CYtjwPRWPP0Upj/pgzSl2kJmAESSwhJvC6AgJ9rgWi?= =?utf-8?q?g9xWxVAeHznTI2mNe0V6obQNon9pLfEsNlter0Bookm99i8Hy/9t3WkG/I5FOLMyW?= =?utf-8?q?HiWyLWj9qyRCh3irOTHlePCt28WvQ0ldd1RvWZLNHtvUlxV6GkAiT1rPzxHQcrXwn?= =?utf-8?q?Wfktpllj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BckCT0U3Hm+4Ec2tNsSdcTIBXq+bOPOto9QGixl+LkNdHxYKLkpqq0Giu77lhF3tsL0vVQO3y5Tly3auCPBZZDugf93zHiD6ZWC87vrjRrJvovj644ErbddMKIgKZb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2501; 20:jhdT57EEirnM7xn7Gdkr0FHTQVMl6/pkM4r+KxODJKuxkFeM9itiaKJ2tUihgYiE2Bqk+mhhTaddyk1XfLt+9jypqfF8pD4Pg0mo3umKGpmqqQ54y4OTxwT2UEpXGHvo3fglEpJFKGRRJKZo0uBipbALQDkhEE+tzwXKy46nag4fvMyYGWMmO3j2NgF+6/TI+DCfG/G1VRKkS1GD09rsPpO+b9AJ4E4ACeOss0ILNkXfsqAjIC131Xo3pNWsWb1g X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 10:00:10.6373 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62e35ccc-24ff-46d3-5160-08d5fd15ba8a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2501 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König When move a BO to the end of LRU, it need remember the BO positions. Make sure all moved bo in between "first" and "last". And they will be bulk moving together. Signed-off-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++---- drivers/gpu/drm/ttm/ttm_bo.c | 26 +++++++++++++++++++++++++- include/drm/ttm/ttm_bo_api.h | 6 +++++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 015613b..9c84770 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -297,9 +297,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, break; spin_lock(&glob->lru_lock); - ttm_bo_move_to_lru_tail(&bo->tbo); + ttm_bo_move_to_lru_tail(&bo->tbo, NULL); if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo); + ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); spin_unlock(&glob->lru_lock); } @@ -319,9 +319,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, if (!bo->parent) continue; - ttm_bo_move_to_lru_tail(&bo->tbo); + ttm_bo_move_to_lru_tail(&bo->tbo, NULL); if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo); + ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); } spin_unlock(&glob->lru_lock); diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 7c48472..7117b6b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -214,12 +214,36 @@ void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo) } EXPORT_SYMBOL(ttm_bo_del_sub_from_lru); -void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo) +static void ttm_bo_bulk_move_set_pos(struct ttm_lru_bulk_move_pos *pos, + struct ttm_buffer_object *bo) +{ + if (!pos->first) + pos->first = bo; + pos->last = bo; +} + +void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, + struct ttm_lru_bulk_move *bulk) { reservation_object_assert_held(bo->resv); ttm_bo_del_from_lru(bo); ttm_bo_add_to_lru(bo); + + if (bulk && !(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { + switch (bo->mem.mem_type) { + case TTM_PL_TT: + ttm_bo_bulk_move_set_pos(&bulk->tt[bo->priority], bo); + break; + + case TTM_PL_VRAM: + ttm_bo_bulk_move_set_pos(&bulk->vram[bo->priority], bo); + break; + } + if (bo->ttm && !(bo->ttm->page_flags & + (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) + ttm_bo_bulk_move_set_pos(&bulk->swap[bo->priority], bo); + } } EXPORT_SYMBOL(ttm_bo_move_to_lru_tail); diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index a01ba20..0d4eb81 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -51,6 +51,8 @@ struct ttm_placement; struct ttm_place; +struct ttm_lru_bulk_move; + /** * struct ttm_bus_placement * @@ -405,12 +407,14 @@ void ttm_bo_del_from_lru(struct ttm_buffer_object *bo); * ttm_bo_move_to_lru_tail * * @bo: The buffer object. + * @bulk: optional bulk move structure to remember BO positions * * Move this BO to the tail of all lru lists used to lookup and reserve an * object. This function must be called with struct ttm_bo_global::lru_lock * held, and is used to make a BO less likely to be considered for eviction. */ -void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo); +void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, + struct ttm_lru_bulk_move *bulk); /** * ttm_bo_lock_delayed_workqueue From patchwork Wed Aug 8 09:59:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D14B13AC for ; Wed, 8 Aug 2018 10:00:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B7432A95C for ; Wed, 8 Aug 2018 10:00:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FDC32A9B7; Wed, 8 Aug 2018 10:00:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA8602AA1D for ; Wed, 8 Aug 2018 10:00:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAEFE6E517; Wed, 8 Aug 2018 10:00:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0076.outbound.protection.outlook.com [104.47.42.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EE7F6E517; Wed, 8 Aug 2018 10:00:30 +0000 (UTC) Received: from CY4PR1201CA0009.namprd12.prod.outlook.com (2603:10b6:910:16::19) by SN1PR12MB0255.namprd12.prod.outlook.com (2a01:111:e400:5143::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 10:00:28 +0000 Received: from CO1NAM03FT059.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by CY4PR1201CA0009.outlook.office365.com (2603:10b6:910:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1017.15 via Frontend Transport; Wed, 8 Aug 2018 10:00:28 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT059.mail.protection.outlook.com (10.152.81.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 10:00:27 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 05:00:26 -0500 From: Huang Rui To: , Subject: [PATCH 3/5] drm/ttm: add bulk move function on LRU Date: Wed, 8 Aug 2018 17:59:35 +0800 Message-ID: <1533722377-27020-4-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(428003)(189003)(199004)(476003)(97736004)(450100002)(126002)(2870700001)(6666003)(4326008)(336012)(47776003)(86362001)(53936002)(106466001)(486006)(5660300001)(53416004)(76176011)(77096007)(36756003)(54906003)(2616005)(23676004)(26005)(7696005)(110136005)(186003)(105586002)(50226002)(446003)(14444005)(8936002)(426003)(5820100001)(68736007)(72206003)(8676002)(81156014)(81166006)(305945005)(356003)(478600001)(2906002)(104016004)(316002)(11346002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0255; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT059; 1:NMFBbAwUvzFcMc2dxM/aCwTsjYWI88MkaF2q/f3kEJMWTsigv4+ykuz3uIW56Y4vA6rKgkeaxPcivP3k7Qegb595n1zF7KXXErOGGDpvkbFvvPRht7IYE/4sQkFwUbaK X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57840b57-2650-4f44-e06a-08d5fd15c4d0 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:SN1PR12MB0255; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0255; 3:fDYrOFFmr9z2yDmWmMuSkfYHCDr+Hx1nyHgB7iZA0hZZALKms51g3Dn3DlCUNu+L0BXOc4rwGFL0M8VstS0d4uuryz6D8KtG4kmc60+OMSE00HdmhF7uNPoW84ey0IDwi1O9USXKtjqCj+M3j9SM4i4Qm9ltUoftq9I9c5JfHf16siwx/sMHXdyVY9Jff7MgAYDmMgVdi/wbI3u4Ov5gsuoqq2x7I74/EkssmFYl58Gm/6GWbplN1k4vJM7aQRpXuVym92H/iLSPHvX87Hz9kmrsioVpFAiGyU8oWzWhqmePkbfb3Kzhbs/mvd/pZ0J2zEpaX1KCCi4y+5Q8qmvpVW87/1jqVf6K1+kv41dCe6E=; 25:ZTxuVog96VvanblE7xeJqpMd+jzzUyyPUUTtGQQSBCpLsdTTYUugIYR6vMTcsIxvQFKaOWgfSZAQ1Z8FcT7ediI2U2UFye6SgbN5xT1c4E9rilLgZ8lk6Cv7++HeDmSvCDSnaj5y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Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93003095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:SN1PR12MB0255; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0255; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0255; 4:pfJAFtx2ybCMNekJxPQXGgiFiUc7XiUCCDiaeuxkX4c3Ks9dpDBYMJmtaEAUTiE3Tuv9A8aT7k+feU0z6l33zvr2RpVh2X7YBn9f0cUDSOCyXmTMlMU8SrPh7CBgKWXkT9yb3y8P8C3npe1nEJH1H2rRW1eWBCDwU4MewSZQsW5LFZ8bPXZkqID3eKYxlk/cZHuWEe2Pa5beCdNQfmDD/ecoOG2NZPkqIL459JYJKn18/EbiBxrmvMe86Bfx692URPgxU/S3OgAwb/SdAkUCDhYqhS8Yo6THpLMX8zUJuwupP+eXFRzgREC3lJVcAIHp X-Forefront-PRVS: 07584EDBCD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR12MB0255=3B23=3AYD6Fqrk?= =?utf-8?q?BO4AAtM0T8nH1p2iNI3ldnalNXVNfmQq37ebcgRWKzlOt9ab3mKh0LMRl+ORyHjkv?= =?utf-8?q?ztrPGJdmmcN6NKpFijlffNJIq1cDZg6Z8P5rFergQY2MGJITL2xlN6po7mayJD1ka?= =?utf-8?q?zHGnjKBiuQU7sqVutX2tBnk0nDLpmIhewoh+krgOuzqnkEL7Jro9u3FttsGaVCvGP?= =?utf-8?q?JB3tY/6rhMJPBryGlpFpsnoooxoit2r4hZM9DHf+dzpyzDj76mlHeRsV7mir2KukB?= =?utf-8?q?1K/lXiz36HxcjdTT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E=; 7:xBl8KHJ272tZh7F8JvBv7F45AWh0DqNB9PEaA0ueFLc2TdtT1YUcA1fwkmadGS15mIJoUIzIeppAEwhMwwWmfzpcYKhktMSGR9IQNlm8ZYhD/PKptBWD3/M9ImqPQc6UPvVU7fBSFlWkYHJt4hVjmCL8mYuU6mQ8kPJxprNr0Bo+toHFiECXTsPyFk2qivszGFrNmk+na1EwYz3V7GFwWaosjcOB5eDNztE1D96Rs9XHuYbOX3t1aGqdoJ5q3usn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0255; 20:mVxlRd3YXGC7JzkAVwVXmT5y8OXbPL7y7QqLlhZTNH/wBYuKhL4ICuDR0U0vnm2QcKRoQzH6UE1ggIOREArrvNnR96Lb+NRDnyrP2uBazQCVGgYGoa+SsS3grfLpVHoT9vBQ+F6iO5xAyn8MS/Mlwq9m/lMQ/+f29wX/J/gG8g/U+9JGjX8YejZTjGWDEZ8/vyKXw4HvgeOichAjjnUVatRnRAndyd46QJwmolyhLHAl4a0/lpIhXvXQTe+wTdzi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 10:00:27.8925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57840b57-2650-4f44-e06a-08d5fd15c4d0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0255 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This function allow us to bulk move a group of BOs to the tail of their LRU. The positions of group of BOs are stored on the (first, last) bulk_move_pos structure. Signed-off-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_bo.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ include/drm/ttm/ttm_bo_api.h | 10 +++++++++ 2 files changed, 62 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 7117b6b..39d9d55 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -247,6 +247,58 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, } EXPORT_SYMBOL(ttm_bo_move_to_lru_tail); +static void ttm_bo_bulk_move_helper(struct ttm_lru_bulk_move_pos *pos, + struct list_head *lru, bool is_swap) +{ + struct list_head entries, before; + struct list_head *list1, *list2; + + list1 = is_swap ? &pos->last->swap : &pos->last->lru; + list2 = is_swap ? pos->first->swap.prev : pos->first->lru.prev; + + list_cut_position(&entries, lru, list1); + list_cut_position(&before, &entries, list2); + list_splice(&before, lru); + list_splice_tail(&entries, lru); +} + +void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk) +{ + unsigned i; + + for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { + struct ttm_mem_type_manager *man; + + if (!bulk->tt[i].first) + continue; + + man = &bulk->tt[i].first->bdev->man[TTM_PL_TT]; + ttm_bo_bulk_move_helper(&bulk->tt[i], &man->lru[i], false); + } + + for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { + struct ttm_mem_type_manager *man; + + if (!bulk->vram[i].first) + continue; + + man = &bulk->vram[i].first->bdev->man[TTM_PL_VRAM]; + ttm_bo_bulk_move_helper(&bulk->vram[i], &man->lru[i], false); + } + + for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { + struct ttm_lru_bulk_move_pos *pos = &bulk->swap[i]; + struct list_head *lru; + + if (!pos->first) + continue; + + lru = &pos->first->bdev->glob->swap_lru[i]; + ttm_bo_bulk_move_helper(&bulk->swap[i], lru, true); + } +} +EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail); + static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem, bool evict, struct ttm_operation_ctx *ctx) diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 0d4eb81..8c19470 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -417,6 +417,16 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, struct ttm_lru_bulk_move *bulk); /** + * ttm_bo_bulk_move_lru_tail + * + * @bulk: bulk move structure + * + * Bulk move BOs to the LRU tail, only valid to use when driver makes sure that + * BO order never changes. Should be called with ttm_bo_global::lru_lock held. + */ +void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk); + +/** * ttm_bo_lock_delayed_workqueue * * Prevent the delayed workqueue from running. From patchwork Wed Aug 8 09:59:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C48313AC for ; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68B482A95A for ; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4B12A9B7; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF2602A95A for ; Wed, 8 Aug 2018 10:01:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33F116E509; Wed, 8 Aug 2018 10:01:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0087.outbound.protection.outlook.com [104.47.33.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id E123D6E506; Wed, 8 Aug 2018 10:01:04 +0000 (UTC) Received: from SN1PR12CA0010.namprd12.prod.outlook.com (2a01:111:e400:5174::20) by BY2PR12MB0242.namprd12.prod.outlook.com (2a01:111:e400:585d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 10:01:02 +0000 Received: from CO1NAM03FT056.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by SN1PR12CA0010.outlook.office365.com (2a01:111:e400:5174::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.21 via Frontend Transport; Wed, 8 Aug 2018 10:01:01 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT056.mail.protection.outlook.com (10.152.81.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 10:01:01 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 05:00:59 -0500 From: Huang Rui To: , Subject: [PATCH 4/5] drm/amdgpu: use bulk moves for efficient VM LRU handling Date: Wed, 8 Aug 2018 17:59:36 +0800 Message-ID: <1533722377-27020-5-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(136003)(396003)(2980300002)(428003)(189003)(199004)(478600001)(446003)(72206003)(104016004)(97736004)(106466001)(105586002)(426003)(110136005)(336012)(11346002)(47776003)(575784001)(14444005)(86362001)(53416004)(316002)(77096007)(476003)(81166006)(2616005)(186003)(356003)(2906002)(305945005)(8676002)(81156014)(54906003)(561944003)(486006)(36756003)(2870700001)(53936002)(5820100001)(50226002)(4326008)(450100002)(76176011)(23676004)(8936002)(68736007)(50466002)(7696005)(5660300001)(6666003)(126002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0242; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT056; 1:D+VKqBOTbxQuCS02Wj01XN2CmEmYRGK7YptBgjgDqOqBjska0ZnWkfCQFpKOCoGJM1SaqVxPQqkJMLxV52MyAbbZe9JGYpQDF7BnTo8yQStyFowZmuoAFkQkQZgRGWZK X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac0dc37f-8923-47c3-157a-08d5fd15d8bc X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:BY2PR12MB0242; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 3:zjOsOYKDRsE0XNNMF4nUemY5XrHOXG1PHjHxkgwqRvdWFBRd9mikAeNRps4N93Zg86Kav2E5NxvbkG05sOVlwZNrKc+zgSXsDJ52GlBFHPJUch1fGK3pRPOQOnl0GDDwrPjpWfnosXsacdGAfrb1fSU1C3n1oxRI0P5cS+/8z0RmISdNDuoILyWioFFm3KnT9r840WeKNTiOKxlItXHfb75zGXqcC9IHZAVlEA0PWH/BTNSCFpGBvvlEerbuZrPz1CthHbYJHrGbDaNee76om6tUfBgXc1labyteAEgNWXbysxRSoJOz6diI6mExy8pYIKyK3nTXrTPPUh1X3jzIIUGTLvkcRx+amSuUfAvjQmg=; 25:9WLBE4nIrN8T80XixFchoF7xlTGFqMQTNMYMduJ0lepG2kMp6E+hfh0zAG8LAMPndePEafe8uFKfquOkz4c4AqsABhtpNZtiq/KZd31ohvYlKxl0HWdrrCqTdC1EwG3BCzmy2YMtJBX4hFiQHHWNbve1xr6RVwqpUYvxi4g3/WlvakILDxNdhw+64ii621+HSwo7oz9Jp/46eul6AxpJ5PEIui8xc4WOkY2WP2VRji+kv0zLgDkrWWeAsJ9p33kKzt15eJWwApBMldrLCNMYZJ5ktA88FXIrPiQzg2DP+mGlMe9HriJ3mjcrXL6Zlkhh653hMJK89urZ15mUK8jCSg== X-MS-TrafficTypeDiagnostic: BY2PR12MB0242: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 31:4/35MSA8bIZR3/sKaOsF6DC8LVeKKHrOk/bAhqvhi1XmJzB5ZKE58igk5Z0o0OZAJgzQWbAiMryp3BzZfkAx7l8/S7ApNXUbgDh33oW44kl7BclIAcdkKJThbxtk20PBiEKTitP6KknXZcffMBT1JE5givqSqni63usepJCTEkRknxLxvyuYwOVnWA3w2f/di0fJlHWaBD12B3HlvP1NcAVsYzHyIN68O/Y+WUK4a9w=; 20:V5UyMnP1C4TNQMiVb32U1ahj4kFE2k+RTwYbvLWMUDKEEmZOi8Rc+MSZ6066ZJ4q+6P5I2UmGdJS969jcwhaklBapLSpFPV7dHlExhSZLYB9OWrVncHoxmjTLga5YZT2BadChsxBxF7VLI6r9B1PSwtiZjb+tqXbozEnX7UjgS0EzpkFIOpXeqKBykYu/RFh4vsvG/fwVUAZfHmC9QraoOkwBMnzKKJ7NWE0QtTp9PlnHzdrpEcaClwhRaS7BxtD9s8xouWVlYq/ZuSwWvhORbTuz72IT2k6hJ1izYo7Rpf6C/DnrKUMhG3ogHLOGklgKDXgQYJ9kRPuAIDyAEmBMNkPuzu8Tv3ad0/G5R6bLEe+5Jg7PCQ44TVelF0cmharUuBfrbaMHaqyA2f2zKsI8hON8S0H/cCdL2ZOZ9c08gue3zTZgkFYpm+c73FzNMoh+h9MgJnEfpfzsBip9z/0Hu1LlBSPbliMi4X/7sKDdrbNXPEH1jeYKq0dZprCUcpK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:BY2PR12MB0242; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0242; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 4:pVa8h8akFPWsXSV0yR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: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 20:LJvduC2My9jFu53tqC8XdJ9Fy9qBd7oYYMuvVmzIsLMwou7nX5eIIhMfR3YHtpBFxkq0FcGsxjdwFn5Czlh06CbKBykpsOddMiH4aogcQz0jfn1uVvNH3U9aMVT+oWwBOEh46ps8gA49KjDp2TGfPqfFqcdoAL7YN6+kMQUepVlZqxoinUmpq+DzrzlAD9WlvSgYhldTReKHVG44yfMhemr2kt8zi4YyA01yfXK8Z/zsDCbf3efPkjvnq5BS7JmD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 10:01:01.2951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac0dc37f-8923-47c3-157a-08d5fd15d8bc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0242 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I continue to work for bulk moving that based on the proposal by Christian. Background: amdgpu driver will move all PD/PT and PerVM BOs into idle list. Then move all of them on the end of LRU list one by one. Thus, that cause so many BOs moved to the end of the LRU, and impact performance seriously. Then Christian provided a workaround to not move PD/PT BOs on LRU with below patch: "drm/amdgpu: band aid validating VM PTs" Commit 0bbf32026cf5ba41e9922b30e26e1bed1ecd38ae However, the final solution should bulk move all PD/PT and PerVM BOs on the LRU instead of one by one. Whenever amdgpu_vm_validate_pt_bos() is called and we have BOs which need to be validated we move all BOs together to the end of the LRU without dropping the lock for the LRU. While doing so we note the beginning and end of this block in the LRU list. Now when amdgpu_vm_validate_pt_bos() is called and we don't have anything to do, we don't move every BO one by one, but instead cut the LRU list into pieces so that we bulk move everything to the end in just one operation. Test data: +--------------+-----------------+-----------+---------------------------------------+ | |The Talos |Clpeak(OCL)|BusSpeedReadback(OCL) | | |Principle(Vulkan)| | | +------------------------------------------------------------------------------------+ | | | |0.319 ms(1k) 0.314 ms(2K) 0.308 ms(4K) | | Original | 147.7 FPS | 76.86 us |0.307 ms(8K) 0.310 ms(16K) | +------------------------------------------------------------------------------------+ | Orignial + WA| | |0.254 ms(1K) 0.241 ms(2K) | |(don't move | 162.1 FPS | 42.15 us |0.230 ms(4K) 0.223 ms(8K) 0.204 ms(16K)| |PT BOs on LRU)| | | | +------------------------------------------------------------------------------------+ | Bulk move | 163.1 FPS | 40.52 us |0.244 ms(1K) 0.252 ms(2K) 0.213 ms(4K) | | | | |0.214 ms(8K) 0.225 ms(16K) | +--------------+-----------------+-----------+---------------------------------------+ After test them with above three benchmarks include vulkan and opencl. We can see the visible improvement than original, and even better than original with workaround. Signed-off-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 9c84770..eda0bb9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -286,6 +286,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, { struct ttm_bo_global *glob = adev->mman.bdev.glob; struct amdgpu_vm_bo_base *bo_base, *tmp; + bool validated = false; int r = 0; list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) { @@ -295,14 +296,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, r = validate(param, bo); if (r) break; - - spin_lock(&glob->lru_lock); - ttm_bo_move_to_lru_tail(&bo->tbo, NULL); - if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); - spin_unlock(&glob->lru_lock); } + validated = true; if (bo->tbo.type != ttm_bo_type_kernel) { spin_lock(&vm->moved_lock); list_move(&bo_base->vm_status, &vm->moved); @@ -312,6 +308,15 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, } } + if (!validated) { + spin_lock(&glob->lru_lock); + ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); + spin_unlock(&glob->lru_lock); + return 0; + } + + memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); + spin_lock(&glob->lru_lock); list_for_each_entry(bo_base, &vm->idle, vm_status) { struct amdgpu_bo *bo = bo_base->bo; @@ -319,9 +324,10 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, if (!bo->parent) continue; - ttm_bo_move_to_lru_tail(&bo->tbo, NULL); + ttm_bo_move_to_lru_tail(&bo->tbo, &vm->lru_bulk_move); if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); + ttm_bo_move_to_lru_tail(&bo->shadow->tbo, + &vm->lru_bulk_move); } spin_unlock(&glob->lru_lock); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 67a15d4..92725ac 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "amdgpu_sync.h" #include "amdgpu_ring.h" @@ -226,6 +227,9 @@ struct amdgpu_vm { /* Some basic info about the task */ struct amdgpu_task_info task_info; + + /* Store positions of group of BOs */ + struct ttm_lru_bulk_move lru_bulk_move; }; struct amdgpu_vm_manager { From patchwork Wed Aug 8 09:59:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 858E013AC for ; Wed, 8 Aug 2018 10:01:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7435B2A95C for ; Wed, 8 Aug 2018 10:01:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68BF82AA1D; Wed, 8 Aug 2018 10:01:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 232572A95C for ; Wed, 8 Aug 2018 10:01:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C788B6E504; Wed, 8 Aug 2018 10:01:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680063.outbound.protection.outlook.com [40.107.68.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id E23876E504; Wed, 8 Aug 2018 10:01:29 +0000 (UTC) Received: from DM3PR12CA0084.namprd12.prod.outlook.com (2603:10b6:0:57::28) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:55::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Wed, 8 Aug 2018 10:01:28 +0000 Received: from CO1NAM03FT019.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by DM3PR12CA0084.outlook.office365.com (2603:10b6:0:57::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.19 via Frontend Transport; Wed, 8 Aug 2018 10:01:28 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT019.mail.protection.outlook.com (10.152.80.176) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 10:01:27 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 05:01:22 -0500 From: Huang Rui To: , Subject: [PATCH 5/5] drm/amdgpu: move PD/PT bos on LRU again Date: Wed, 8 Aug 2018 17:59:37 +0800 Message-ID: <1533722377-27020-6-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(346002)(136003)(2980300002)(428003)(199004)(189003)(53936002)(81166006)(356003)(7696005)(51416003)(110136005)(16586007)(81156014)(450100002)(106466001)(48376002)(76176011)(316002)(47776003)(126002)(2616005)(8676002)(86362001)(105586002)(476003)(50466002)(575784001)(486006)(36756003)(2906002)(97736004)(4326008)(11346002)(50226002)(26005)(8936002)(72206003)(478600001)(68736007)(77096007)(104016004)(5660300001)(186003)(14444005)(6666003)(305945005)(53416004)(336012)(426003)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0122; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT019; 1:RHp/9M8gFqUcrPkM/yJu6vBb1E0MDuiabjU+icZscd0oKOaIF8PtGjnGbNCHBv9EvpLMBmwuRbe99t31vtMjL5Nspm/gb9iBpRP56v7sQSL+1jZ4TdcH08bu63jlO9eI X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc87e65d-8324-4b36-1de5-08d5fd15e89c X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:DM5PR1201MB0122; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 3:NirtX3qPSev8ouKEM88PP6KxQ5lGDSRyJej+Y87dkziCBB/9GLozA+0MruUdmyD8zWKu7Yk3IV5qbp9512pcH+BQFam2GNd5APVccxnzyItlFgO1ewz1IdPjbKz3uy9G9JmJWftBiXisbzGuSx97YxVqz5PuLLZiyP2v9mx4e58YJ6dSf8noQS9X7+JeFFYCS3iR1pROWDZAJ/mr/4gNWh0ZK17jzAb/mStQ5qM3fqEeK2JupRRyGmqYT9DTyR+4Cb6MJ0pDX4M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VMv48SdAYHlFdPPn+gdQVqSb5AbCtPixlUHMLDLHvAzc0lcBjv4+FVNC9QjQRLgLpMdFuxK7gCyuKt4teqpVPFLnjSUMhqy61FK8PY21QmgZXqYEqlunvz7CUQYdzfOJAwEaUvbH95nftiyYr96Q1lDmjL57bqSSDD5VHNKXmfUGKHOWszjnjGYS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:DM5PR1201MB0122; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0122; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 4:bB8ti5RUvlI552bGCpDWS3AYptPpqv7kPa/DezwzmXZVP0VK8jRlUUXdSTG3tpWfEltPs1WZe4s2ov6YZ6qBBd6az6G30flW68rW/SXcxXotAgTuvGA0M60n5CKPHlHWVqFAiWZ9oyW2u7KxGBMGavNtGK5fQ94MljLd/xEEEuiafwOXhIjQ5G73uHcPINplzVtWt/hFsPOf77P98btzViRTZmTv9to6kKbhcymWA9eK1uJ+MQ1MjEZiYWXCAqY1edn/2YCoxnDxs52e1IIfxZfh0o4Tn9QoHkxGmLReDIpZKfjGNchju3Wva8TkgPPc X-Forefront-PRVS: 07584EDBCD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0122; 23:h+1SvrUPJVAOoGy1jCNOw4mhNOXSP10OatwjIxC?= 2yDySYcEAETzJ8bVo2Z2cBWjqi3YOV13OG3C52DUJt/HPAjpt5AD/PN8kKG8aDs44xyc0WVnawxYWDMBYUuhB1cNe+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W/DdhOTPy5ZmVJtLFBge28YQ5NZtI8MH2nc/vvN5JaT/5z6tr/U658mRhlmCISKeS8Xw8BElNVN0EVy26mBPvIC2qqkxaa/3EIGrbvIePpLqP0BoLvkpx9WA0KqVaVQ+/UWlS8xNafoL51kUfTGPFJGZFMPpbvyD3e/oAhuMuGSVyaUMb7ulR2WH4t4TFXSxChu9Mk9//xztz9EALekJJv6Le7ciMXwx0pWWNccZurxiyUB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 20:afYNRiuxDUkpbJ4R9lqaRCtBvo5M1WvlonxrLb49UqP/sENQXHvvhJkOd+LWtbgPQRaEMb3l+SrE31k1jdd2wEP9Wr6TehyYuepk+bJzskA2ZgbzC4YHzkfhKnTjPwN3QpJeEgiUmQbJMWv4Me78ybiQEJfT7o0N4RlBg8lz9pSBwT0orfFqkwsGdg7DSlMA3R9ROYipDgzw4Imy9kcoSQxU7p/9mHn4EOFGVi2b6abVnkUVex2HyidA7PIvl0E+ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 10:01:27.8822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc87e65d-8324-4b36-1de5-08d5fd15e89c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The new bulk moving functionality is ready, the overhead of moving PD/PT bos to LRU is fixed. So move them on LRU again. Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index eda0bb9..3550166 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1090,7 +1090,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev, struct amdgpu_vm_bo_base, vm_status); bo_base->moved = false; - list_del_init(&bo_base->vm_status); + list_move(&bo_base->vm_status, &vm->idle); bo = bo_base->bo->parent; if (!bo)