From patchwork Wed Aug 8 09:59:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10559717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C48313AC for ; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68B482A95A for ; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4B12A9B7; Wed, 8 Aug 2018 10:01:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF2602A95A for ; Wed, 8 Aug 2018 10:01:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33F116E509; Wed, 8 Aug 2018 10:01:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0087.outbound.protection.outlook.com [104.47.33.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id E123D6E506; Wed, 8 Aug 2018 10:01:04 +0000 (UTC) Received: from SN1PR12CA0010.namprd12.prod.outlook.com (2a01:111:e400:5174::20) by BY2PR12MB0242.namprd12.prod.outlook.com (2a01:111:e400:585d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 10:01:02 +0000 Received: from CO1NAM03FT056.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by SN1PR12CA0010.outlook.office365.com (2a01:111:e400:5174::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.21 via Frontend Transport; Wed, 8 Aug 2018 10:01:01 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT056.mail.protection.outlook.com (10.152.81.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Wed, 8 Aug 2018 10:01:01 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 8 Aug 2018 05:00:59 -0500 From: Huang Rui To: , Subject: [PATCH 4/5] drm/amdgpu: use bulk moves for efficient VM LRU handling Date: Wed, 8 Aug 2018 17:59:36 +0800 Message-ID: <1533722377-27020-5-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533722377-27020-1-git-send-email-ray.huang@amd.com> References: <1533722377-27020-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(136003)(396003)(2980300002)(428003)(189003)(199004)(478600001)(446003)(72206003)(104016004)(97736004)(106466001)(105586002)(426003)(110136005)(336012)(11346002)(47776003)(575784001)(14444005)(86362001)(53416004)(316002)(77096007)(476003)(81166006)(2616005)(186003)(356003)(2906002)(305945005)(8676002)(81156014)(54906003)(561944003)(486006)(36756003)(2870700001)(53936002)(5820100001)(50226002)(4326008)(450100002)(76176011)(23676004)(8936002)(68736007)(50466002)(7696005)(5660300001)(6666003)(126002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0242; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT056; 1:D+VKqBOTbxQuCS02Wj01XN2CmEmYRGK7YptBgjgDqOqBjska0ZnWkfCQFpKOCoGJM1SaqVxPQqkJMLxV52MyAbbZe9JGYpQDF7BnTo8yQStyFowZmuoAFkQkQZgRGWZK X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac0dc37f-8923-47c3-157a-08d5fd15d8bc X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060); SRVR:BY2PR12MB0242; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 3:zjOsOYKDRsE0XNNMF4nUemY5XrHOXG1PHjHxkgwqRvdWFBRd9mikAeNRps4N93Zg86Kav2E5NxvbkG05sOVlwZNrKc+zgSXsDJ52GlBFHPJUch1fGK3pRPOQOnl0GDDwrPjpWfnosXsacdGAfrb1fSU1C3n1oxRI0P5cS+/8z0RmISdNDuoILyWioFFm3KnT9r840WeKNTiOKxlItXHfb75zGXqcC9IHZAVlEA0PWH/BTNSCFpGBvvlEerbuZrPz1CthHbYJHrGbDaNee76om6tUfBgXc1labyteAEgNWXbysxRSoJOz6diI6mExy8pYIKyK3nTXrTPPUh1X3jzIIUGTLvkcRx+amSuUfAvjQmg=; 25:9WLBE4nIrN8T80XixFchoF7xlTGFqMQTNMYMduJ0lepG2kMp6E+h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4X/7sKDdrbNXPEH1jeYKq0dZprCUcpK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:BY2PR12MB0242; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0242; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 4:pVa8h8akFPWsXSV0yRquyMVy7Damfx8h8jwPzrb3cvbC8sa1Q+NX9h0xDWLYyNn2yBfnSJwtYqYowgkTuK4W656JVpNMtsJogpgtLin/k7fxO0YXhTLG9mdFIbXJAuZ9tjtMF2R42Ezf7+X7/eA64+wwSO7d09MacCXosPH6/ExVZ+Fex63UgsSNdamQsaXnhSVmp+NCzyOfSL4nw34R+fCXE8OsAEH83Mgik34P5Ha1nps4ZlUgLldJJkW2aWGonWFaz+TlYiatZGv1gM3z9ejb9EJ3IjfnK0bJE0jzaxRXH7YCuHg0wMOqmxt4AYWa X-Forefront-PRVS: 07584EDBCD X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBY2PR12MB0242=3B23=3ATNv3hBW?= =?utf-8?q?de/ZM7ayvGFFAf6baX9xNYZPybTOTwEFvrxI6UKo/gFAdkgO9/xTrDuEPosLZO0Md?= =?utf-8?q?83xNQcY8BrzYje6uG6iHIEMfGREhY3/WdrN/drTRGlD9BP7RrbAlU5CUBVw9EFKD9?= =?utf-8?q?okb2sP+JjlaOfWnT9eJ3FLxPbOVH0JGwD75JCFt7xqWENgk4ZkvGp2t0WGDp2LoLX?= =?utf-8?q?E+MD3bSwFvK8Zlc3KpwJqpaUV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VPSbZjGzcVWLRAP6zoe4U7tBWq/w9C1DeUxulC0jN/+bP2rv/BGXbVF0VsevdXqIsgjabKWZalEzYyXgYkglRO+cfKJxZejJOG+QUsQE8VgjWZt2+8HbfLX0QQuEhNrMqWjB73HKADuXh4hzj6gpA=; 7:V0ETYXFeC1eOsZ/6hTIOJWa3ojKLKeXPY+4o42A8LtaNjXSSqkhSjpBflYqoHc6Z02Na4/4xCwPQswDt0p0I6pK8E50I1FBiAK7wNzdgpxAehv3I9gyQPMoSBavyQWbTDSXWrD6+teJwKb3XXLywg5RraW3RLuwcsKB7CCMrAiYDFPF4qtGlWIdBVCEfXmqL17HocxeDMOBU0oD2edqIndRS+GYWHVVJbAkBvoTEJOi2cFA7k4zYyHrp8hmN0TJC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0242; 20:LJvduC2My9jFu53tqC8XdJ9Fy9qBd7oYYMuvVmzIsLMwou7nX5eIIhMfR3YHtpBFxkq0FcGsxjdwFn5Czlh06CbKBykpsOddMiH4aogcQz0jfn1uVvNH3U9aMVT+oWwBOEh46ps8gA49KjDp2TGfPqfFqcdoAL7YN6+kMQUepVlZqxoinUmpq+DzrzlAD9WlvSgYhldTReKHVG44yfMhemr2kt8zi4YyA01yfXK8Z/zsDCbf3efPkjvnq5BS7JmD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 10:01:01.2951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac0dc37f-8923-47c3-157a-08d5fd15d8bc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0242 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I continue to work for bulk moving that based on the proposal by Christian. Background: amdgpu driver will move all PD/PT and PerVM BOs into idle list. Then move all of them on the end of LRU list one by one. Thus, that cause so many BOs moved to the end of the LRU, and impact performance seriously. Then Christian provided a workaround to not move PD/PT BOs on LRU with below patch: "drm/amdgpu: band aid validating VM PTs" Commit 0bbf32026cf5ba41e9922b30e26e1bed1ecd38ae However, the final solution should bulk move all PD/PT and PerVM BOs on the LRU instead of one by one. Whenever amdgpu_vm_validate_pt_bos() is called and we have BOs which need to be validated we move all BOs together to the end of the LRU without dropping the lock for the LRU. While doing so we note the beginning and end of this block in the LRU list. Now when amdgpu_vm_validate_pt_bos() is called and we don't have anything to do, we don't move every BO one by one, but instead cut the LRU list into pieces so that we bulk move everything to the end in just one operation. Test data: +--------------+-----------------+-----------+---------------------------------------+ | |The Talos |Clpeak(OCL)|BusSpeedReadback(OCL) | | |Principle(Vulkan)| | | +------------------------------------------------------------------------------------+ | | | |0.319 ms(1k) 0.314 ms(2K) 0.308 ms(4K) | | Original | 147.7 FPS | 76.86 us |0.307 ms(8K) 0.310 ms(16K) | +------------------------------------------------------------------------------------+ | Orignial + WA| | |0.254 ms(1K) 0.241 ms(2K) | |(don't move | 162.1 FPS | 42.15 us |0.230 ms(4K) 0.223 ms(8K) 0.204 ms(16K)| |PT BOs on LRU)| | | | +------------------------------------------------------------------------------------+ | Bulk move | 163.1 FPS | 40.52 us |0.244 ms(1K) 0.252 ms(2K) 0.213 ms(4K) | | | | |0.214 ms(8K) 0.225 ms(16K) | +--------------+-----------------+-----------+---------------------------------------+ After test them with above three benchmarks include vulkan and opencl. We can see the visible improvement than original, and even better than original with workaround. Signed-off-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 9c84770..eda0bb9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -286,6 +286,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, { struct ttm_bo_global *glob = adev->mman.bdev.glob; struct amdgpu_vm_bo_base *bo_base, *tmp; + bool validated = false; int r = 0; list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) { @@ -295,14 +296,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, r = validate(param, bo); if (r) break; - - spin_lock(&glob->lru_lock); - ttm_bo_move_to_lru_tail(&bo->tbo, NULL); - if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); - spin_unlock(&glob->lru_lock); } + validated = true; if (bo->tbo.type != ttm_bo_type_kernel) { spin_lock(&vm->moved_lock); list_move(&bo_base->vm_status, &vm->moved); @@ -312,6 +308,15 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, } } + if (!validated) { + spin_lock(&glob->lru_lock); + ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); + spin_unlock(&glob->lru_lock); + return 0; + } + + memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); + spin_lock(&glob->lru_lock); list_for_each_entry(bo_base, &vm->idle, vm_status) { struct amdgpu_bo *bo = bo_base->bo; @@ -319,9 +324,10 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, if (!bo->parent) continue; - ttm_bo_move_to_lru_tail(&bo->tbo, NULL); + ttm_bo_move_to_lru_tail(&bo->tbo, &vm->lru_bulk_move); if (bo->shadow) - ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL); + ttm_bo_move_to_lru_tail(&bo->shadow->tbo, + &vm->lru_bulk_move); } spin_unlock(&glob->lru_lock); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 67a15d4..92725ac 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "amdgpu_sync.h" #include "amdgpu_ring.h" @@ -226,6 +227,9 @@ struct amdgpu_vm { /* Some basic info about the task */ struct amdgpu_task_info task_info; + + /* Store positions of group of BOs */ + struct ttm_lru_bulk_move lru_bulk_move; }; struct amdgpu_vm_manager {