From patchwork Fri Aug 10 11:55:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10562643 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 4B6E814C0 for ; Fri, 10 Aug 2018 11:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D0532B9C2 for ; Fri, 10 Aug 2018 11:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 312902B9C6; Fri, 10 Aug 2018 11:56:44 +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 DC1C52B9C2 for ; Fri, 10 Aug 2018 11:56:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D4F216E8B5; Fri, 10 Aug 2018 11:56:42 +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-cys01nam02on0087.outbound.protection.outlook.com [104.47.37.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id C11FA6E855; Fri, 10 Aug 2018 11:56:41 +0000 (UTC) Received: from DM3PR12CA0072.namprd12.prod.outlook.com (2603:10b6:0:57::16) by DM2PR12MB0251.namprd12.prod.outlook.com (2a01:111:e400:50d1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 11:56:39 +0000 Received: from DM3NAM03FT023.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) 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; Fri, 10 Aug 2018 11:56:39 +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 DM3NAM03FT023.mail.protection.outlook.com (10.152.82.205) 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; Fri, 10 Aug 2018 11:56:38 +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; Fri, 10 Aug 2018 06:56:36 -0500 From: Huang Rui To: , Subject: [PATCH v2 1/5] drm/ttm: add helper structures for bulk moves on lru list Date: Fri, 10 Aug 2018 19:55:55 +0800 Message-ID: <1533902159-14232-2-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533902159-14232-1-git-send-email-ray.huang@amd.com> References: <1533902159-14232-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)(39860400002)(136003)(376002)(396003)(346002)(2980300002)(428003)(189003)(199004)(336012)(486006)(72206003)(426003)(476003)(2616005)(81156014)(8676002)(106466001)(11346002)(4326008)(81166006)(450100002)(305945005)(356003)(126002)(47776003)(2870700001)(446003)(2906002)(5820100001)(76176011)(478600001)(53416004)(105586002)(86362001)(36756003)(7696005)(5660300001)(23676004)(50226002)(6666003)(68736007)(8936002)(50466002)(26005)(110136005)(54906003)(77096007)(97736004)(316002)(186003)(53936002)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0251; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT023; 1:eZQ/JdMLluXopbeOnPsAvxTVVI5G9V5LL+sOPPVjAjaumrvvEmJOFWQ0ljpWbNjRdHhF8EbV48RrNkwXTf8bWD3w5+IPB2cakQ+5DV8Gk39/ybEbnSS7SiErY4zrovpr X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd9e4801-5b6b-4fc1-6727-08d5feb8548a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0251; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 3:x/etb/iuCxcfbxqE/kHEcVxGxxmUkp8XnCR+qxU3S5en14RxTpul/gDBORgflpXgrvzwewQLpQKEsf7OCsU3mbVrcIXZZWvLKwKBCly9ZOJQYN2CStZUjpTtuAhT+GPybnE03mXmcYF90Y+VMdGp15xAC3CGmmxPYENDwLukGneCiUmlS5we0MNZaoUOSnwcRRpaeMlTzsBDrJ8N6pUuABi9R6fSLWNc9Y2f+HftOtyBQN1VCfclogaJIJoUbhLOo/F93lSOeGfin7OCuOTosbSx+dOkQTD8QHm2OBuV1ILTS9pHmVOOVZHOOePuaWiFcn6wdUfjFM8dIAijjcHiJ/eNpNWGNdIrnFlMJXgRz1k=; 25:r52n9BFb+dgid14ABVRhDHSGTKEl7x0tX4tXk70kG/2R2c+5pHgvLq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UEEONOQe8gKYO1lVhNZJ8tRUTKYk+EaePtRI8j4dlR2uI8VhqInYLX 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:DM2PR12MB0251; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0251; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 4:cuzHz4kiJg3U8ezNI4id6I8rchkyxA5ALtghMcct4yLMytKDagwmk41WtrzI2xBVg3SeXb7XX5++sGDrjigTqW7/aW3foCij7Se4bso6i62f2CYhj/0PFpG6bAK8u1C9fT4lXeVbBL71aDcO3Ft6048fH7csmcUWLexMUvtzb8uNTYoyGvX1cC9xxuJF+GvILJxdgYY6Nja078iaImhHIMy1OEVeomqbjGbhU0l7myJ2ju3c9YHrRQDH74+TSJCVjw8PyjxnLwIeAHFoCGySp+vSDZ/oUvX/+JxjTqLTmR+FAaagfrRLAvNLRYZ34hq1 X-Forefront-PRVS: 07607ED19A X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM2PR12MB0251=3B23=3A8BKPo8F?= =?utf-8?q?n42Zvov59Gnrb2DToESr2XS0Cb2LCYOBI7Tt+Utg+AvxCzuxfuzQeTLy7jsvqRdVT?= =?utf-8?q?bQK3npuVpCqj5hryWD82VKJMWhF9LxdRDqwtRv68pc5CaYLNBjAl9t7zJS0kvpNEP?= =?utf-8?q?T8adpJ60CDiXGLYqgGLY7+tJu2unS2L+jfUG+Oh3Y3kOme6HtCgt9eq9La5LcUn5i?= =?utf-8?q?c3dL03ysKF2EU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M9HLQ3fj55MLu3X6wisveywj3E6T0vfsEsoaCoH07jd9nSaDForlExWPIgDwci6d8vfUJC9CmnQobs=; 7:sH8u2X2hizQEHNg+AhgTBnCmybSOyz1sMrtLEAbFA2ix0wA1jI5sZ8f/cw03dkbtt5bU13X+59BQwUPPdu2g3e4uaZD+NtM1ZlX1C0hXP8s3IvtPTSjAM1LpI+Bm7U+EwCFib3aKd2FM3axh9GBKPV7+FDogg3PrFgLEQOEPm66uZTJeAOUz9GuGKgzMSGflcJ0Tt2dbC6jDY6SKprLRa3RRQFokaITvoBwDfOZnunouCKAIBDCm1RmxCLaZ8mlV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 20:0AUtJrTepDMxMPPzk5qNumqR2GeqknMj8vGX2NoG2rff4jlwuQKr/na1/CjDxcKlW8EDcYEmWJZlx80EbhmvJYE56IJqQcY7lIaGsy3oZGi9I1eFthGBqyv54EPrmBD2Ufs4SOqD60rPs9/bu30AxbKyiCE/R0kTERe7/9iPOkTTgE+iBw7DDSshYMAJgrh4ZMaXZJB8JPW5LR3mz6Gvgy8TM1P+Klm/GVviIRnrjkaQ0Tf1uA/1On8rhjzCAUCF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 11:56:38.1087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd9e4801-5b6b-4fc1-6727-08d5feb8548a 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: DM2PR12MB0251 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 Fri Aug 10 11:55:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10562645 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 EFAEC13B4 for ; Fri, 10 Aug 2018 11:57:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0E4A2B9C6 for ; Fri, 10 Aug 2018 11:57:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D49182B9C2; Fri, 10 Aug 2018 11:57:20 +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 705F62B9C2 for ; Fri, 10 Aug 2018 11:57:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 725D16E897; Fri, 10 Aug 2018 11:57:19 +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-cys01nam02on0086.outbound.protection.outlook.com [104.47.37.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F9536E897; Fri, 10 Aug 2018 11:57:18 +0000 (UTC) Received: from BN6PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:405:4c::17) by DM2PR12MB0251.namprd12.prod.outlook.com (2a01:111:e400:50d1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 11:57:16 +0000 Received: from BY2NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::207) 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; Fri, 10 Aug 2018 11:57:15 +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 BY2NAM03FT006.mail.protection.outlook.com (10.152.84.100) 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; Fri, 10 Aug 2018 11:57:14 +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; Fri, 10 Aug 2018 06:57:11 -0500 From: Huang Rui To: , Subject: [PATCH v2 2/5] drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves Date: Fri, 10 Aug 2018 19:55:56 +0800 Message-ID: <1533902159-14232-3-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533902159-14232-1-git-send-email-ray.huang@amd.com> References: <1533902159-14232-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)(39860400002)(136003)(376002)(396003)(346002)(2980300002)(428003)(189003)(199004)(336012)(486006)(72206003)(426003)(476003)(2616005)(81156014)(8676002)(106466001)(11346002)(4326008)(81166006)(450100002)(305945005)(356003)(126002)(47776003)(2870700001)(446003)(2906002)(5820100001)(76176011)(478600001)(53416004)(105586002)(86362001)(36756003)(7696005)(5660300001)(23676004)(50226002)(6666003)(68736007)(14444005)(8936002)(50466002)(26005)(110136005)(54906003)(77096007)(97736004)(316002)(186003)(53936002)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0251; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT006; 1:F5UGgEUu+5OquDirkzXNpzbPaiBqUopQ0ib6CFoceehVzc7LOiEPY5kkov5ddihwJWA7bTyQRgkUxJqr+je/En3fHyVWEYfdcV4eTuAcZSra8BwlDLnCPlwoKU7G9itM X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8e94ce1-cc97-4c6e-58e9-08d5feb86a1b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0251; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 3:ejdXTlWyx5lnYtqMKG2mQBvyPUAjSyYMq81iQyvYXqivRBSicgl9lh79Qv0FANQ9VZl4GhvjCyDnxFzqOtzweyGBnJFNPoZ9aPL1AzFFv4G1M/i1P7M090yCeHhejvu883QXcIPL7ytOsJpdHO5fKgtPjYuqoBEd7hmOE/NyoPA+kPjOhOPXFgejDIX92Ot7cob98P0jKYnrGssasOv2DA55UwrG+lse7AHUUaR5VOCdGeISxkdBXYO8iFVH5s7GBtm1STsyWf5V4WZPnOuU6bX2Cl745XhSNc1t4diQGR3nAIt9u6Dcn94fhOih+xqeykqHD3D9vEeUpgus+Uui/tA3hyJNiVh4/mtFd/rgyYk=; 25:lTX0ICq9p2nFNysoQovAQxJ3OZrqVT8J1VEliwFVfYxWWweSxrbqDJbeoNmWmu3FBePvGsuP8RbyJ48QsGcRtGCQMI1sIDHXw7J/QgP5hTw44pJfputcr6+VRhMDTD+zEY3z6vLQkIDz6ZWx3d/KVefn1+4DtcwVt88AZl4/vD60FpzYoPtKVvqa3FIz8vOrVKhFblIOAy8kSeLay0YPCnDU4cXbDxv013qICn+I8E0a0B+nv+UY8tAzAGVGDwZikD03UXHkWmp3c6/rhH7vveicM0+iEkjBdHaH8ANGezaLOkKLmZjpt0dGupPWwuQ8bwCOfyI2XFPsecodKNchpklGUsC0pCpjLblP5IYlZak= X-MS-TrafficTypeDiagnostic: DM2PR12MB0251: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 31:yk3ImcjsDrPse2g3ekkUHpFYRgxUOtAQNCP/v3DYTwRT9FBjbqcnxUmecJOSxrLePcu1yBYf0T7FmXyhotC3VXlTapVI6QlEsttH5BdabLyq4NWpSA/RbM4kA3hIcVk0RZyZ4igVkaezOFN8bKIRdEodk6ALaMdtcaS6xP3suPBMwU40icVU6aYJkyJmW9F37DxTFFQTB94B9zdeDMcuxIxFVw9wu3DAicb5U8X14wo=; 20:8L5RACk2McQdbtcjTNvhv9XNtkN9eJMDJjt3qRfgpt3dP3rLhVtQ6wgtxR6oX5NhazHwz7s7zdG3saCXSSFiElmro+H2OveH1h36Ju7Zv3cXCCbwsSYAOagn9pnA+8xZ4kkamvd6MpeMDOjFoQL5F8X6Kqf33wmjoqyWBV5wezIwbvu6fNOK2EkO8rTogRMOwUNy5x5/Pn2qEXgU/f5vGZ3jCwYeV290Z6Yj28dN1JniQixs4Ce3xYroeUY6eg03+cgDKJQCVOS4ZZlC4JihWAO8l7uBrzDKf+67wlSqP4SmwPSdmm1ao66stugMuv3cuV20zIGr3DDxK4Ro8ZTpyP4WMro3ne6gs23+6G+kOQRxEfi4CmjvkC5iWjap7dawv31XL/kuoHgXOMlt+y2l4muJFqX8rmOwKxZJUK8puQL2J4FJ9Jpcd4IeslaShAKF6t3VEBW6kVJi8t8Io9ZchVAgxBjDWW5vQp/YLxzKCoyiSmVde+8sy3Nsup2ZOfJj 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:DM2PR12MB0251; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0251; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 4:W9OQ7rqh6b1WioEjr+rqsmnVt7pvQz8VBAedCIp4HoQhsAh8NHVbE8Iw+lKjABKpVAha2Gc0Y6F13cGmPC6p5s9rjkbBpTUrtOhbuo4+qMSLdYaiQ93xjsmqNYfgkRStz7yDTvQJe0Sm3RZVnc0mCHI188GVXVJeXMSFIMO+k/Bbsqap4phHTMjhAbmoeFFb6HdgrpiUNS7A6f/l3SPxqJZobwnfEyIK0f73/V5OMgiYkrUA5l9mBh7CHcUsT5GFc6AEYV9BZXmaPBAaS9XE9ObkRzhwnDnmi0EllVh1mc0N8gMkdkrRMezb06b2qt7+ X-Forefront-PRVS: 07607ED19A X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM2PR12MB0251=3B23=3A2mMV8ZN?= =?utf-8?q?33TjCt+tbi1ryjgTs2223CTscbMdro4QZmq9qhBiEHETyZD0+YS8CGPqHByGQ7OXp?= =?utf-8?q?CM6VGetav8W5xsDVVO8hv9nRveEnHS8KelBpfyCc7wMAN+9SwC4HfAVxVmM+GrEVw?= =?utf-8?q?yvHlc1i+qqabyh9iNNAqBeU93EiccPalaTUzO4cybGmPX++k8c4/5vJQZNOW4oHnI?= =?utf-8?q?54Wn6Enx3cOW9Wcr5MnwF7gKkiXBQVrnvRsjySyIg4ZKWbYpKESyPV870Pl3WAawL?= =?utf-8?q?Mx8E3YxG8zNoToh7p8MuvnUukWSYYFfkHmPYioHjFkBeJg9gcYZwiVMiITAHTTSVp?= =?utf-8?q?Z+bJmEqctS6eASy0Ow1pQTLWRyo760g0KVx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1f7rOcUPdIzt3EZtPzni2/DkZgjplMrX09cpZ4tUt3j4XwwNdEHghXA9kDrDGBZb8mhTQBv7evfKy4bS+oEgEhTUx5QSQqmMeKzjY0i6nw8EoNa/jJjtIAUlmYhP8cH6NtxAKuXvsihd9+VXa1Z1hF/eGxUYRMkzEAFNdJkU8LYihEJLM1XVA3w8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0251; 20:Tz2dwNPwNmSOgspjBanFTwclnpzy+/t20jDA+zBWE2f8kRBUoTrlJqCSCzdSpQQFpby3doEAudT2BgRIykKBu7WkIsQTE9rQfknvbplaOCCraAipiiP6kjndTrFYSbl51NsXzX69wiUUlK+6sI9sjvJxpzt+4qWHYLql58eU+MgKJbbbmbnHt0vi+S+oWp02BLl+PnO1xaW+2Nl/Wux547zKIAqMEdh2i9BTMUHZuAN8SMh78GLQCLRrvEJSNi1L X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 11:57:14.1501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8e94ce1-cc97-4c6e-58e9-08d5feb86a1b 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: DM2PR12MB0251 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 Fri Aug 10 11:55:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10562647 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 49A111390 for ; Fri, 10 Aug 2018 11:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BBA12B65B for ; Fri, 10 Aug 2018 11:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D18E2B657; Fri, 10 Aug 2018 11:57: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 B9D4E2B5BA for ; Fri, 10 Aug 2018 11:57:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6A906E8BE; Fri, 10 Aug 2018 11:57:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0079.outbound.protection.outlook.com [104.47.36.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77E9B6E855; Fri, 10 Aug 2018 11:57:52 +0000 (UTC) Received: from MWHPR12CA0050.namprd12.prod.outlook.com (2603:10b6:300:103::12) by CY4PR1201MB0120.namprd12.prod.outlook.com (2603:10b6:910:1c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Fri, 10 Aug 2018 11:57:50 +0000 Received: from BY2NAM03FT003.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by MWHPR12CA0050.outlook.office365.com (2603:10b6:300:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.22 via Frontend Transport; Fri, 10 Aug 2018 11:57:50 +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 BY2NAM03FT003.mail.protection.outlook.com (10.152.84.105) 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; Fri, 10 Aug 2018 11:57:48 +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; Fri, 10 Aug 2018 06:57:47 -0500 From: Huang Rui To: , Subject: [PATCH v2 3/5] drm/ttm: add bulk move function on LRU Date: Fri, 10 Aug 2018 19:55:57 +0800 Message-ID: <1533902159-14232-4-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533902159-14232-1-git-send-email-ray.huang@amd.com> References: <1533902159-14232-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)(39860400002)(396003)(346002)(136003)(376002)(2980300002)(428003)(189003)(199004)(450100002)(53936002)(14444005)(5660300001)(36756003)(4326008)(72206003)(2870700001)(86362001)(68736007)(356003)(478600001)(2906002)(81166006)(305945005)(81156014)(8676002)(53416004)(2616005)(486006)(476003)(126002)(50226002)(76176011)(446003)(105586002)(6666003)(11346002)(104016004)(426003)(23676004)(106466001)(7696005)(50466002)(54906003)(77096007)(336012)(110136005)(8936002)(186003)(316002)(97736004)(5820100001)(47776003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0120; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT003; 1:fmaJ0RjFE0wB85OeLtVeQons3V8ztzcLKOJVmwcjZKr87nZ8omX0eSGlRUILGyuMs15xKbF6cBVbPOAwAs5rMj2Tw1BmDSV7pzLg6la7ojOEbi5jBhILej87SY6LQ/PF X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b005d80c-a228-4a39-c847-08d5feb87ea2 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:CY4PR1201MB0120; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0120; 3:UvQOKpqRowzi0DbXahXCAnH2toCK5bgx+lrz+g4rGeug7zpIJiLRWh5/EdtM2fWE4Af57G8VcSDQ6n2/xccT3ZiGa29NHgPRtWJ2Yqnq2imhHJq4lxLu+As0gsBcin5McdNwp1WTKAhyZ+Hae2ecdgkGUFZzyhPKRs3Jhx+T6rjJjBHU3X3XZw7JB61TAyODbux40X1sKJS/baWR/voTztSpOy7/Q9MqMfOyIjaGKPxHoGMQF5VNVgWZgBr5/lr/8TGh7GqGjkSf0NfpnnfxxWuT1h803Nf6HwH/obwR7hcN3osMVFZvrqa6QyQ+p6ZETZEjqx8xwFB70/ziVryR8LOYs8tOcmHl24TUJG2Bc04=; 25:6+FTZ1ID5Y9xEGy8DJhdVPYjL6/+EzyPW2aj6H/y1BkxyMNzSXLZbk69Q914txvms2QnPFdb3oE6a18s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VFO 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)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY4PR1201MB0120; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB0120; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0120; 4:EdQvdh6GE+MubXVzmoioz4zzyw23A2ZZelSlfjQN5CFEf9dBVm1/TNf5OzY8BUQYEl6ezxnqm8dgZqokauLKSIH+qNnM/rAJCJp/A5RLu30GWcQK8GzqbigWYnivRoMnrLu9HfAwhDcTcxFqKheXHkoQpHWpj4nKwzOX0ECGiRazU2SVi7QNZwTKwk7ihhJwFPxo6+je3Qs6wGbwEw9zVmkIgaVCM32aCwmOhiPmJMcoyrbemTquep2bF6omSNdbXFQw9NK2oWyVxLrqpML9lLu6MaFdGWbCShAXfdgb8uUZk3fwdyvSufGJjRnFl0fY X-Forefront-PRVS: 07607ED19A X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY4PR1201MB0120=3B23=3AAiPKT?= =?utf-8?q?y7zgm9JQk4mKEiidgHU5pKRWbvMQMJqa4iy2VN8x3MFd2IMriUjeWKmacZjBZRHcH?= =?utf-8?q?spDkC+vM0+sgGK5zbmScZ6vF2o/VWS5IGhY6y4t0jmupjn7yLfK20S7AhERg0jTCI?= =?utf-8?q?UNR9e8Ed1WQU99g+lxeVfZw4h8covW9YlvOISk8o81Hqo1UYFdzDGVkok0Tzu2BVI?= =?utf-8?q?L8LZ/LI2RlNtDbumYm0sXLz3IYD/jzmgE7iA5iLNpb/GRo9iX9dIWwSY7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A20QBimcnLBvANfqBmXxlhHdkz69rFp4fU8UF9HUsXbssOwbuf8UHr818rF5AqcY=; 7:rkug3eDiK4tmo0Ve67Pw2eI3sX78H7hNzFg+gWcu5GwZVeTpsDTvymltxxEJx1xnT0IlYBx+gqufKayRWB0k5897F/K0XtGSkyxCNl5NivKMVfEpXjogfSqSc4HdTKc379rKdzrnE1NoiYOURMzV/8Y4a6+SFPBtEXesJIDPYaQeTUNXYy8h85Cv1tB0oM57WhszBvrsuRvDsXmRLqC+awh1qdOMyUs1U6RW0bZYzH7//Bc/UckrrurkK7YawviF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0120; 20:ohYzHiFg4DLtij/+UpaZsYTQJTlxTR3yKdYhKQSUVXXgEY2KlZ5r3rLmI8ndxUeYA4icHBZkIAbE92k/jk0VVQNaf/ok1jCIMs0raYP3dU9zSAPaxeLaMk1C+CqkTJdSY8oKYwPIOZMhQyIgfJChJthUME6RU3i1oJSZ/xvF3FwpI3Qo4YseAuyOdGSCiNhy4hQAmKRE7AHtc+EJfYpISqSe5D39JQvk8kel3O8suFpiFQBjmmq61cu/mQnNcSs/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 11:57:48.7015 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b005d80c-a228-4a39-c847-08d5feb87ea2 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: CY4PR1201MB0120 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 Fri Aug 10 11:55:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10562649 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 157EA13B4 for ; Fri, 10 Aug 2018 11:58:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05D612B672 for ; Fri, 10 Aug 2018 11:58:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED2D82B960; Fri, 10 Aug 2018 11:58:33 +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 6B5BD2B672 for ; Fri, 10 Aug 2018 11:58:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 165D96E87F; Fri, 10 Aug 2018 11:58:32 +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-dm3nam05on0601.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::601]) by gabe.freedesktop.org (Postfix) with ESMTPS id 518266E87F; Fri, 10 Aug 2018 11:58:30 +0000 (UTC) Received: from CY1PR12CA0079.namprd12.prod.outlook.com (2a01:111:e400:c42b::47) by DM2PR12MB0250.namprd12.prod.outlook.com (2a01:111:e400:50d1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.20; Fri, 10 Aug 2018 11:58:27 +0000 Received: from BY2NAM03FT035.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::208) by CY1PR12CA0079.outlook.office365.com (2a01:111:e400:c42b::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.22 via Frontend Transport; Fri, 10 Aug 2018 11:58:27 +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 BY2NAM03FT035.mail.protection.outlook.com (10.152.84.223) 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; Fri, 10 Aug 2018 11:58:25 +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; Fri, 10 Aug 2018 06:58:22 -0500 From: Huang Rui To: , Subject: [PATCH v2 4/5] drm/amdgpu: use bulk moves for efficient VM LRU handling (v2) Date: Fri, 10 Aug 2018 19:55:58 +0800 Message-ID: <1533902159-14232-5-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533902159-14232-1-git-send-email-ray.huang@amd.com> References: <1533902159-14232-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)(136003)(346002)(376002)(39860400002)(2980300002)(428003)(199004)(189003)(2870700001)(50226002)(86362001)(76176011)(23676004)(97736004)(4326008)(450100002)(47776003)(7696005)(2906002)(356003)(5820100001)(50466002)(6666003)(14444005)(305945005)(8936002)(36756003)(486006)(105586002)(110136005)(53936002)(53416004)(476003)(126002)(2616005)(478600001)(316002)(68736007)(11346002)(446003)(186003)(104016004)(5660300001)(54906003)(8676002)(81156014)(81166006)(336012)(106466001)(77096007)(26005)(72206003)(561944003)(426003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0250; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT035; 1:N0ByxhP99YVF6RW7uVBpbqrcZKVMI0ufoDQ6odfbTiKL8M6aZUdg17/ISlbnVNSTFaX8iXhxrK8oo97htXdZF44aFmWwwkIA2UFlzbLJWAvrqcYv50iVsNNm22AZrIch X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f713eec-02bf-4fd2-5880-08d5feb894d9 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0250; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0250; 3:62cgKOufA5k9feM8Sq043gRHV5PGIJupjxk8rOdVKdqh1N2O/93h/yX5vWwQClwGEuE4mt2DKGo2VA5qi3C8JxqrsfqTacU4hBydVt4JUc+9lmqyIl2dPATHDQGqriSNpSqzOmUCrAjdPO6ag6DoR6uFDNLYburBUg33V9zzQscqcRYGPBlb1QWio9A+avs64QKHYX4xJ5/ot53ghxWt/kxNRsgbiFQN6Slua6eG3WB2rUxYFjSeHWnSYQ731PQYzSXL7Xpb9xGoSTnjypmK2+rXd+5Q/aseZCLdR9k/KmQyqtxAnwBSNu1pMGAB0trlUHvNDAOUagYFaAw3b7P0txu0inb70LM9mOsqUkzT+yQ=; 25:f1jGDIu4CkPcg8W9bqHZBBNS18Btgh9Dc6M+hR6pHRMZ3zZ9bWdmp8pLAujtQjyVWAoV7M3TKuzlUURW4+YytzQYgCdlvTzDDhMVcUZ8rTPPRKXuo/EhxBsTgujlGTyPQBybjavMoz+4ZAKmOwmU6h9QtoGffLvD1Li3oJTQx2lSefruhnNdOl55l2ZcEC+mWsvCNEVzu5iT4S0RXe5PtWCZkX3fSokRbgzFHsA/D6G0sQ7Fne2W86A89ITJW8RRJjuihaqcrKG9xGD9e7Xvae83u4Bizmj633mOX8/90lJBtO5qNHS1SQrAy/nXK1izY9T+xe3zJabfa/OVYLt3hC9Cu3LNWZWi4as9w/+tW6w= X-MS-TrafficTypeDiagnostic: DM2PR12MB0250: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0250; 31:lD8dw9yhl7omiRqWIifqh9i8QWUVcqujR6cZNFjioFuuN9sPrJYBPFtpSL29NcuPiyMZz9MLfpGhvJ136o5eZXe3Hrrl6Q2WAeZLt4h+tHjel7gRPFWC/8tRPs4q+MuU3m0eaBzAbLkrGxAIFJm2fjZLeWTcC2qoPZUibkBJsbyYRPlrld7jzE86l8fl1MyvcZsbzy0yaMCZG9T+OobvfxFBODr/V5ty/an4/1eCWZo=; 20:IIeUeNclzP/dH2dr42eRTKCacZMRwJkP06iGGGXupgoLsnxA5+InvKDZMzWuAl6APaJyjJYndwEMso7M9i7n6ZVLqTHuAZ2Vi4+TxmZ0M/lxL2HpeiRCBdIKBu4MQ+lTvWW0pMm/qDJrhOIJ/yeqp9Bb8iA2QnkT5dzrCaOaiPNYLkKXP2oKzdy4kZ+n8p5iUcKqwo6oOC+YFvcxQ7KRthshFEg4F5gMtVnVhoBImzpTJBGuixqsJcezE4EhuDLbTLQyMXVagi/nN42zJJpeJUdTp22moiMD3SkN8FlrHOL86Yrk9WzPKSUt/vxC7EtAa9ot6Z2K+M3uFN9JEOU3gYby8bKSD7m4Pp9sZUnAJ8NhYFUmq1rThdHGMnWB/yGtrGvH+w89cJwQkM36VuhUC+prNcEcomiBsTo+o2mp83LZFOj0OED9xD9a8jOInGE+GrxN4R7C1udVSPTK7RGECUrkppOEsAmYrc1gchKlb0xppvlhmNfGwQTGCkb/YzPg 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)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM2PR12MB0250; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0250; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0250; 4:LFx7S1husRRHN5GogPxHnCfC1atalZRD3tGiOpW2NMwhMqHRC+dCh/BUhQjT2G9hzjxWXb4Ox9+Njpq/6ZmY4AWd954Eb/rgyeInMyXRtivwYUI8VVvmdacSc87aE27+CLJIJTV7rlxzohkh20VmeowV8J1wuR8oe0DhcSwAwAqtnBB9P3qjSBXO782g577ZipUy1bNVK/BBmxczA85gnYL2gI7ZExWtlUsC9LDk6AVGqPwpRF/2TpA3j0HNBu9DO2vEeEs82+Ev60GBBw1JAvX0G+dEx94Lc9RXv6Iki5IWYESHMpnv30UcticqNbeb X-Forefront-PRVS: 07607ED19A X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM2PR12MB0250=3B23=3AQqvI/Iu?= =?utf-8?q?jzkRylIXYX7hr8WzpQwQFHst/5z9DVm6U05TuDp0LgkJ++Nbw0z3AAY7wrqOQLBzW?= =?utf-8?q?0faxvd5B3OhZAHlsJYXZc8A8coHwQomzkKXXQPjph+ae3yZzxKVRa9x1KNOvwZ/+2?= =?utf-8?q?7BpY6JDpI23algR4uia/lpMAXMaPCh/MTD0sjMorztDcB/OmtlAbvn615itXrtKWf?= =?utf-8?q?ZJ0roQ9Yct8eqxFRv6NAFlwtsfEau5HU2QSXXg/vs0qorkgPN/fZg1BdEB5Ke9pfN?= =?utf-8?q?ve8FJAyzo+oJCD+rPv5vrPr1Iz0wgzt8ShEfiQ4AfJ8GEE1UJMggA1pSqFGo3aGNJ?= =?utf-8?q?GO891G759iTFDmOliQ7XrNGXJM7T2pgCBGTLCRdX+5my/o16mIjEVWf715KEkIHFA?= =?utf-8?q?rFlMwXgAn26jSyfqhDwYHQ6+eozBoABnmroZesOToOmXc1iyqESdxu9IsTJy8DZC0?= =?utf-8?q?bODs+x4EHLrXsO4WAecdJjr87B3+SInmZ9xXIhC9I81kOtCy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d+xs/vcum1nzM8x5e/e3SttnC3Dtd4AAUSsKTlcCc6lPTITg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0250; 20:RYuhDKYK8G3bsd8HOw9INOwffW8aIoQVyb/LsH25FcHXB1azBRtT2P6fKlRh2gYbZhuRavFq/IyUaKtU5MLv/11h1/tVCdW5doHOR+CrGBZRE/MlmucuOijTTrCvNlSi9CtObyC7IDmP3H6bU7waw6iW+P16EReibMP4Rc05DVbGPmIN+cl/2pHCTUjh9DahapRCyERkNiaqtA3304PgudR3WMC4d2rDLi4PY2ruggAEegXegXbH4AWNa6yusnUq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 11:58:25.9690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f713eec-02bf-4fd2-5880-08d5feb894d9 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: DM2PR12MB0250 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. Signed-off-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 75 ++++++++++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++ 2 files changed, 63 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..81fb1ac 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -268,6 +268,55 @@ 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 + * + * @adev: amdgpu device pointer + * @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_device *adev, + struct amdgpu_vm *vm, struct list_head *list) +{ + struct amdgpu_vm_bo_base *bo_base, *tmp; + + list_for_each_entry_safe(bo_base, tmp, 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(adev, vm, &vm->idle); + amdgpu_vm_move_to_lru_tail_by_list(adev, vm, &vm->relocated); + amdgpu_vm_move_to_lru_tail_by_list(adev, vm, &vm->moved); + spin_unlock(&glob->lru_lock); +} + +/** * amdgpu_vm_validate_pt_bos - validate the page table BOs * * @adev: amdgpu device pointer @@ -286,6 +335,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 +345,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 +357,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 Fri Aug 10 11:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10562651 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 D12E114C0 for ; Fri, 10 Aug 2018 11:59:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C25F62B672 for ; Fri, 10 Aug 2018 11:59:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B682E2B964; Fri, 10 Aug 2018 11:59:06 +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 E66BF2B674 for ; Fri, 10 Aug 2018 11:59:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D65996E905; Fri, 10 Aug 2018 11:59:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0068.outbound.protection.outlook.com [104.47.41.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 231806E904; Fri, 10 Aug 2018 11:59:02 +0000 (UTC) Received: from SN1PR12CA0022.namprd12.prod.outlook.com (2a01:111:e400:5174::32) by BN6PR1201MB0115.namprd12.prod.outlook.com (2603:10b6:405:55::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Fri, 10 Aug 2018 11:59:00 +0000 Received: from BY2NAM03FT030.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::201) by SN1PR12CA0022.outlook.office365.com (2a01:111:e400:5174::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.20 via Frontend Transport; Fri, 10 Aug 2018 11:58:59 +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 BY2NAM03FT030.mail.protection.outlook.com (10.152.84.214) 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; Fri, 10 Aug 2018 11:58:58 +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; Fri, 10 Aug 2018 06:58:56 -0500 From: Huang Rui To: , Subject: [PATCH v2 5/5] drm/amdgpu: move PD/PT bos on LRU again Date: Fri, 10 Aug 2018 19:55:59 +0800 Message-ID: <1533902159-14232-6-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533902159-14232-1-git-send-email-ray.huang@amd.com> References: <1533902159-14232-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)(396003)(346002)(136003)(39860400002)(2980300002)(428003)(199004)(189003)(486006)(105586002)(478600001)(72206003)(106466001)(53416004)(186003)(336012)(446003)(11346002)(14444005)(81166006)(86362001)(26005)(97736004)(53936002)(77096007)(36756003)(81156014)(51416003)(76176011)(7696005)(104016004)(8676002)(50226002)(4326008)(305945005)(450100002)(2906002)(8936002)(476003)(47776003)(68736007)(316002)(110136005)(16586007)(356003)(50466002)(2616005)(126002)(48376002)(426003)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0115; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT030; 1:ffPHWqx7+rezSDaSfYMpep4O+UsfnMIG8Tds0tAHUK79x/ZtGEWpni6GoTQFk8KEcatIgNIyjRIu6exai9SR+CdYjmNK1wfxkhjXiQry2WFE4QNWXgxM4Vq1mBhEGNEn X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a475bad8-cf75-489e-8f18-08d5feb8a82b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:BN6PR1201MB0115; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0115; 3:0l4DGA2hTScn1iDeAeLPPixNmbGhduEJEKYNrwhcYAkWew6IYVzaIC5dI+8S39ZZeKYljUTacOcoSBT/W3TmzHfE92Vppy2EzOKg7BTVbYr5Xan6oJbkxbRtzQ1YlHjUD/DJcERzvYgKBWj/GRWejanERmjrbfbi87NdNKI4y4Lv+oO6NYafz6/2UbihI9bIU/qkd71EDeu4QDbRGZVify5ilUE1ARTh1swzRRR4RpgOeiMZoTTSV35OgBeePJpDoReEX8gl1Z8q+9I8UCnGeuMmuierDUP8E0LG9ryc/fgS/krMR/X5MoT8nTCIEa38q1vUwHanBS953EdG8k0iwx71AtdHvHzp4cI4T8SN8o4=; 25:zO6UN18dNJubXefxKhG5SGJHKCguPN3i7kdwk7SqZpkl+jQ2iPL52HcZRRJVazi3WZ+SkQycoDvh11Cve7DA/DSC7esBCsUJIwT+NWYF+QpqWKIcpMYJsLplIpOuxlPrq81nv54StSEhyW5zpWmY+R9vctLNSQR4WjJFlDuw/GQ7D6YmB+mLW+Qgd2wUcW353qLnHY6P7nCWhTiZTmPUFaKbC59OsR69f39XQ1qPiSqOhaWJW8+nFxP5Xo2LN+XVJllOq5ay/v2kt2m5MOSC0MQ13QxRKyRO49JQnPuJUvCL6Y1ZJNWZYuo3C7CB/x0ZmLWmKoWq8zaEDJVK/1WPCA== X-MS-TrafficTypeDiagnostic: BN6PR1201MB0115: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0115; 31:DXobh2yOLTWOsRO3nLcILlrtOIpddVQGN/6zp5olHGxfPoXpCpavj4tqCoztoQZwggqD/l4de0OQKrMldanw1EWgkAxqGiPOV3GrhvKbeoxI5fwU80FF2uDIRamHQPuSWumYXOV/m4DTRlvnFNUf2+hnJ830tqlckpyX9OAHBlf9xKlbYXtNLn6OkAv8sAnCdEux/S1Yt9Bit2KNtyuZ+fe9I+qGXSmjCpXXY3Y70Wo=; 20:lHy6FyOhN4UJvjKR09hXZdWlv6HtFTMOtPFWM20ZJkGh6D+NE30v32Ke9UfZEALIvUqwq+FMtaFo5JPytqiBFk5o7aUbPDYqe2FYO+AFsK0wC8RF3zkAHtL41sY64GkadiEhbnJSy1iJmmH8m55aydYKNpdqFlOMYQ+GP0lyGn6Bn66ip2AbtHgVyU3UVOR1XTI2GfiIok4LHURrnGDveNHgyP568JEBdYhHbdU/yw9iGwXhc2LZFpNyELIlbDDjLblQ71ZNgJ+yb6h2H5by7uhc9wI/hGGwYns6gPdJGPjyPN4ykvXRwal8Vxchv0AZDRtK83KACNBFkPLuU7GLaF0q5N4p5V1Znwr4QLB2aXe9r5oyOqzSrnQoSDMSeE4nQJmsQyN8cxlHIE41ZLqa+tY7N8wQM7izfq7Wt9xVR+DR82yF2fhf5sxeXE7bfjl2EApqJmTMVduz+0WtPeiy0b2dehT5fPmOpkKk9B4G2eXgshz79zu3Fs4XEwymItkf 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)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:BN6PR1201MB0115; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB0115; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0115; 4:HHUltMiGK9xJqjN0/6nKzSwvq1tZt13xb03udH1Q/TJ9CuhLVm2sdMPcyx+loFmrJjSm4J07bOAaAQhtlqr0+d9Y/N2ZfNgmTB5MUKTbsJbEYZOJkV3SA1o99XVuTeYeehodqhGqypVdwB8RqCAwSLeVgOh/EtJfexEGeIKzeH5OIQSPD9bjBFcl+oATPkd2syuNKpTLGBWAqVLg81NHh3VnlJrdYvLbGZ+eCxVjTvtKj8l/QHDayDXPPeJZ4Yq8vwVUCuvPqgPtsa3hA33gK/y89x55OL7OLAiIwr3RfKGtsOvO3bVgcY1ZFEUBM1tS X-Forefront-PRVS: 07607ED19A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR1201MB0115; 23:J7FZSu9hh7I4BpJej7NZT8HLs6Jwun1gkUs78kt?= ZnheWB+cxOvXOSQZfPWVrENFkPdMPkh7Stk9K9qFQcgfo0QZDPUwxwas1n6RKm/yFWfQldxnX4ZiEkHbs2XoVdHeEmh2Lu/dyfi66yyTQjkxaXhndkefcFGxcMRSnA0cOWHIqAcTxwmTsm5dbq+kkd0kp7JBH3o927lb3VAHtS6CLEdNTHbYCJ37p7z8QIRoPInsyIl9UACSpj++uuSQHiNzMx7pyYXje2BPAB0Vv0Oty03X994N0Ot6vDRh+mjMRpV64QQGHn4UsnHg0rz2aJPIKQggiAwBGTiPBDqMz2VXxuxxYtQ8y6XIR0K5N+ckZnUtIh1zdiarWpRqsRNza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Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0115; 20:sAdJM5rx0EFUNAkObH2o6uee/mmuluzaqF8OOvVoOwAGTmYI+mFFuHgcOW2JuVFnVTskqvc+ulTQkVZiZUcEee5+Pi1fuWgBsDlOb5G+YEYIcLMzxathMV/Sjp754wEGW5QptIhlFDKBuuR/0pRHtCTqrs12WhZWk4FmYNIcL6OjUETnebWRiaLmQ5QIwXgUv7xeM453cK4sYjsDDuJFZIfc4IQuW2fM6/wTLp3bu8vU8UhIISUpk/71nKioychJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 11:58:58.3845 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a475bad8-cf75-489e-8f18-08d5feb8a82b 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: BN6PR1201MB0115 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 81fb1ac..9f44514 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1127,7 +1127,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)