From patchwork Thu Apr 12 10:09:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10338131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5B4760134 for ; Thu, 12 Apr 2018 10:11:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A031628767 for ; Thu, 12 Apr 2018 10:11:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93BFC28771; Thu, 12 Apr 2018 10:11:35 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 8A70428769 for ; Thu, 12 Apr 2018 10:11:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1678F6E0BF; Thu, 12 Apr 2018 10:11:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on060b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::60b]) by gabe.freedesktop.org (Postfix) with ESMTPS id B097B6E0BF; Thu, 12 Apr 2018 10:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EN6l1YxMfpVTLTqtl7BNe3mBUPU7x7phSru+YidhkCk=; b=TE8m2BhPLGto5O4xLMa4ZYcT4JOA62h1V4uMHUaNzsaVwyt35RRekboj9bcuU73aXAj8z3cLSvff+nYPCvp6ArwrGWP15LF8UVU0qPQ0f8TkHVl9GLwAPG0wMXvb6Z5DgHtLsQ1SzXfotRtTxTTOII1yFDfWv1c+XpVMSYqugpc= Received: from MWHPR12CA0071.namprd12.prod.outlook.com (2603:10b6:300:103::33) by BN4PR12MB0756.namprd12.prod.outlook.com (2a01:111:e400:59bc::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.675.9; Thu, 12 Apr 2018 10:11:29 +0000 Received: from CO1NAM03FT058.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::201) by MWHPR12CA0071.outlook.office365.com (2603:10b6:300:103::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.675.10 via Frontend Transport; Thu, 12 Apr 2018 10:11:29 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT058.mail.protection.outlook.com (10.152.81.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.8 via Frontend Transport; Thu, 12 Apr 2018 10:11:28 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.382.0; Thu, 12 Apr 2018 05:11:28 -0500 From: Chunming Zhou To: , Subject: [PATCH 05/11] drm/ttm: add per process lru Date: Thu, 12 Apr 2018 18:09:34 +0800 Message-ID: <20180412100940.25039-6-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180412100940.25039-1-david1.zhou@amd.com> References: <20180412100940.25039-1-david1.zhou@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)(39380400002)(376002)(39860400002)(396003)(346002)(2980300002)(428003)(189003)(199004)(106466001)(105586002)(336012)(450100002)(426003)(1076002)(11346002)(53416004)(2906002)(486006)(478600001)(446003)(2616005)(97736004)(126002)(59450400001)(72206003)(50466002)(4326008)(8936002)(48376002)(6666003)(7696005)(104016004)(5660300001)(68736007)(16586007)(110136005)(81156014)(476003)(51416003)(356003)(76176011)(81166006)(305945005)(8676002)(54906003)(47776003)(77096007)(186003)(50226002)(86362001)(53936002)(575784001)(26005)(36756003)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR12MB0756; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT058; 1:RL/OOChBxtY5IpTslmuLQ8sVAH3rURCsPzzZb0WYnDG9SQ+ElPIPojei8iW70JHCG3X6vy7HvYvgirXkdn6pqVqNjGfTTorIC3Kzx7Ikd8/GhKxyoXKjoRk91OdhBgYE X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060); SRVR:BN4PR12MB0756; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0756; 3:m5K0hQlVDULO+v16lW8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KG5BIblGPz8vaS+zL3kMpNuVYR0aGjga7EJW7sK2zhXDpV34/avRzEVrBo853wKOsR3stQVkV9a2jyBk7DHMQiOQxUXfKW7+AuxUTmaD+ED6MM9sq0huDcg3sWo7z0Yuhbjwr0F4pNbuf7Sq5GbyapMiD3CYhRP7D3Q4kIK4ux9nuYN+49RNBRJ0LyAmjkX7GqqiVnfpmXJanTj+Lj7MCQpm2gNiEuJglOCcxfF8RrLOM/dBkBNSaMMRFOTAR9MVxMv9mgzQKM8Ew+jDKDPuMZc8D7r8lYv2js1t+LokRVV9le7vycmmWPoO2azXMFR+6v8nCvqUkZSBWUtElvOiqGTO2Z7CFNc+9o5rGkBmVqfb+mmfVi7N/wrjUcgQoEOpMcirsam74Lr01BHRwZfRzX5CUptIDTW4S9FzYJYij6WXRD8LO50MEE7s9jOJlQjrH0M4ZKmds9xU2E+veEtk94DR7Rbk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:BN4PR12MB0756; BCL:0; PCL:0; RULEID:; SRVR:BN4PR12MB0756; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0756; 4:QoMlhcW+KWHdrmgBUhIHnUM5Uw0EGNmG+rBnGI7kJDm2cYQl51nUDR6CZJW58UTXlBeeU+vKUSFsSKph9h4Y6TCaR5C+0K1fES6JQNnqroaq7620Ow4mzJUqD8Lyu7oRXoAkAXBZiAGhorFTxLTqf4Eq2znJ94BsPz3e4Ki7tf4Ej341AZqmnSWW9HPFUmfjJVJ/KvhY6Xs0DhDjKqeuPWsN4O6xSkVV7afoI+ioBqUTKEQD+egf0zm2R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jOhInCtlxXgqt4yvvs65SNohsiXfS8TeEDlHUibs9sg9Uv/xmzpunIy5Z/b5nkx1C7DUPPYOP232gYKCjLqpCJSYSaLzql4c9r0hk88wwvNaw05lKUE5NCYP/Lt+b4eziD4A7kZeNVzVl0a1m/R1aaKtbmwyLlcuHaj1qSYctpXJ1nNxxWq1bVjvvsfRLdSj4cikuP5dGF2qkYW1QG6Q6juZA2MxO4LuKAoonY/IZ3Z5/R/KM7MJtGNTgvUhqRkC+OPemM5oxDuoQs0xqePhILOibXXUaXtkIWhYxsO0QUdITmmMg==; 5:gcQrhungxj9BWUyZtlW3386tb0BjjTq0XiCKBxGCJPjFjMoUwnj4IGE81j+Sad1Gu5cRsC08igkjrU2WaV7I93K9pmCg/kZkT7yvYcLenfPJfRBWQqtN3G06gpwMgBEpZsrhIzdFFMDLU5A8sHej7lFRAyxtRMJOOdQjAClsz+Q=; 24:YO7ZFZjGNIgux3/MJuU4xeA7m9K3Awv5qgLKlZP7GnPOmO85XtcYtnhykGfPwzzvH8+Do1WjxvjwKkEKYICUutFBauA5zJTsdPJDb++axrU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0756; 7:vJXlMWqNg4OpclZ8SNufFiOvcLLgphbx111r9hCeTUwBN2Pl/LOx+ii8dkjeC9bcUE5uokl5fsmJbtdEseFOVE+DnJgw+PpYqTchIMISMGSN1oDggAFzGGmhNIRVKmOnsL88Ft2d7FCJ0+lhaDOT1gITkTbmPSwfPugpIExnjwCRJREOfOsH0PumwAgxebNYVCF1QwpDFnP+TPafufht53r9QXKcQde1mVe+4SeRANu4MQoAIWqj5rOu2VcibEks; 20:pDA+/lgVblLJW0Y0uk9py4PJI4fBdAQ/OiZ0yuE2KW5ZmBGH2OReElnyIumit7zmRbpSbvhsHDZS4KxIM+cyuo1ltwCOiaoNPVUn+2BTfYkRu+8WM375osTOtzjghbDBKA54gx49UjDHIENb2HYEX89FO96hueqHiA0wwnH3C0C9dGuJcNl1h1I1gPsYHNWFVwxEMBySbn+yWNxfd86kPiqJQjdzFTSi5NUOB5D8IYv02bp3/5M9Gyg4KMaEXi/v X-MS-Office365-Filtering-Correlation-Id: cc18801e-9700-44a3-03ba-08d5a05dc203 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2018 10:11:28.8281 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc18801e-9700-44a3-03ba-08d5a05dc203 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: BN4PR12MB0756 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: Kai.Guo@amd.com, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: Id2333f69119222a7e9bdb0357bbed97cf08636da Signed-off-by: Chunming Zhou --- drivers/gpu/drm/ttm/ttm_bo.c | 59 ++++++++++++++++++++++++++++++++++------- include/drm/ttm/ttm_bo_driver.h | 3 ++- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index b740d8f390ca..c1d0ec1238c6 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -161,15 +161,20 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) { struct ttm_bo_device *bdev = bo->bdev; struct ttm_mem_type_manager *man; + struct ttm_process *ttm_process = bo->process; reservation_object_assert_held(bo->resv); if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { BUG_ON(!list_empty(&bo->lru)); - man = &bdev->man[bo->mem.mem_type]; - list_add_tail(&bo->lru, &man->lru[bo->priority]); kref_get(&bo->list_kref); + if (bo->resv == ttm_process->resv) + list_add_tail(&bo->lru, + &ttm_process->fixed_lru[bo->mem.mem_type][bo->priority]); + else + list_add_tail(&bo->lru, + &ttm_process->dynamic_lru[bo->mem.mem_type][bo->priority]); if (bo->ttm && !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) { @@ -712,13 +717,35 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, struct ttm_bo_global *glob = bdev->glob; struct ttm_mem_type_manager *man = &bdev->man[mem_type]; struct ttm_buffer_object *bo = NULL; + struct ttm_process *process; bool locked = false; unsigned i; int ret; spin_lock(&glob->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { - list_for_each_entry(bo, &man->lru[i], lru) { + list_for_each_entry(process, &bdev->process_list, process_list) { + list_for_each_entry(bo, &process->dynamic_lru[mem_type][i], lru) { + if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked)) + continue; + + if (place && !bdev->driver->eviction_valuable(bo, + place)) { + if (locked) + reservation_object_unlock(bo->resv); + continue; + } + break; + } + /* If the inner loop terminated early, we have our candidate */ + if (&bo->lru != &process->dynamic_lru[mem_type][i]) + break; + bo = NULL; + list_for_each_entry(bo, &process->fixed_lru[mem_type][i], lru) { + if (!bo) + continue; + if (&bo->lru == &process->fixed_lru[mem_type][i]) + break; if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked)) continue; @@ -732,11 +759,14 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, } /* If the inner loop terminated early, we have our candidate */ - if (&bo->lru != &man->lru[i]) + if (&bo->lru != &process->fixed_lru[mem_type][i]) break; bo = NULL; } + if (bo) + break; + } if (!bo) { spin_unlock(&glob->lru_lock); @@ -1318,13 +1348,13 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev, spin_lock(&glob->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { - while (!list_empty(&man->lru[i])) { + //while (!list_empty(&man->lru[i])) { spin_unlock(&glob->lru_lock); ret = ttm_mem_evict_first(bdev, mem_type, NULL, &ctx); if (ret) return ret; spin_lock(&glob->lru_lock); - } + //} } spin_unlock(&glob->lru_lock); @@ -1427,9 +1457,10 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, man->has_type = true; man->use_type = true; man->size = p_size; - +/* for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) INIT_LIST_HEAD(&man->lru[i]); +*/ man->move = NULL; return 0; @@ -1518,13 +1549,13 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) if (ttm_bo_delayed_delete(bdev, true)) pr_debug("Delayed destroy list was clean\n"); - +/* spin_lock(&glob->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) if (list_empty(&bdev->man[0].lru[0])) pr_debug("Swap list %d was clean\n", i); spin_unlock(&glob->lru_lock); - +*/ drm_vma_offset_manager_destroy(&bdev->vma_manager); return ret; @@ -1591,6 +1622,16 @@ int ttm_process_init(struct ttm_process *process, struct ttm_bo_device *bdev, return 0; } EXPORT_SYMBOL(ttm_process_init); +int ttm_process_fini(struct ttm_process *process, struct ttm_bo_device *bdev) +{ + spin_lock(&bdev->glob->lru_lock); + list_del(&process->process_list); + spin_unlock(&bdev->glob->lru_lock); + + return 0; +} +EXPORT_SYMBOL(ttm_process_fini); + /* * buffer object vm functions. diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 91120923de81..b6aa7fc5bf14 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -199,7 +199,7 @@ struct ttm_mem_type_manager { * Protected by the global->lru_lock. */ - struct list_head lru[TTM_MAX_BO_PRIORITY]; +// struct list_head lru[TTM_MAX_BO_PRIORITY]; /* * Protected by @move_lock. @@ -585,6 +585,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, struct ttm_bo_global *glob, int ttm_process_init(struct ttm_process *process, struct ttm_bo_device *bdev, struct reservation_object *resv); +int ttm_process_fini(struct ttm_process *process, struct ttm_bo_device *bdev); /** * ttm_bo_unmap_virtual *