From patchwork Wed Dec 13 05:17:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10109217 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 2EC40602C2 for ; Wed, 13 Dec 2017 05:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DDE028B14 for ; Wed, 13 Dec 2017 05:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10FA028CE7; Wed, 13 Dec 2017 05:18:56 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 8EEB728B14 for ; Wed, 13 Dec 2017 05:18:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E84076E297; Wed, 13 Dec 2017 05:18:54 +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-bn3nam01on0055.outbound.protection.outlook.com [104.47.33.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42C886E297; Wed, 13 Dec 2017 05:18:53 +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=Pjb7Oh5bHgFyM//XaL0COKswcbCD23RhTstjXhLCRMo=; b=Ppamn2kI9QtJ+bSQUXdAYmVJWQnnqk2f8POdPtzXL7wOmtjvsA9nQ3M3W3ZAg7B3yCW+fLOMFrhS0iKAxfuvc6VrFpGL7frdgCUzpaZnXifSZe3/70DGgxIklRwtzW4ptEevE3fPIC1vvblgSUirk/PlIyGVz+/KZsTdhNOrdRg= Received: from CY1PR12CA0056.namprd12.prod.outlook.com (10.163.230.24) by CY4PR1201MB0056.namprd12.prod.outlook.com (10.172.77.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 05:18:51 +0000 Received: from CO1NAM03FT036.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by CY1PR12CA0056.outlook.office365.com (2a01:111:e400:c42b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Wed, 13 Dec 2017 05:18:51 +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 SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT036.mail.protection.outlook.com (10.152.80.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.302.6 via Frontend Transport; Wed, 13 Dec 2017 05:18:51 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Tue, 12 Dec 2017 23:18:49 -0600 From: Roger He To: , Subject: [PATCH 3/3] drm/ttm: enable eviction for Per-VM-BO Date: Wed, 13 Dec 2017 13:17:58 +0800 Message-ID: <1513142278-4294-3-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513142278-4294-1-git-send-email-Hongbo.He@amd.com> References: <1513142278-4294-1-git-send-email-Hongbo.He@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(2980300002)(428003)(199004)(189003)(305945005)(478600001)(72206003)(356003)(105586002)(4326008)(81166006)(106466001)(97736004)(450100002)(81156014)(77096006)(5660300001)(53416004)(2906002)(54906003)(16586007)(47776003)(68736007)(50466002)(110136005)(8676002)(104016004)(50226002)(36756003)(8936002)(48376002)(316002)(76176011)(59450400001)(7696005)(53936002)(86362001)(230783001)(575784001)(51416003)(2950100002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0056; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT036; 1:xQDUHMUPiyOngUJkttv5yJOLC5RzJIjKrSjbCF6fAFhA6Y7Sk6NfX1hSUIFGdumStHocfiJk7K6bGGH/CDui7/oL5ZgYs1ZWTu4ENAJkRZ9OpLgR3Lk5TUDTz26ItRuV X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 375d8f59-3fb9-4eca-ef47-08d541e8ff49 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:CY4PR1201MB0056; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0056; 3:g5jCtP2SmQZWB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ZDnBwsoch15CBtNLRtM5iONs72JQ4LrQ/FxaPgkb/MlQVXfmFh9QSVmH6Fdrx+jMTOAOFxCBBCKlV7MbHWW5erOGuEhuklrhGs8LnZAb7K80/MgkQNIxwXKND03sIJJPUN9NiRdIRioChk8bojQMJio0G712QeA5ddKAt4X3C8T1PVzLMdFd9cGA2my+d1oAWgiGXZRSAQkoa6dKQAbwgMiWdBnoqXFQeR+DHFMRtjiqALc286h02vb4Un6CWPin/+lFBNcYRRYskZQrpXSYTZOAFM7dNsjeCpKHW6w5+az+HJuZyo99gJFKe7NYe5zshqvFMCX2+dTPUuViZakfvJJox6Lljdfdir07WKEzohaTCSJJGgPUlJEr1Bx3t2IzvKEcK6NysRGqDrpkGHyc+kGLdPHwZHDPk4BsQjILCT0tDiuhpJv0FBYHUjepBsx3 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93003095)(3002001)(3231023)(10201501046)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123555025)(20161123564025)(6072148)(201708071742011); SRVR:CY4PR1201MB0056; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR1201MB0056; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0056; 4:s/55pP95O+IpyDqa/3tA3EO3QNpQwMH8rFPR4XKHoglQkx4VOhuS7MaKpSf5njuKy7Iys5KOncZ36O/PHhuQXKPPL42t2HclVELo1AWyvRvhgcVt+px2aCf4WfS6B9czCf6tNvKL8j4bG8W5Pr4hNmMsIKHv00pQWDgfT2QJjeA3gup2KfdVdandFNJaVJmxpC4Hpx3dq82pXxR/lXSwoWTcguLanlywbuYnk0ubqwJzBIQwM/qXYDhLtTZbTh4GcrfwkcpIv01g6JjpJQSa14QlLTuzhgDttOPq1mjRGM3TE5JSFkb3UaTT2/aWocjU X-Forefront-PRVS: 052017CAF1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0056; 23:bMMF2oo0MIjLCUvY+XHbE9e4kGDRlVRZsBoqqbz?= =?us-ascii?Q?fI8zVsEWz6xlXwiMtGMkBAkxqh7Bw0WOasBIhMvC4nzkCpldspJXVQd5pCJx?= =?us-ascii?Q?LxdaydCbOtXAKsRVs1RnO89M6Eag257xbXgSPUmXvndm4tpAoCWJgn521X1z?= =?us-ascii?Q?Z8E6AB0pcQz3g9kEwkPXxR/F+L+lU8BoRrIc/9yKpcNXiyATfIVhUIPJbKFJ?= =?us-ascii?Q?vXOot0jF88fi/9mfB8uk2gQx+E4CtxiS8qURxkEnjNRgKUgjzTboBC9omxgQ?= =?us-ascii?Q?A4TicC0szVmbOn72IGGDD8WuoVJ+xQvYw8yNRYMPdDtI2w8Qn6LqL67QU6dR?= =?us-ascii?Q?jBuiLSM+sy8HIEzjZF7DrDfIlAsLPHgzK7pinM/NbDasLJeQPloKV9LiEviH?= =?us-ascii?Q?EmvvKrUs1IptiArShsoq90Bwt4hC94wZDqdCYKTjcmVRLvCaMOQ/doH2O5vq?= =?us-ascii?Q?jStXUcdVNyC4/oLUV1HFZJxWILGO53tiZ+rfHSbCoyTkIr534T8VqsYDIZIv?= =?us-ascii?Q?WqUMoSWhAZUl+McnSkCLRtW2oavRSM1RzFQmggM1juh186tkijCWHKUgcVXo?= =?us-ascii?Q?ynMkvVckT4T9mJtoKURYKbw5Lpkr+QHp3vVA0mCv82pA7rui/VCc2eSRiDWJ?= =?us-ascii?Q?XuVhvRHfa6nGg1fFbTqfFLR/v6Z6Sgs8kQSszj3wYPBrWug2zBXAqRCsydO0?= =?us-ascii?Q?3R765Rlt7NKjn9v1fS3hIBt47sy+ZS76e7fszSaLU52rzHvBPllWuebejGCB?= =?us-ascii?Q?BEKtf+rg2mqgOXEODt6cCheo0K5ny5yg71nTSEzsNN0YOhL2O2hf+g2/+0p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98z4IagekdqIKAH0O4ehJ2URcZkNKBuridlPcgQJZa4zsRKcRXiy295aJ9hYk20J5YCmYg30HF5NqOMMDOD9lZR2j+Rk9UWOjPRY6kD+kYhggHw6BxWlRa70V39wxyURImOLI7/AMfZdYfvOPTmAuNSh8jawb0mUGaq9rTvDYgUxYWaWdcy3G5QKvhqSg58ki7BWdvQI04cn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0056; 20:8DkumqkFGFmA2GAn+GvWMRFxDWwMBjfBRsCr09+4HS+l/3w9Bhy6Sgup0IREmdNzzcIvMLs6L+3HgCClojp8uHqM9XfjqDVEWN8SBfyE3HUUxTtHyLKaS5OThZqOToeCVr9oDq1yV1AUNDhwoPlTQhPxMiDwcKUdncNq4ZF4nmftfeecXGw92eq8zgzeqVs8X05sktqF/QUjKIdcb7f4O07CQUk9GStHCUj3fIutjXGHju6tpnSJ/QzPmilRGXlS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 05:18:51.2171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 375d8f59-3fb9-4eca-ef47-08d541e8ff49 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: CY4PR1201MB0056 Cc: Roger He , Christian.Koenig@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: I0c6ece0decd18d30ccc94e5c7ca106d351941c62 Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_bo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 098b22e..e7438b0 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -707,7 +707,6 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, EXPORT_SYMBOL(ttm_bo_eviction_valuable); static int ttm_mem_evict_first(struct ttm_bo_device *bdev, - struct reservation_object *resv, uint32_t mem_type, const struct ttm_place *place, struct ttm_operation_ctx *ctx) @@ -722,10 +721,8 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, spin_lock(&glob->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { list_for_each_entry(bo, &man->lru[i], lru) { - if (bo->resv == resv) { - if (list_empty(&bo->ddestroy)) - continue; - } else { + if (!ctx->allow_reserved_eviction || + bo->resv != ctx->resv) { locked = reservation_object_trylock(bo->resv); if (!locked) continue; @@ -835,7 +832,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, return ret; if (mem->mm_node) break; - ret = ttm_mem_evict_first(bdev, bo->resv, mem_type, place, ctx); + ret = ttm_mem_evict_first(bdev, mem_type, place, ctx); if (unlikely(ret != 0)) return ret; } while (1); @@ -1332,8 +1329,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev, for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { while (!list_empty(&man->lru[i])) { spin_unlock(&glob->lru_lock); - ret = ttm_mem_evict_first(bdev, NULL, mem_type, - NULL, &ctx); + ret = ttm_mem_evict_first(bdev, mem_type, NULL, &ctx); if (ret) return ret; spin_lock(&glob->lru_lock);