From patchwork Thu Dec 14 08:10:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10111601 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 C389C602C2 for ; Thu, 14 Dec 2017 08:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABE9B29BAC for ; Thu, 14 Dec 2017 08:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FECE29BF7; Thu, 14 Dec 2017 08:11:01 +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 96F7529BAC for ; Thu, 14 Dec 2017 08:11:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EA706E627; Thu, 14 Dec 2017 08:10:59 +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-sn1nam02on0085.outbound.protection.outlook.com [104.47.36.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D4A06E627; Thu, 14 Dec 2017 08:10:58 +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=s15g7xYDnh6MF6uzCkyb8KD9IxCJ2DWlc8VkBDoWytM=; b=X6QW9RJxrHITjETahUHXmeBTVmX+3lq2DArXq04OI2jy2iscaDBhQuIi+drlED2X8MtSBJhLAhalGiw46VJh13dss795MCoz4omsEn+XdhRXe74t6HalW0OgEtYX0jNMRnRy9+fkYjvKU/N/8rExKa1xClfnl/HdAypf1GB/eq0= Received: from CY4PR1201CA0019.namprd12.prod.outlook.com (10.172.75.29) by BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Thu, 14 Dec 2017 08:10:55 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by CY4PR1201CA0019.outlook.office365.com (2603:10b6:910:16::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Thu, 14 Dec 2017 08:10:55 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) 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; Thu, 14 Dec 2017 08:10:54 +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; Thu, 14 Dec 2017 02:10:53 -0600 From: Roger He To: , Subject: [PATCH] drm/ttm: enable eviction for Per-VM-BO Date: Thu, 14 Dec 2017 16:10:41 +0800 Message-ID: <1513239041-32734-1-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 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)(376002)(39860400002)(346002)(2980300002)(428003)(189003)(199004)(106466001)(53416004)(305945005)(51416003)(450100002)(230783001)(104016004)(72206003)(356003)(47776003)(7696005)(2906002)(478600001)(77096006)(105586002)(5660300001)(81156014)(48376002)(53936002)(50466002)(8676002)(6666003)(110136005)(16586007)(575784001)(4326008)(316002)(50226002)(81166006)(68736007)(97736004)(36756003)(59450400001)(8936002)(86362001)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1442; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT049; 1:uhIfNpLtKXA7/hDOlcWdU1WhhW1TNoOkWzJw524G+vn21DThuPB4q/NpBL29ET7/MuL2iq3F9tVuGi0s6suOITt7+SAPQg2Qn1tOui6V4E1z2rBdrLz/heJeloIsq5dk X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8defedf7-4d22-44d9-e6ff-08d542ca3317 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 3:JSmLdQYu7g3Fm69DpRb3lA24m3DJu3a2r5d1Dd7VFNYNqd1EF1pwwutnu3ILf2xMWMJpwrnVVHD2b9FyvSG1wvbl/RQpZPr4+orQ2Mek/IsaSQniExLeahYRdw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bmW6Me2l/4oVg02eL/iHxFDQvpkCtAEcFBS4O29XgYGGUVRN653oAX40F3pLMSUzFxOd4YjQPlFnX7EqDMIQ+AgUiC5H/bR+YemJ9FWKw0WP6aWwsSxub6siNnheVdGF8SMJu416UC2t94fxOrnPbP/0qSfzNRV+TVelVUyKpMzTmvzCW2XLCOJUSi0fiwtcQvd36gvVl3voGN9h3W4da2uGWL2nWHvVAsXv3TpJU/dlR8iet1p+dIQHgkmkm6VvK8jG4kuZkqHyELmo+Qkl0sOsnnN+OdFmYLtZPsT+98mk/oe69xd7hDy3Y7jTntYPzuyoUA7h/ 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)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(6072148)(201708071742011); SRVR:BN6PR12MB1442; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 4:QdjwC+zM37WJSRjFafNv+zO8m1l1YzpuJABvAgQEtObVRluTdXaRACNSS4Zy2aRGwH15O4ZWNJe4uJjoAMkGdGK97gubJ5HzTyjwZVMs8RIyrnut/rIF7kLE+amLqAAZoruMyar3YoQk3zQLdwIQbb+ukXbtUlOWCqFdFrRviR3l/KoGo79FD9cZpKDCJhVmHUIG2oTpph1H6EHs2TWeYSs0xEyubhKddHaenrViKJf04xj3gSGBiYv3gO/5K0C0BL9TVmZk/fvwOv2C2YdiydPFlafiwgrxgbUFPod05yqYl00BTTDrogD5uEQxwtBl X-Forefront-PRVS: 05214FD68E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1442; 23:lWYq1KJSFPUDcX2h8Y12OFQnsvTcLoY7k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8hd1oIa7/SiCONh9FLX/aCE4s6efBNpe6IpY13S41NCyTnXt4yTFdX2MHyz0o4eqZwRhC/MSHamuLMqgiRqFgb9dzwUa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 20:dCSI2jPsGdz+uYCoFaujQ5avB7KWcE58a1n56oVDFQPwDhrHnT0xyx1SG3LzRv9aVj7LX1R25zaOGw0AdpX/g2lPsSfflE0m/ie2VDZujlkeOlDjoEWQRl5d5NOLuzMJ8ouOeb9fvJ0m5JV7f/F8r3xir7isKZJVrC3K7kl4lL6fKm62sPlnxf5MI4Gjkwk96vAVkoNuFkoBpHbaoFGwDjFAXSgdaL/R3hSyobAi5/Oj3QElRoRHi1mBhIsqB1Sd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2017 08:10:54.9574 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8defedf7-4d22-44d9-e6ff-08d542ca3317 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: BN6PR12MB1442 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 098b22e..ba5b486 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,8 +721,9 @@ 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)) + if (bo->resv == ctx->resv) { + if (!ctx->allow_reserved_eviction && + list_empty(&bo->ddestroy)) continue; } else { locked = reservation_object_trylock(bo->resv); @@ -835,7 +835,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 +1332,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);