From patchwork Fri Dec 15 18:31:43 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: 10115839 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 3F4476019C for ; Fri, 15 Dec 2017 18:31:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 397462A0EA for ; Fri, 15 Dec 2017 18:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D0A32A0EE; Fri, 15 Dec 2017 18:31:53 +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 DA7B82A0EA for ; Fri, 15 Dec 2017 18:31:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 755E36E883; Fri, 15 Dec 2017 18:31:51 +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 21B1A6E883 for ; Fri, 15 Dec 2017 18:31:50 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id f140so19290576wmd.2 for ; Fri, 15 Dec 2017 10:31:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jEz0fB9PjsizwSgMsGquUnleei9pxXo2xdmemipy+18=; b=I8mM/26L28g9DbcKcCfVpTeL04i5ECrYsZVoh9UHpDhsl+oi/gMXJJhZSWBWFdL86b 1DBG+FTQTGJgwW1ReyKD5NxexKu6BUQbew0M6fKBlYOhrI4aBo1NXOND3sLKbIXKPMNy ZUZltlRP/1/C2b/wnbvpqQeCHGjoMP0TFgr2ZbVO934S0p133SaJX/f7jcRwPX5buBXc 3aEcd7Fc4uEJ7DgMXFXjzQsZfR/LcLGXp7AApxE09JGS8TKMqURKrRaHPRMY7vMl3qq2 g9PjYcjGnxE/RpuAeexP1ss/Ies4HwFngXUudMjGlWqpOlmaNgRPznD+eD7cz0vhRsAt V57g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=jEz0fB9PjsizwSgMsGquUnleei9pxXo2xdmemipy+18=; b=n9sY6rn+txfC394pLR3k72sySRyx6u3lPQjQfz9b7a+cVGnmQ62KbxYsMpL48wuJwA WxGj0Z43c0IaE/mTaeG4b/mPxt4oRQy+HRpeiz/KcRXdseEV1lpCxFK9e5tPuBX1/eUK LAdNtTseHzeeAiO16nP63fWrwMYTffk7M3kFTfWokdPwPhxlXjX0Lw2hmGrjwG52Tn28 6WOmJbdLIbRfLIhHOYy4HC4qNISEu22wjyIqi3CkNlUbaaU6ukwqpGCkx2t3RjgOUhkN YfkbhJZVxy+/bNQyG1gL3Yudpc6NPDE87iOcuYpP7vluRmSKpmpN+9kYkmi8adT5Ckpj 2zhw== X-Gm-Message-State: AKGB3mIswwuQrnupqeOB/rPesrluOWoffHEttIyhjnxVwG2tVINQb1mB 235Hod9G/Qa1m6HmssiWFg/x6Q== X-Google-Smtp-Source: ACJfBot44rdGFfD2aQ6qM2iVR+7uzzK/vBNJR6CaotoSArj+pLoNdmhQdgDFDMcONwPAKqYy45/3GA== X-Received: by 10.28.48.4 with SMTP id w4mr6117805wmw.16.1513362708583; Fri, 15 Dec 2017 10:31:48 -0800 (PST) Received: from localhost.localdomain ([2a02:908:1251:7981:52e:5a82:dbe5:f509]) by smtp.gmail.com with ESMTPSA id a203sm4542911wmh.45.2017.12.15.10.31.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 10:31:48 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/ttm: cleanup some more resv->lock uses Date: Fri, 15 Dec 2017 19:31:43 +0100 Message-Id: <20171215183144.16520-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171215183144.16520-1-christian.koenig@amd.com> References: <20171215183144.16520-1-christian.koenig@amd.com> 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 Use the reservation wrapper for this. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 122a964cac40..5cc96b232c17 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -165,7 +165,7 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) struct ttm_bo_device *bdev = bo->bdev; struct ttm_mem_type_manager *man; - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { @@ -216,7 +216,7 @@ EXPORT_SYMBOL(ttm_bo_del_sub_from_lru); void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo) { - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); ttm_bo_del_from_lru(bo); ttm_bo_add_to_lru(bo); @@ -665,7 +665,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, struct ttm_placement placement; int ret = 0; - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); evict_mem = bo->mem; evict_mem.mm_node = NULL; @@ -1022,7 +1022,7 @@ static int ttm_bo_move_buffer(struct ttm_buffer_object *bo, int ret = 0; struct ttm_mem_reg mem; - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); mem.num_pages = bo->num_pages; mem.size = mem.num_pages << PAGE_SHIFT; @@ -1092,7 +1092,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, int ret; uint32_t new_flags; - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); /* * Check whether we need to move buffer. */ @@ -1186,7 +1186,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->sg = sg; if (resv) { bo->resv = resv; - lockdep_assert_held(&bo->resv->lock.base); + reservation_object_assert_held(bo->resv); } else { bo->resv = &bo->ttm_resv; } @@ -1208,7 +1208,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, * since otherwise lockdep will be angered in radeon. */ if (!resv) { - locked = ww_mutex_trylock(&bo->resv->lock); + locked = reservation_object_trylock(bo->resv); WARN_ON(!locked); } diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 9237099a7c49..6e353df4e4bc 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -485,7 +485,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, fbo->acc_size = 0; fbo->resv = &fbo->ttm_resv; reservation_object_init(fbo->resv); - ret = ww_mutex_trylock(&fbo->resv->lock); + ret = reservation_object_trylock(fbo->resv); WARN_ON(!ret); *new_obj = fbo;