From patchwork Wed Nov 15 12:31:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10059297 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 59BA760231 for ; Wed, 15 Nov 2017 12:31:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5006029F55 for ; Wed, 15 Nov 2017 12:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44F5D29F58; Wed, 15 Nov 2017 12:31:59 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 D002229F57 for ; Wed, 15 Nov 2017 12:31:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43F5D6E11A; Wed, 15 Nov 2017 12:31:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id F38CA6E11A; Wed, 15 Nov 2017 12:31:56 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id v186so2651614wma.2; Wed, 15 Nov 2017 04:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=bQmExfY3zYjim8KI3niAQiI7c9qm8ABBdnB9vprE/30=; b=MTgxE5vQm4d1hvPmt9/AS69+JPwZwOCUB1WEOJOH2tc8/tnoxW1KzUUKcWa65vYTaO Y8W4UMUTojCHI3inMm0D4yr6++yRiUFwVCVbRuvQBOnhXrresXC/uu+prJbWWWDha5rN 5kIXBnZyr9EWWow4byR7z8WR8dgxmr9kV8jBkdVZywhkWfV2pZ5TpfQfcJeQJwwYHzVU TiHHvr4nWC3qaE7WJxD6V+k45AeoKw/PJFFzppHy2OC+IGh3vdxvU8FYjJUZqg+t34eW +4YtV/6vD1UnrVoVh3Jf/vi+HpSJLVUrC9CMZDH3cWEQ+PzQs8uKYTPwm8tD0tOHr1GK omAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=bQmExfY3zYjim8KI3niAQiI7c9qm8ABBdnB9vprE/30=; b=Uy7bw2PK5uAsMXEWsME6oqq2tP0sHRpKYgt5T8AV/OnaT0L5TxsTBwWfohzt8mW86w nxzjDWo/0uY09TKBVtssGEa2RghXoA6zFBEZ3i1K0iScFnB5EFj3uu381aqeBjRl37Ax dbJZ1Df5iUdYHJsp98ZKRd1/FhzfUqPir3BJAI3EDh6qJp9XX/qbXN5/ohlcJGWsY8qw GAoqNJooEAJWczaCM1ik+Cr5VNwazqJJ7uESQy/CZ86A6T2UXI9I6tbPkFuQnkxPl4D9 21a25bPXk1ahqkVZOzQL2ggemXPZIkT789TK+zORNfeBrC7deSI2HYzm1tPB+V1+dErX 7CXQ== X-Gm-Message-State: AJaThX55XgU6/0QiDuklbRR7ddFDZDjsodu+GY4/EVE64vEn83Qm33zv 3iNLoJ/yi1ifGdseR8OKlpXPJQ== X-Google-Smtp-Source: AGs4zMbP/QlwxKmLWKeaYA3hsGOBeFcQhLVIrKlKfl019cXQrN4/hJ1npKX3vRHIYMxV7aJBmu1UTw== X-Received: by 10.28.56.5 with SMTP id f5mr8921299wma.159.1510749115380; Wed, 15 Nov 2017 04:31:55 -0800 (PST) Received: from localhost.localdomain ([2a02:908:1251:7981:9494:e3ad:b2a6:adce]) by smtp.gmail.com with ESMTPSA id r63sm9749023wmg.13.2017.11.15.04.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 04:31:54 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/ttm: fix ttm_mem_evict_first once more Date: Wed, 15 Nov 2017 13:31:50 +0100 Message-Id: <20171115123151.3038-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 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 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(-) 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;