From patchwork Thu Nov 16 02:00:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10060639 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 792C360230 for ; Thu, 16 Nov 2017 03:34:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69A722A691 for ; Thu, 16 Nov 2017 03:34:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E8102A697; Thu, 16 Nov 2017 03:34:31 +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=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 9BCAC2A691 for ; Thu, 16 Nov 2017 03:34:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 401796E723; Thu, 16 Nov 2017 03:34:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 5615 seconds by postgrey-1.35 at gabe; Thu, 16 Nov 2017 03:34:26 UTC Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0073.outbound.protection.outlook.com [104.47.37.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1FC86E092; Thu, 16 Nov 2017 03:34:26 +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=Sr0fTecMgoP27W2ULlC+x615vGZj0V7B8BF7ZQvvfM8=; b=micB/S1IlLyNJG8UD6dxS5LbsA6PQY6Dx/1L3mh09BckvszDu6v1HpQg7u6kS5CcQXZNudYyhhohbPZ0OfqNulggkM13NA309N0cfiiL9nvkfqV2LfetZSooOWLOO9TdewTVzm/fwX1boC1gKVyVVREQxHZ8T88bPJAfng/HZ+Y= Received: from BN6PR1201MB0114.namprd12.prod.outlook.com (10.174.114.139) by BN6PR1201MB0115.namprd12.prod.outlook.com (10.174.114.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Thu, 16 Nov 2017 02:00:46 +0000 Received: from BN6PR1201MB0114.namprd12.prod.outlook.com ([10.174.114.139]) by BN6PR1201MB0114.namprd12.prod.outlook.com ([10.174.114.139]) with mapi id 15.20.0239.005; Thu, 16 Nov 2017 02:00:46 +0000 From: "He, Roger" To: =?utf-8?B?Q2hyaXN0aWFuIEvDtm5pZw==?= , "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" Subject: RE: [PATCH 1/2] drm/ttm: fix ttm_mem_evict_first once more Thread-Topic: [PATCH 1/2] drm/ttm: fix ttm_mem_evict_first once more Thread-Index: AQHTXg3Hi7qeSCnyPkiSfnJaUh2LoaMWQSRA Date: Thu, 16 Nov 2017 02:00:46 +0000 Message-ID: References: <20171115123151.3038-1-christian.koenig@amd.com> In-Reply-To: <20171115123151.3038-1-christian.koenig@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Hongbo.He@amd.com; x-originating-ip: [116.228.147.243] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR1201MB0115; 20:BpbAskJDmLQzBrZjXqX5fo0oOrE0DEffNV9/796SE9LcViUfjRXFmLG2k4p2VXgNI/46zH/mw8cEfkLeCk5bYQmVz0Is6gRBpbqOK8Irz1mT8S2TE95csXRw+wAUwGDduTIy8MflpAsZev+yTT4/naD7nt0uJSoX354fM77F/SOFzJNdBQjtW8w4NuIeNs7CviLvdaUh0/9xXoXEBIdF3nUeS3bm4p7FPCein+8sqJOi+UWuMjcYcVHzmO+6KkRS x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 01f1dbde-76a0-43a7-6362-08d52c95da6c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BN6PR1201MB0115; x-ms-traffictypediagnostic: BN6PR1201MB0115: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(767451399110)(217544274631240); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231022)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR1201MB0115; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR1201MB0115; x-forefront-prvs: 0493852DA9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(199003)(13464003)(189002)(105586002)(101416001)(33656002)(53546010)(2501003)(76176999)(2201001)(54356999)(50986999)(189998001)(66066001)(106356001)(3660700001)(55016002)(3280700002)(6306002)(9686003)(53936002)(8936002)(99286004)(6436002)(229853002)(7696004)(6506006)(2906002)(25786009)(2900100001)(81166006)(6246003)(68736007)(5660300001)(110136005)(3846002)(102836003)(8676002)(6116002)(81156014)(39060400002)(966005)(478600001)(72206003)(74316002)(14454004)(316002)(2950100002)(305945005)(7736002)(97736004)(86362001)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0115; H:BN6PR1201MB0114.namprd12.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01f1dbde-76a0-43a7-6362-08d52c95da6c X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2017 02:00:46.8766 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0115 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 Reviewed-by: Roger He Thanks Roger(Hongbo.He) -----Original Message----- From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig Sent: Wednesday, November 15, 2017 8:32 PM To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/ttm: fix ttm_mem_evict_first once more The code path isn't hit at the moment, but we need to take the lock to add the BO back to the LRU. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.11.0 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 07d9c6e5b6ca..7c1eac4f4b4b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -793,10 +793,13 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, spin_unlock(&glob->lru_lock); ret = ttm_bo_evict(bo, interruptible, no_wait_gpu); - if (locked) + if (locked) { ttm_bo_unreserve(bo); - else + } else { + spin_lock(&glob->lru_lock); ttm_bo_add_to_lru(bo); + spin_unlock(&glob->lru_lock); + } kref_put(&bo->list_kref, ttm_bo_release_list); return ret;