From patchwork Mon Aug 13 09:58:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10563965 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 1A18F1390 for ; Mon, 13 Aug 2018 09:59:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 062CB28E22 for ; Mon, 13 Aug 2018 09:59:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE2AF28E50; Mon, 13 Aug 2018 09:59:36 +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 F046B28E22 for ; Mon, 13 Aug 2018 09:59:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E3C289CF8; Mon, 13 Aug 2018 09:59:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690051.outbound.protection.outlook.com [40.107.69.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21F0C89CE2; Mon, 13 Aug 2018 09:59:33 +0000 (UTC) Received: from DM3PR12CA0072.namprd12.prod.outlook.com (2603:10b6:0:57::16) 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; Mon, 13 Aug 2018 09:59:30 +0000 Received: from CO1NAM03FT052.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by DM3PR12CA0072.outlook.office365.com (2603:10b6:0:57::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.21 via Frontend Transport; Mon, 13 Aug 2018 09:59:30 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT052.mail.protection.outlook.com (10.152.81.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1059.14 via Frontend Transport; Mon, 13 Aug 2018 09:59:29 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 13 Aug 2018 04:59:28 -0500 From: Huang Rui To: , Subject: [PATCH v3 1/5] drm/ttm: add helper structures for bulk moves on lru list Date: Mon, 13 Aug 2018 17:58:47 +0800 Message-ID: <1534154331-11810-2-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534154331-11810-1-git-send-email-ray.huang@amd.com> References: <1534154331-11810-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)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(428003)(199004)(189003)(53936002)(11346002)(50226002)(53416004)(4326008)(5820100001)(450100002)(72206003)(336012)(186003)(97736004)(426003)(77096007)(486006)(446003)(68736007)(86362001)(478600001)(81166006)(81156014)(8936002)(2906002)(8676002)(7696005)(23676004)(6666003)(104016004)(2870700001)(126002)(476003)(26005)(2616005)(50466002)(76176011)(36756003)(305945005)(316002)(106466001)(47776003)(105586002)(110136005)(54906003)(356003)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0242; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT052; 1:5GI1L4zddtklNwgC3joWWqfUYpMaMwnoi9iM8wDHeGBmqN6109kfywBohEjO9jbbC9G9BwZ2r9DSpvqaBHGmBTGVktVI2Zz0QzzKwyDy1PGHLeXXuJhVdrH0y2tu2oTi X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b8202dc-dacc-4eaf-75d8-08d601037661 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:RVCM9E6/BeaP9nbHY0a4EIZZi+IoKKUG2A2fruSElG//YPgN/xaAOCaOB4y6OQI1r5pXo8fBwRA8gTPAcoKbM5BSkG5Gkqo8EIWjfaQiQKv0A4YJ/18O0MoN0unFZvBkaenuZJmZYcbmqZ5eP+tvOSuP5KeL14SSWXKKvQHyOaq5A2vo/qlTQUU0qj8QgUUeqplss2EsqKxIz3mD/MPpzH9WJZONrSDEOtygU7NQtzQuTZ0fBl+1GUxM6dmEUq23+siPrnOa0qyPioP5iP8kihtgI2KvZVctxLQMnByIEFWWs6hA86kvn8ZphIhd2uofXTZz6ba6VvwykIYsY3AsgVJ6z6oXJ9aSlXX3YX6KHEs=; 25:Gi2tD6/DxMk1UE3qRJmFCiXa8Whn+DTXXBFKABNPyxC040OKzfyf4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wm3kfDVlWwIbMjzauTi0A9+qsCakcWvORf 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)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93003095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:BY2PR12MB0242; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0242; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 4:z1nSs/t3Zl9HDADmB6/fxFfBtIKK6T2SPSKwAuf1AWesciFylyzgu0J4pWGEGRQLSMuCmMUmwB9Z5Twq0DSztDolLL1wDIQyINz7jr1aaZ2YUA4bi+8x4+W0XtY0XrfkTvOCjn/x2IirZ/lW7+zeh45mPZmpA+nFYY8D7jsW4mA5CZnVfpFmQEtTO5u29wHKfubJ7sgZFEGlMm/pg5qu6Rwg9ZbmSiPy6RciPJzw/Qj7zN2KQaX4hOrgfWEH1EVvROdi60ALEucRdzjLQhF5ysugYoG2Y1yr0Dx37u/WrCqO2o4PoTavs1mVZ5cOd1ZS X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBY2PR12MB0242=3B23=3AKCQ16aR?= =?utf-8?q?ay6yYrWYQXwu4IazFdd8wifnF8cmwuC1aU2Mdi/ncpubOo7Foa4SsSoKXQrOvuNuH?= =?utf-8?q?6IVqY4G2E9PBjAjsT+r6iFiPvbB77WWT/8Iz98qS1vJ6EnM0+w0q2XbY94cBHOoV7?= =?utf-8?q?xdbbc4VAesc4qhfB3bwLkOgrcmp/si10a0jkHJsgIbLaesaCItVCfLmArH0sDZH15?= =?utf-8?q?N2Cw3ZjNT/zEvyA1g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6SI/zUMIEmtF39jUKEn4R5g0fvggeZmsLPQ4lLCCVB7pz9KeoFSd9d4PAYfFA=; 7:HcPKWLEHm4zAUtyEBPP+W8zRkMfMVOdEfavUokvwxW2qyS6xH3vPI7xI4fWZG7cp0kG8sqdV6kx98biOIQhGrRqy9FafVd/ykU+E0fW5w2AKsZYSkmNEZWrwrtw5uVUu1GtG0FjHqlVhFQI/BIkSQ0zZuM+kMJWIVT13kBQKcu+0CCr+rRTtwhOPx9/YTycB30to+Jw4y1nA+urrGYnglLQ1c546L6jzYRsRckegUU/YmWkukv2LaJimGItJ5A9M SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 20:zuTKKCI9yEdpYyHVmhoSqH9vdreJyBVjuN9D5MIEpKh2cMf4IcaC0Z9gzRAUUgAsZZd2PJWCdcdDR5gwSD7XCWpY/WK1e97M2ng99mZ4/HgcjQMYi8vbpDOvqeMGVGL0dCs+hZUnsLnjYuAzjuYSSnz2AY7h+H4IAj04r2Pp+HwNxwGnB8Rmgaj4ZEPEroG5keCZ4nSRSEP+Ony1AJeiV2o3ZfqrcDSWgVmXbETkYouOCwLIiInIdhcvyRmrtKOf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 09:59:29.9931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b8202dc-dacc-4eaf-75d8-08d601037661 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=[SATLEXCHOV02.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 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 Tested-by: Mike Lothian Acked-by: Chunming Zhou Reviewed-by: Junwei Zhang --- 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 Mon Aug 13 09:58:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10563967 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 1F1CE139A for ; Mon, 13 Aug 2018 09:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AFF828E22 for ; Mon, 13 Aug 2018 09:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2C3328E50; Mon, 13 Aug 2018 09:59:55 +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 8EB8628E22 for ; Mon, 13 Aug 2018 09:59:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6A7B89E11; Mon, 13 Aug 2018 09:59:53 +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-bn3nam01on0089.outbound.protection.outlook.com [104.47.33.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6411089DB9; Mon, 13 Aug 2018 09:59:51 +0000 (UTC) Received: from BN4PR12CA0002.namprd12.prod.outlook.com (2603:10b6:403:2::12) by BY2PR12MB0244.namprd12.prod.outlook.com (2a01:111:e400:585d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 13 Aug 2018 09:59:49 +0000 Received: from CO1NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by BN4PR12CA0002.outlook.office365.com (2603:10b6:403:2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.21 via Frontend Transport; Mon, 13 Aug 2018 09:59:48 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT006.mail.protection.outlook.com (10.152.80.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1059.14 via Frontend Transport; Mon, 13 Aug 2018 09:59:48 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 13 Aug 2018 04:59:46 -0500 From: Huang Rui To: , Subject: [PATCH v3 2/5] drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves Date: Mon, 13 Aug 2018 17:58:48 +0800 Message-ID: <1534154331-11810-3-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534154331-11810-1-git-send-email-ray.huang@amd.com> References: <1534154331-11810-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)(136003)(39860400002)(376002)(396003)(346002)(2980300002)(428003)(189003)(199004)(106466001)(53936002)(105586002)(336012)(97736004)(26005)(316002)(77096007)(68736007)(2616005)(356003)(476003)(426003)(126002)(305945005)(11346002)(446003)(86362001)(5820100001)(2870700001)(14444005)(2906002)(36756003)(47776003)(8936002)(72206003)(450100002)(76176011)(478600001)(23676004)(8676002)(104016004)(486006)(81156014)(81166006)(186003)(4326008)(110136005)(50466002)(5660300001)(54906003)(53416004)(7696005)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0244; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT006; 1:mTAqKzvFjRTk2eRBKfgTRIq6fQDQdddGrXDxsNK4Agjv2eDj2wS0jrA08fWHTe6VduCzp76YJ0yutLFPCyHiJARVFb1MjsItmq+15cZF1RHocXlwKrZVr1JwjF3Na/kj X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc5b8f28-6685-4184-b0a8-08d601038141 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:BY2PR12MB0244; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0244; 3:FICOn4r5hjFhTBoGz3tDJVmfi8D+XwC8w44APUfDhKilgPkE6Td3oalorNCFMJAzYGpAX3rw/zBdaq2txoHYPMyOagbTyKjevFtc4Kz3KVVJoNoJta9MGpvQMGPHQEHfSoYb9K3gzzXDQaq3WAEPVY49GUqatzgSp68VSCw8J6J2HsFBpk7EDac187jTA8QHWyomCmLgrkMNFR+jflN8bOBMmwT60zzyPz/AeAb0nq7se5hTTi3KaaaTDljkK72zSsJc3NIcpxaCYF1x88ES8cFkHy7Pqz78wEBBGZCK3CUJzqJK70zbZp3RMszl0sjddHmwKzKYUcrThclqoyaFTpAbbcUSQTwSC+4OAXQa2/A=; 25:GN5cWWmiIqA09JtGGO0xlFOecaD+jly4EsOze7jBsPn56Q6XgLLiAXfApqCK3CMszjDtpmTjKKrlmUfBGAvN5aIvMEKsoataWIYwIO9pjvYIysgRBJ+jWvVXi82s/cRK7awZxLbW8NadWOEm0/D7L5toBDw/jsTIlNqRj2oHB5TlQSTLnaBNrdbWKhcT0+Zei/c8e0ry79fjVMU0A1VvyLsDcuCioUVkMVy52KNKdukHCNDVaX7NBFrq4xKRRZFvLpnp1RlXcR7iUDcyD2NRXbW6/jXsRl/bAVX1rwXkovm46esrR7LyC5MoTWefd0ePWSqW7FYAnD3F2tPpJLDWhg== X-MS-TrafficTypeDiagnostic: BY2PR12MB0244: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0244; 31:heVxQgbsln7P013pOWYqF+HO1j9AYBUKziWSX8dbbb+YsF4dO76o5xfRg/CdTfX/XNxPgRgZIA9W3Ux72cu20THyTC1AzGZt2Xdp+ol7M/2/hu0e+lYr+ylLc4ZgVUqt9/BsoUoYXiq2/6Nov3cKXR8SpLO6W44M7KaGd58ju87pPyEXSYzKmZIrrhUgPxy/y+5HPc7Ihz2qyF3ySIeZu8+sBFMJqvck9AShfRQA8Ow=; 20:oB7UuDuPJ+tQZofIUGFn5DMtuFlUffhC2z2VFmah2Ivh0YZVd3xPWuApgqDJ/NxH8HEsq84l4ugNLMwLP/ovT39DUdnAzttIn6zLDNqeobaRpJg+52S5FgYwMdGuiULZAMClR8jzS85tb1NmZkKgmZd13kLwr2FXwkxU6WyipLSy2NoxMRou5PqQKbV5E7O4d7su2AttDxyccSK6Q6dy9kBa9r5LVHS9Fq8qI6V5aoBktqXBTFY/vuDA9J+iP5s+U0XKe8+3+9VkJsb40OyDmFYzuQM1nkiRQAjWusjzjeYS3JXDclKmR5L0o1BKUIeabcTUDvc8AZKNDreNm+U3gR/wSbs1frcxdZ1R/2kKtHwH7UrHyNDekJVNi7JX7wOuFp5yUsnDicnmsFVm7UTC7pMD8nVhmlpVKaBRod2rV2mfVjWWEfspvgl721ow0zmP2+2tw93b3yyYjlQzItmzvjn7JQ9tVEl4wuyqNhWT8LSFBDVVvslRfb5N5XioDX3S 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)(3002001)(93006095)(93003095)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BY2PR12MB0244; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0244; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0244; 4:F3U0zr+3olSFdC2kvr5usUE55AHPkpBbgbtG194m9qgtWrXcyw5Od3WH9+f2xRyR6Vb98nguf6P+a1eFkezEWOBITfHsDOfcX7xLBj5c/hYW5uCG+NfN1CKEJu3n/1HllJ5kPIf+iNBEy9cDZcwGus5fL1eB2XH+byqCY/SgNeUcUmq7RsdE1povIldXMGgDcE9SFF0NSUVO6EfAZcCi7mCPa9QdcExJbkNeG8VE05g2IooWC9x2u5LXMDVsuu7xV7mVIjba2pxbDKAnMHxejMDi2c2Jzu5tDQOrGrteMfnVyZ5W6oI5qhjLE4rgomzb X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBY2PR12MB0244=3B23=3AZzyDehl?= =?utf-8?q?iNg69bYn4vwvgd93nELMotii4LfWmz9u5JWY40+rIwDFniJ9BaSiMUgxKZH2zhLb8?= =?utf-8?q?GOlpA7Kjb9UzCtEFyurWtBgXtqHGUKkMlalwk+ioI4RVjkN3Asp0s39EU34EiTQg8?= =?utf-8?q?QbID+EOhr9t0zb8Fj6VhnbOP18QVmi+sozzqMUswXN/POGixADm3g/cjEcCyxFq4P?= =?utf-8?q?rmvtCHG4/3CvZeZlkKH/l+QeHFc7YhGN2bjw6wi2tmo0U3nTQCFONac4hpsMx9dyN?= =?utf-8?q?RGgnGN+9g3njpUfI+1vlU46pgQAuZiCHLCqldU0H7XNEZabE6stS83CxvEQdcpie1?= =?utf-8?q?Asbz+wFFElazOkrctw1aKzHbuVpsGHAGsZlW5sEnaQbOFaXWfFq/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44Ie0MJcFDH/df6Wqn+/i52oLtjUrC6RGzHbFbBGgQ8qnu3Sa7HaN4hcfcHhWkDIGd1+4vX3Gd3WikgCVNeWY6ciyJ2OngJOgH8Q83QJGRu2PHL7N6AbamW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0244; 20:I1AzZCoxaPIgwnHzU4bD3Vkbdw7egvhYVLG7bhRdJXRkffaoRt/OC4m2X31dxfiYLu163jka1N5tjTdHRD7tJtmAnF7r8qWVcgktn/7mjjy9Ksizu/laytqyG9S47P+gE5DurAYs2RXsjHQLkZYesWD3wJrocrcELPDz6PuyMJglzWkjnor8GU3h9p1+mnCmlfqUM+LB3qywqgNvaf1FU/oJeDPNn2LilzL0JQqUK5NfP7s75UIFSpyFsa/qfxyA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 09:59:48.2084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc5b8f28-6685-4184-b0a8-08d601038141 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0244 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 Tested-by: Mike Lothian --- 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 Mon Aug 13 09:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10563969 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 EF113139A for ; Mon, 13 Aug 2018 10:00:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD6A228FD2 for ; Mon, 13 Aug 2018 10:00:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D091428EA0; Mon, 13 Aug 2018 10:00:00 +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 6ACA428EA0 for ; Mon, 13 Aug 2018 10:00:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 775A66E09C; Mon, 13 Aug 2018 09:59:59 +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-eopbgr680062.outbound.protection.outlook.com [40.107.68.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id 06E086E09C; Mon, 13 Aug 2018 09:59:58 +0000 (UTC) Received: from BN4PR12CA0008.namprd12.prod.outlook.com (2603:10b6:403:2::18) by BN6PR1201MB2497.namprd12.prod.outlook.com (2603:10b6:404:a7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Mon, 13 Aug 2018 09:59:56 +0000 Received: from CO1NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by BN4PR12CA0008.outlook.office365.com (2603:10b6:403:2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.19 via Frontend Transport; Mon, 13 Aug 2018 09:59:55 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT006.mail.protection.outlook.com (10.152.80.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1059.14 via Frontend Transport; Mon, 13 Aug 2018 09:59:55 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 13 Aug 2018 04:59:53 -0500 From: Huang Rui To: , Subject: [PATCH v3 3/5] drm/ttm: add bulk move function on LRU Date: Mon, 13 Aug 2018 17:58:49 +0800 Message-ID: <1534154331-11810-4-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534154331-11810-1-git-send-email-ray.huang@amd.com> References: <1534154331-11810-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)(136003)(396003)(376002)(39860400002)(2980300002)(428003)(199004)(189003)(478600001)(81166006)(8676002)(336012)(81156014)(7696005)(476003)(2616005)(5660300001)(23676004)(36756003)(126002)(105586002)(72206003)(11346002)(14444005)(446003)(86362001)(426003)(8936002)(47776003)(5820100001)(356003)(53416004)(450100002)(53936002)(316002)(54906003)(110136005)(104016004)(68736007)(6666003)(50466002)(26005)(77096007)(305945005)(486006)(76176011)(106466001)(97736004)(4326008)(2870700001)(50226002)(186003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB2497; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT006; 1:Fld291riVt9bArd9M9ozHcNFK+VCnfev1yZU9LsH5u+Fj5xltU0uLGOiqxvfH2z9ssDjMdTqtKxgAGe6PxsMHq/i3qqg2x6OXZMWvxmsY33MqgViLCBKPIcY+8pY0/bh X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34af3209-2d85-40f4-7f03-08d601038593 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:BN6PR1201MB2497; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB2497; 3:XQwms55p4kNdyKMtQ/mfGEX62CugXUjZe3lTkCJ1BflnAM4w03bGYsJu84ZpuXdB9uBobJsah5FfdCzMd7AEXqXUacNUjsDP1fLweKeOIsFIvoi2bMPCIR/DOVIdGzUjXcp/rqtxYCu/SeoKNOLzJWaCANaxVCcDdRliaB3S5tSsXSf2YFP6gqZjd+8rKEj9jMMP0oWJ+MbXQvc/3h3BUe1dNmW5TqKe/DANWjBXDCtAd8AJKs8Tf2YhnsbdrDPeCfv4WN3+gadOeKpYzKzLCzvIeVVXqYIH9vHC0L/VOtg7V0YmGMmhuqXsMv4OuPFt92WKoupaWIV+RF7k9JNLIXxRS+rO8LRfYS0wdkLNBMs=; 25:JfVU1gFyRvilJjmP/weaP1J9KFyfC6fKVg6Uv8Ux1q9VP+JdXLmidPN5mU4OYo7q3N/82KhB5NS1my4ESCbH3licGc9Ttf1vEgU7Y4uu1C40+5HaX52JbZ/ivaqhyq0Jzp81mEkEoB8yWZDZlhKUwHEJyLBZu/nvJi6k3WyBrjAm/OkScG3gewaX4s9jLCV4PQ7HK6U8G3UjfufFmGysCq4prKzyZ4zgrf/T9VvxhwJGcfMPYj7pLUXKf0Q+0OAx3LHKSOrSQQHk+HtKe/VL8VRGJWA6b4cJflVHU1zHiI591pysjfzLYBvWAzherzlraViUE/6R3W6nfDdpafoeCw== X-MS-TrafficTypeDiagnostic: BN6PR1201MB2497: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB2497; 31:rMUCubMOlWUYecU4HKzYL31aiD4oBHWUGw6GPYqK1gaz3oWLgzpFk1P4JIeQRVsu3FWUPKyOrib35Gn0Aulg7/3uzbXKUD2x8hvlj5HmoXPQl84QTyO8YB6rla3pJa3mrMa/TbPft3+n1sbSdkeDnl00WFwv2hmNIcFqSzXTXk3YTRM/Gy2/QhLU++WTnhR++gYqo73OzBFIFpq8xC9rLhs7PYCc2uyNge7+JQa6aIQ=; 20:LSbnAlobaQ4CrZmPtfsgOSZ1Kgd98Eugrz54dGp1nO7WgyLA8H++mgKRaP5//bXk9864Ot3bDip+j4S6gOBeA4gQG21mewdXjp87cy0rTvcnpIfssVZnz8OtRE+uZFkpp0unKna/2W+pwoAOC9lzbNX8hs2T3BMRlTULAuchqNZo0xnVJuQ2i49BOe/g8WQ7dzHCXcYPmWricY0zvkROG9VVa5lAQgSS85lYasBPlFsGCKN1UGYBVFuCz7vHe6cVP8tu0oB/EfhxKaGPa6iqvuN37cqOJ6ipMwPxNTOWonTtc2nAQdGAbm4C/052rfTi1CQco8rKaLu+Y142qaiVdwN8a5Y4whhdKHx7e8W5Al8rGBBe/YzlakD3mqGaIdxTtBm5aenzV/mWhnwwASTVo6I/peGhuO4U+mpnA10+F8inEF7Elb8FwCvvkitxwdaNx9Hyu1fMIpSmiGNF1D45cT4WffPtdKSBy7l9GY+UM+MWwqGdpPh1vVIwQm6WDxay 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)(3231311)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:BN6PR1201MB2497; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB2497; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB2497; 4:JGGSo0GEPQU/9Slv1T1y3gN/cbRh8MeOzmz4wwWHIpJsj+FqxfGOc3sMeqlotzzTkT1omHp+q1Ti5I1M6SC4Wf43A7q38q3SzLvwTIiSbEoA6vsGe8Mefkv8NYVYMSPoPj25XCFiwMNgV1JdJMKr+H3u4YGQY/AMZDvW+0TEP21pdgpOYsVqO4cvMxa0T/Jll06RlVX1AVVgL/gTiBOUcs0/Ihk8zRXJLiFJmqEz9gSbZzeWFhIUPdSfuGgxDZX+O0bEZQ2H69BxzlQ3Mfh58H1Qg5Tfx8atopub3C4WHmb9XXa7jklkoqfMe6S3aSeI X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBN6PR1201MB2497=3B23=3AgrTv9?= =?utf-8?q?9QeObWtFy3O/VlA2OIOBMN839Mqtaso4zwv36yNod4JbLm5+vhQeUkxTXVGFmZZ+5?= =?utf-8?q?Ax+eu9jItbhTFw0yPqvvBVn54Qq091JJFZ76LBb0vlTiEPfRDTyna0WWv2gRHKRIw?= =?utf-8?q?/y04rccPVyc/5sbO1WwfCbpc8TCysTfluySlGd7NFDF/NWf/nqbMmHhqddmiexEyg?= =?utf-8?q?zqmkrFo+eIsFZAHWY9UbfR9tuFJivA8sxCNMfGRFWGxAi38xgNt0UbSlcALdD2gkL?= =?utf-8?q?QM7ze7O8wywlvzLzLaWJBhoV+mkZL9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pDyX4kwV9Gzz/2xtQ=; 7:77mmk/Smz4k/LtLlJQgR4PiJpNraptRuLnW5FYlsgsTefIg2ykbpiLqVPw75XkIYjfrPXJlkNzyYfk8aPRVhMhQulu8NWhHGDs2B67wAfKbC25vZoo1jgnFB7ZFpiomf/L1C+D25KykCS3h+F5cOkKcA2td9yeE/AtwjVMuX75V5FQiWnJEos4qrc9/wQl1AZ5mSy2+vlFCq0eRK7l0bGEA5knvXkPHJVJFu+hNHgyMuVzWVNtmCgMPAyHfVDCnb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB2497; 20:/40jt/D7KQzSGROJftRVO+GZa9Uy8LZilE61rnUP0xQdFK2z82AvBygwa0+GPCf73KiTm8irFZ2UztP1e5AdZA3A55uGL6c1fgMLew9+NuhASHHbQrqZRUy/nF7scrEmr425ca86hx+dAu+IcuSEAYuAF6akCjQjjTf19APxD+/vOIxCQmoPQb8r/FYdGl7/sKSUTzO1Jg8YgvU8IiJm5BwdZzMf1BlA5CLDWmhQy6I50qqtExnjIMpff6XyT2y8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 09:59:55.4413 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34af3209-2d85-40f4-7f03-08d601038593 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2497 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 Tested-by: Mike Lothian --- 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 Mon Aug 13 09:58:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10563971 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 79E1D13BB for ; Mon, 13 Aug 2018 10:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6689128E63 for ; Mon, 13 Aug 2018 10:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A71828EA0; Mon, 13 Aug 2018 10:00:07 +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 CA8D528EAF for ; Mon, 13 Aug 2018 10:00:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 762286E116; Mon, 13 Aug 2018 10:00:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0605.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::605]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0F206E0EF; Mon, 13 Aug 2018 10:00:02 +0000 (UTC) Received: from BN6PR12CA0041.namprd12.prod.outlook.com (2603:10b6:405:70::27) 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.1038.23; Mon, 13 Aug 2018 10:00:00 +0000 Received: from CO1NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by BN6PR12CA0041.outlook.office365.com (2603:10b6:405:70::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.20 via Frontend Transport; Mon, 13 Aug 2018 09:59:59 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT007.mail.protection.outlook.com (10.152.80.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1059.14 via Frontend Transport; Mon, 13 Aug 2018 09:59:59 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 13 Aug 2018 04:59:58 -0500 From: Huang Rui To: , Subject: [PATCH v3 4/5] drm/amdgpu: use bulk moves for efficient VM LRU handling (v3) Date: Mon, 13 Aug 2018 17:58:50 +0800 Message-ID: <1534154331-11810-5-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534154331-11810-1-git-send-email-ray.huang@amd.com> References: <1534154331-11810-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)(396003)(39860400002)(376002)(136003)(2980300002)(428003)(189003)(199004)(316002)(68736007)(36756003)(54906003)(478600001)(110136005)(76176011)(72206003)(23676004)(81156014)(81166006)(6666003)(97736004)(86362001)(356003)(4326008)(50466002)(450100002)(305945005)(50226002)(104016004)(8936002)(8676002)(5660300001)(7696005)(14444005)(336012)(26005)(126002)(11346002)(53936002)(2616005)(47776003)(2906002)(77096007)(2870700001)(106466001)(186003)(426003)(53416004)(476003)(561944003)(105586002)(446003)(5820100001)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0122; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT007; 1:Xnc7EB/3vBqZqsqeBSqkcreuu16k727JrxU95PktW8KJ5Xi35C1HKF0hjRbImaeq8RESiD+OK9mO/9CMj3ys//Rw8BMFKbNSiV9cV9/u0yMcRWdtCkWzH8qPBvdKGSY/ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8277074-062f-4b82-182c-08d6010387da 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:KZkil/wOwGvvmQpbqIkh7gIe/PwcZk525Xh2vUr+gdS6GZ9cvqAgHCdhvgo+QMr+47V8bQplt6jyfhdUAsxbdLRW5FmMDQF2hjq4HTrGAS5txHmROm0kFklTscrm7Dy6TkjkHJXImCdv0X6UAGI4NNBHd3i3392OGoYLI22JUgeoteiYXRDPJKBRughzF7b9fl4wWYU0UfjUSIf+tH4dIPUhhX/sF1Xdf7sBG1GNHa9k4btJ9V1ZpHApUbAxXFG5lDSj/yTIF66PlIlhvFLTK3k+poh2KX/dHGM7OBnMkdGDGA0YOitBCzWLHkNcg5761eZqQroi2mvu3yxmT2gkmgnoIJ7XGALkL38BDTcu/bA=; 25:Mw96rgkL8+loVGh7U64SxPR39Bm7wbiak4oNXbmgoHiGMlevIZ8MBcv48AVa6dsaY8o6OZ+4CHsJRrkUomndbwVh1g9Ew2eUYynm2E6LSNKLMft1mXqPOS79+eG9d2/W/uYMZR2DIwfaZGTvx0J8y+/O7bS5z8LnKMa14CBUH+zxhHVYDp/5hT4F2oyslafJb/WY5BWMzRtwQ3n+Fb/PFF8dQBhshLapSkIVY5S1pvu0Vzt4+nuJiK0f3uuTtWTPnA8M7BDXO/Un/DnldGtfTSTOt+IL3HD7jpztuNB9wyqAPOW/J16y75otHh5aWhzeLumLHkwSxFxwu6rC41jU7w== X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 31:Ul1ywX0cHSFj6dXn9dQlQRjsWGercaQzSagTsUY+AHa3oogEZoOLLw8hkNrb515vAuxs7QeTeaZfBEsJ5aNzfnbKMEBKjmt5NbKUIR6QYjS/kj7HXP4d5O+Jg11XH9gYun16H8hvQMHDKT1gNV7zzvx1UtzqlFnwobkFaiLDCoJZeGSqtmcR161h5JqtCwmh0tr+3aIGUIPdxwPZ9tZcnHQWXUf1ADsEtetXVlRvWMk=; 20:xldMSd/16xnqljeYBS9hR92ATTE5zaiyDFfareip8G5XhRGplhPbr7iXmK/KMkelT9yc4LGaDJ5LbDxF64I4oTP4xk7Or8Xc5G6ixumfWzUgf47MU6p2VT8u0CHSeO1xsNGX1NJ4yadBVEY4Bq+i/WFgX2yKkvekDjj41W0bSg6u6u8YUZRED1bxSEDOtDUzSfbeo5/A47U+vBhl5/eTl81OVIk23ajPf9TTNjoG08q4/ecCVbpQ8o5TorQ0P2YRsX68+iaaxft8CxVFaQNifPXSZERSJcL/qeNgEsIxjelVeA7Bh6n6ZloNjfXQ/8G4x5h1I6Mz4MmTJRVninxv86bKGG6+82AjtWDMfpNY+LqRy1BDkNUKTWKFEV6nMN9ejVMDDoVBxrPLKSLny8pmZLfUD9A6UJ9puC3pkSeOTUSOyHuiRjCs5Emar5SgBhgXcgvwswP2zs16LZsbYitpftmkTSXhgJ0TQXeu2mFZ/u6+DBHTX/VBjjopElMsR1qG 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)(3231311)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM5PR1201MB0122; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0122; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 4:ZB9u2u4xWiggiZRSWqpJZ6jeGuPSz/aiYkdgn9T8ySua4VocZoFqNbnUQpDX9gNdPUPxf/qWAKsRGXblX4VpJ/RevjbcktHSE99haCAK2uSwlp7ZAyvqcoSHepJBUzsgJnnjlzqMtwtVegniTXRWC+a38t0XBVpbDvBj0TAQPblFOY/zQasrhJ8ZnMoq7zdvpIieS2WevPSgNDZeJiyASvCMqEFVSmK4IynigyF09YhXfAYYe7gYFARD8GqQYbIxLRV3wntDGET40LVJV5YTu5nyRWXUkQ0axTjXIhVezNYYAWg/nBz3h7HhdswU1+/i X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM5PR1201MB0122=3B23=3AUCRmQ?= =?utf-8?q?FRAf7eOe0jBMtrqx2F9GGPJWV1jRw0pAApcUFBtH5AFyKW78owy55Va+xKJUYgHFZ?= =?utf-8?q?rHD1JK4trCpNkFoWglB5jH4f4XQ2gCvyO2QjMgVAhQReuluflwZavjJsgiAYLyRHQ?= =?utf-8?q?+0wpNPmM3ivS3xIIp42Aaw8pzfw5pnkej1py9kk69m/KmlMHgx9k/QTWZBQNyAl69?= =?utf-8?q?kGSJzzRljRBCCre/PTDP2wRJIFgHyzF54bKLwS41M9+D53NPmGdPjOql7YfyBjXd0?= =?utf-8?q?8wz4XvFxSOYNzc+65KrZqOWvVVBFE1WLaZqZaP3NW56eF0Q/EAEetU/Ceb4Ilh+DE?= =?utf-8?q?4nnfHJhRgvUV6fbTMNrqWvgT+kK2aMsO5HsAl3W7SeHgUl7wmqT3J5lmPdTRDN4AB?= =?utf-8?q?kQkNIsv63TbiPhQQZMYCK5iHmmAzkhB+ZC4oh0BhlZSRCz3XXBtfIB9TPtQrEt6zX?= =?utf-8?q?8ua/RG+mDPRnWVfE2yxJTaPjksw9YuJuHpuUyWnALL6HCW4bCreCxmxbFDI3KNUV0?= =?utf-8?q?xsnEjMyCc4H62IEBLFT4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GKkXD8/eyM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0122; 20:HnfsY65R6IL1bVO7tH5GpHxROSFCTGT3c07niIqVxu8F5RRtpzX6HmOOMS4YzXCTwg63piKB6CaT2mfKUyXvze7dtfVlSGnFcfvDbqPdcT2ozWSfk9JckWbQT/FpFI2lMY10PcGEIVmNk4eWyGgaiDTjRYA127thqiZEywzmcQ6hL0uOt1wpMZU7sfPV3d0h81TITIO8T5qMtC7mzs4t7Wyw1DkXefhVoq9BCNucwdRDzlBMM+vaL5ACngGSnDnb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 09:59:59.3219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8277074-062f-4b82-182c-08d6010387da 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=[SATLEXCHOV02.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 , =?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. v2: move all BOs include idle, relocated, and moved list to the end of LRU and put them together. v3: remove unused parameter and use list_for_each_entry instead of the one with save entry. Signed-off-by: Christian König Signed-off-by: Huang Rui Tested-by: Mike Lothian --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 73 ++++++++++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++ 2 files changed, 61 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 9c84770..ee1af53 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -268,6 +268,53 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, } /** + * amdgpu_vm_move_to_lru_tail - move one list of BOs to end of LRU + * + * @vm: vm providing the BOs + * @list: the list that stored BOs + * + * Move one list of BOs to the end of LRU and update the positions. + */ +static void +amdgpu_vm_move_to_lru_tail_by_list(struct amdgpu_vm *vm, struct list_head *list) +{ + struct amdgpu_vm_bo_base *bo_base; + + list_for_each_entry(bo_base, list, vm_status) { + struct amdgpu_bo *bo = bo_base->bo; + + if (!bo->parent) + continue; + + ttm_bo_move_to_lru_tail(&bo->tbo, &vm->lru_bulk_move); + if (bo->shadow) + ttm_bo_move_to_lru_tail(&bo->shadow->tbo, + &vm->lru_bulk_move); + } +} + +/** + * amdgpu_vm_move_to_lru_tail - move all BOs to the end of LRU + * + * @adev: amdgpu device pointer + * @vm: vm providing the BOs + * + * Move all BOs to the end of LRU and remember their positions to put them + * together. + */ +static void +amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev, struct amdgpu_vm *vm) +{ + struct ttm_bo_global *glob = adev->mman.bdev.glob; + + spin_lock(&glob->lru_lock); + amdgpu_vm_move_to_lru_tail_by_list(vm, &vm->idle); + amdgpu_vm_move_to_lru_tail_by_list(vm, &vm->relocated); + amdgpu_vm_move_to_lru_tail_by_list(vm, &vm->moved); + spin_unlock(&glob->lru_lock); +} + +/** * amdgpu_vm_validate_pt_bos - validate the page table BOs * * @adev: amdgpu device pointer @@ -286,6 +333,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 +343,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,18 +355,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, } } - spin_lock(&glob->lru_lock); - list_for_each_entry(bo_base, &vm->idle, vm_status) { - struct amdgpu_bo *bo = bo_base->bo; + if (!validated) { + spin_lock(&glob->lru_lock); + ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); + spin_unlock(&glob->lru_lock); + return 0; + } - if (!bo->parent) - continue; + memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); - 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); + amdgpu_vm_move_to_lru_tail(adev, vm); return r; } 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 Mon Aug 13 09:58:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10563973 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 BCD2B13BB for ; Mon, 13 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 AAA6628EA0 for ; Mon, 13 Aug 2018 10:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F12428FED; Mon, 13 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=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 49A5928EA0 for ; Mon, 13 Aug 2018 10:00:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 141816E124; Mon, 13 Aug 2018 10:00:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04on0611.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4d::611]) by gabe.freedesktop.org (Postfix) with ESMTPS id C60776E124; Mon, 13 Aug 2018 10:00:11 +0000 (UTC) Received: from BN6PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:405:4c::17) by DM2PR12MB0249.namprd12.prod.outlook.com (2a01:111:e400:50d1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 13 Aug 2018 10:00:08 +0000 Received: from CO1NAM03FT041.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::202) by BN6PR1201CA0007.outlook.office365.com (2603:10b6:405:4c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.22 via Frontend Transport; Mon, 13 Aug 2018 10:00:07 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT041.mail.protection.outlook.com (10.152.81.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1059.14 via Frontend Transport; Mon, 13 Aug 2018 10:00:07 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 13 Aug 2018 05:00:05 -0500 From: Huang Rui To: , Subject: [PATCH v3 5/5] drm/amdgpu: move PD/PT bos on LRU again Date: Mon, 13 Aug 2018 17:58:51 +0800 Message-ID: <1534154331-11810-6-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534154331-11810-1-git-send-email-ray.huang@amd.com> References: <1534154331-11810-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)(396003)(136003)(2980300002)(428003)(199004)(189003)(81156014)(76176011)(6666003)(356003)(2906002)(106466001)(53416004)(105586002)(8676002)(14444005)(8936002)(97736004)(81166006)(68736007)(336012)(4326008)(450100002)(47776003)(426003)(50466002)(48376002)(186003)(77096007)(26005)(7696005)(11346002)(51416003)(316002)(50226002)(110136005)(53936002)(16586007)(72206003)(486006)(86362001)(305945005)(126002)(2616005)(478600001)(5660300001)(104016004)(446003)(476003)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0249; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT041; 1:0dHYkq3ZDZcdqQkW+VNNBUIDz+F7QKkzHQogBQR7pZkN1ZvdlUVaYKybtiAMIksgwq+Vj4Y2OEFnevegptsHv3BzY/rSjG5RyfD9RV6MYtl3ZRFlLEmi7OtFtNhZCVoT X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f894d603-cbd5-4c3e-522a-08d601038c89 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0249; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0249; 3:UrtP05gEoTWw/zrXM6KR2XfCQKPVzGIl7nV+1DqNZ2X36GorHz6+52asLL27uInaQrTnrYKE277GmIo51yqSK8kX9ANnZl3wAFgVpOBXtdjqkvuk+TeuDrwFbgHEgE5ZNUNRpW+C1UljPDRK5cp4c8SYnFEWDfACpEHd6F0+lIBRdNoNDrbjxxBabcOwdZQ2DiL8m3y6j1wquVCkJ5wKMLxzNGCWHJf2ysBVvVzh1cRI66J0XVgJJRQ8lZVZ9e4txx41ndcUcNv/HQwp/zFPY80nywFoUy9ThobNxn9ETgTxoIrGu2FYmp9YB+mllqBMfxU/k0eOYFht5KOZWj/SEvNrxtUUcZbfvvfX8pwFA5c=; 25:C5oAebROjW1x9tgOOyUucr6nbeLhYu6uWIHu/HO840L1ANasxH7mk45IPDjN7CS7OEPleq0JNXU0qHJGqNIrO3PI9CINaxXo16WQUOf50DSveV/rztNdMTucarj0stSjf69fBuMRIevV7ZM2KHv0w7iKhBHB+ci7TmzaqArVcrXBBBC9zUQi6Ay6nth13gxUd7t/p3ACrjbrE6MKOJYj110in9Ie5UpM2t+dxyXyyqOXgPxWlSTIITnKQGeFem9qJrowPbMaq3NDmpX7wHr1VUkc5WJT8tdLJLs8p/CP3td0i2NRuj21UYrfEXplu2kyWwoteG+gnePUKVod5Z9YpP6Mqm13xiuJjt/hy+tgSqY= X-MS-TrafficTypeDiagnostic: DM2PR12MB0249: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0249; 31:cDkM3c2Vo8jUPSlj8MHYE/HLB2yAowsSKzJXhW+MKaKacsdOB3Heco9fN0v8HQCnf2GFp+8XtCNZwpNY2e55RyW/1TM/3FXhZkh/pUa3mEnj9Rywdr9vxD+wYJxsxpMvmUinaKj7vlRVd8JIY6qQDnzJ7Zcgsh42/Ha/FQTQtACb6Vn9UeG3LjGBiNlvra4uK5sgbGc/Oi/Sut3azUS0N7s1Ooyu8+hz0R6R0KcBVq8=; 20:qF/wQPRIMqWYsHslq4WvpbVSWdTpSTx6kNbmfpjT6WRKIky9t+fP2wPR2h3dI4SX666dsE7PxpJ+QGA5hNpAD9ztRXgul6M9fhrz9yvgffCi1m/0qCzIXsEt31t/ZTqai3ZOQ49sK5gLIz6Aku/eOb9Gu2iIlQRkmiqzierbvCmQgfVh1Gs5p3s9XJob0tkROPpAxXAdYw6oKbL7EKcdyfAmWIeBOGMcwI/adZw8G90ll92q3NDr07FZBDyOil+PKCYTd9suXE/Ymvx1W3A42jOn68yMOHozVrgiCAfv6MpLgcOe1NTPDgOQBfLWVMSb1FcUSBFv0I8ahlzHZALH4pIy2AH7gwTRBP//VTMkUz5FhXeH+3FpSc2gSjLpmD6RlYELXpmsACmnMtvSQNJCWEoAvbS7Nd3FBYmBfgSczfZVqcJAObUUJZMg3UuROY9oZ+67UZAAK91yr56MpJcivXLvgJKcFTvy0XubUHNQbtwmtCv6F+/w6YPC8P9MbSvy 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)(3231311)(944501410)(52105095)(93006095)(93003095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM2PR12MB0249; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0249; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0249; 4:BZlHWiTosZRaITdJquRVJtgCY6u3niaBNauKDO9RishwKz3UCuP8/Fsac+fjYPr+C6gbZbna0PBOYc/0RjHfNTzUz1xrWz6a2xBO7s0BWTnsHk7VpydNFqqi3NY5ERHsKGjg/F7KA56LLZh7WXlKitLCi1DzNRmW9HtP/If6cVL1gJDdDRPyG7WDHdKx+nwwYVAP/HWZhfbJakGMD7d9dGopNgrOj7OuE2mAesxtbgTnvBrt/yhSMCIj3FE84Hq/mbM6avHvUzzdXCJ+kDLInZabwRB214zQm2GrOWLmuoVDU8yfVYp297oc4NYeDbgs X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0249; 23:cncH5gTyj21WISyEQDfd4gLnoH8wGok95jjwVJfPF?= EG/wX02Bi0dtzb284aH0IjcZiwDv4uE1Sgi2/RWMWzIICQIwNaEtjzB1rvGpp0KlyPTuKXDPF6ZnPxITuBjnn//1xZ7iRqSzOrYWVkDHKT0Fif+NHc1ECupUe+S1oHcZx0FufkT2oDuvOSa0zg14EysyiScGGtVqiEaBq5n3i5+KFajFQLTpf9lIuIIio95VCI0JB/vLLYeGhj5e83gDT+wdz6k6kUEF3LJoQ4eQ7dwnRw1SDdDzrmuxEByTaEx4XIZdfGAyUrqcubefppzU/C7pIdD3oksGf8OAoh/wdLdGrnrt/m+k+gfXljeK24GDmcsZsFPmEOqlNxW1vz5YQCrRE3eSzOkH412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nosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0249; 20:G3DW62QeWQ7oqzrTtKa/kuG9zmmgfMDaL1uROT2kbva8xMU+c2OOFBMRQnI83v3XuvxKH5jQBZPC21hHxYIT/BFpey32kT/zNYR2wHqe4lKyGyjIp+8CgiJOerCBiMe78Iu32wfxHoe9JL5i5VQCCOLwqjRjj9ZIkoVUHFzJq7y0Mk2/pavO0qlQIG9eLvzPVMhT+QOKKHlLDxWOp5FPUo7oOcmCgrIaCmMwlDT4uaKoTojgDRzJ7LrCGKhkalOT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 10:00:07.0249 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f894d603-cbd5-4c3e-522a-08d601038c89 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0249 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 Tested-by: Mike Lothian --- 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 ee1af53..872ae5b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1125,7 +1125,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)