From patchwork Thu Oct 28 13:26:25 2021 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: 12590171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9B02C4332F for ; Thu, 28 Oct 2021 13:26:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4B9960F9B for ; Thu, 28 Oct 2021 13:26:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A4B9960F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C839B6E969; Thu, 28 Oct 2021 13:26:34 +0000 (UTC) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DEF66E961; Thu, 28 Oct 2021 13:26:34 +0000 (UTC) Received: by mail-wr1-x42d.google.com with SMTP id i5so2525323wrb.2; Thu, 28 Oct 2021 06:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0/V9MX2CWjAIfztk9lQHqRb20K2jfbph5MPtHNbg44=; b=N9N/hZD3xSeVnPH2DcmlMtwEWHqwTpBikGSV08ByPigtIdm44uCd2jvGMcG86b0+f0 Xso2S2du7yltn6YeQXwN+ya17RVgf9inhol9CBFVzgBOp700iSQmzsoL+stwpFEF+eKc 3Dtdlm5ZVDSkKzvdmMsu4m7V4W0oBqse6uKSAjLwJzWvqJTmi5ARB1UZspNefbv9Z2GW zYt65uUjvpHTGoq3ioji6aOjLR1rxBbi4xuWN/OYZkVhlwYPdPRmr5390eaNWFkkj+7G JEcJpDjHVldeyPKsyZLX905vkoifjWsE8cWiyZoTwvYqOsZOa+DoqRhLkTXH/tEz68re t7kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0/V9MX2CWjAIfztk9lQHqRb20K2jfbph5MPtHNbg44=; b=Gv3Af/5Xv3XrtdMrxhg3i3TIXzGnYlXphz3eYNHxRpanyYyWPh76RpP7EcY9oEV3Xh ZRTGvFn1/1g5Pw55rep4FmUbVzv12MKDyKF8z3CNi3y5lB7Z7IhcoAWHW1LTgGx6U3cJ qMjxgwSlBpuYUEgwn1akzY+qKrpH1obc7zzYkHX0eEbx2V6bX3WnKxWK4JyoD0LOYeUW 2G21ANJamvHnsHfaXQjE5/iJ89oWcJqazZDtlGiN7TlSJnnqcv0IOaZoO9gBGs3ZOU3F DelIAFs/iTCyU0DqD0GnW2pfw4VW9ABueqPbXkUjZZLZEwg/mr1cgsTXMk2o/WTevNHZ oFyQ== X-Gm-Message-State: AOAM530pcra51FSeLSzIoiPHk9TGhBpJdFACbDjXAM2GYACZyCDNbCDx kYPKPKYKuE/M+Jzu+YkrokEEkv7t/kI= X-Google-Smtp-Source: ABdhPJyN2MGWslATcLlPRDx7wTnmw/AQjSygmNv/6mJVmC/aO4jjiZa8ruoWViZgoH2yfuxRLZ4Unw== X-Received: by 2002:a5d:6e8d:: with SMTP id k13mr5734588wrz.295.1635427592655; Thu, 28 Oct 2021 06:26:32 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:32 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 1/6] dma-buf: move dma_resv_prune_unlocked into dma_resv.c Date: Thu, 28 Oct 2021 15:26:25 +0200 Message-Id: <20211028132630.2330-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" The i915 driver implements a prune function which is called when it is very likely that the fences inside the dma_resv object can be removed because they are all signaled. Move that function into the dma-resv.c code since the behavior of pruning fences is something internal to the object. Signed-off-by: Christian König --- drivers/dma-buf/dma-resv.c | 18 ++++++++++++++++++ drivers/gpu/drm/i915/Makefile | 1 - drivers/gpu/drm/i915/dma_resv_utils.c | 17 ----------------- drivers/gpu/drm/i915/dma_resv_utils.h | 13 ------------- drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 3 +-- include/linux/dma-resv.h | 1 + 7 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 drivers/gpu/drm/i915/dma_resv_utils.c delete mode 100644 drivers/gpu/drm/i915/dma_resv_utils.h diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index ff3c0558b3b8..64d4f95778c4 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -324,6 +324,24 @@ void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence) } EXPORT_SYMBOL(dma_resv_add_excl_fence); +/** + * dma_resv_prune_unlocked - try to remove signaled fences + * @obj: The dma_resv object to prune + * + * Try to lock the object, test if it is signaled and if yes then remove all the + * signaled fences. + */ +void dma_resv_prune_unlocked(struct dma_resv *obj) +{ + if (!dma_resv_trylock(obj)) + return; + + if (dma_resv_test_signaled(obj, true)) + dma_resv_add_excl_fence(obj, NULL); + dma_resv_unlock(obj); +} +EXPORT_SYMBOL(dma_resv_prune_unlocked); + /** * dma_resv_iter_restart_unlocked - restart the unlocked iterator * @cursor: The dma_resv_iter object to restart diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 660bb03de6fc..5c1af130cb6d 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -60,7 +60,6 @@ i915-y += i915_drv.o \ # core library code i915-y += \ - dma_resv_utils.o \ i915_memcpy.o \ i915_mm.o \ i915_sw_fence.o \ diff --git a/drivers/gpu/drm/i915/dma_resv_utils.c b/drivers/gpu/drm/i915/dma_resv_utils.c deleted file mode 100644 index 7df91b7e4ca8..000000000000 --- a/drivers/gpu/drm/i915/dma_resv_utils.c +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT -/* - * Copyright © 2020 Intel Corporation - */ - -#include - -#include "dma_resv_utils.h" - -void dma_resv_prune(struct dma_resv *resv) -{ - if (dma_resv_trylock(resv)) { - if (dma_resv_test_signaled(resv, true)) - dma_resv_add_excl_fence(resv, NULL); - dma_resv_unlock(resv); - } -} diff --git a/drivers/gpu/drm/i915/dma_resv_utils.h b/drivers/gpu/drm/i915/dma_resv_utils.h deleted file mode 100644 index b9d8fb5f8367..000000000000 --- a/drivers/gpu/drm/i915/dma_resv_utils.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: MIT */ -/* - * Copyright © 2020 Intel Corporation - */ - -#ifndef DMA_RESV_UTILS_H -#define DMA_RESV_UTILS_H - -struct dma_resv; - -void dma_resv_prune(struct dma_resv *resv); - -#endif /* DMA_RESV_UTILS_H */ diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c index 5ab136ffdeb2..48029bbda682 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c @@ -15,7 +15,6 @@ #include "gt/intel_gt_requests.h" -#include "dma_resv_utils.h" #include "i915_trace.h" static bool swap_available(void) @@ -229,7 +228,7 @@ i915_gem_shrink(struct i915_gem_ww_ctx *ww, i915_gem_object_unlock(obj); } - dma_resv_prune(obj->base.resv); + dma_resv_prune_unlocked(obj->base.resv); scanned += obj->base.size >> PAGE_SHIFT; skip: diff --git a/drivers/gpu/drm/i915/gem/i915_gem_wait.c b/drivers/gpu/drm/i915/gem/i915_gem_wait.c index 569658c7859c..1915d203a72d 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_wait.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_wait.c @@ -10,7 +10,6 @@ #include "gt/intel_engine.h" -#include "dma_resv_utils.h" #include "i915_gem_ioctls.h" #include "i915_gem_object.h" @@ -53,7 +52,7 @@ i915_gem_object_wait_reservation(struct dma_resv *resv, * signaled. */ if (timeout > 0) - dma_resv_prune(resv); + dma_resv_prune_unlocked(resv); return timeout; } diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index eebf04325b34..e0558429a5ee 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -458,6 +458,7 @@ void dma_resv_fini(struct dma_resv *obj); int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences); void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence); void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence); +void dma_resv_prune_unlocked(struct dma_resv *obj); int dma_resv_get_fences(struct dma_resv *obj, struct dma_fence **pfence_excl, unsigned *pshared_count, struct dma_fence ***pshared); int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src); From patchwork Thu Oct 28 13:26:26 2021 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: 12590175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77AABC433EF for ; Thu, 28 Oct 2021 13:26:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4768E60F9B for ; Thu, 28 Oct 2021 13:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4768E60F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 015826E980; Thu, 28 Oct 2021 13:26:39 +0000 (UTC) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by gabe.freedesktop.org (Postfix) with ESMTPS id D57C96E971; Thu, 28 Oct 2021 13:26:34 +0000 (UTC) Received: by mail-wm1-x335.google.com with SMTP id 131-20020a1c0489000000b0032cca9883b5so8070010wme.0; Thu, 28 Oct 2021 06:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=F0uECfBAkPnxcTaaBNKjvRgDOvagF9vnqC8sbabETVI=; b=A/4UogMjSc8zQovGLXoblqVKJOl8bYZcitPpecVLxmxRfG6GDEgCJRCSjTFHun0aSD imL2m4WTdRWmc/zh0qvyk7bguneOTAGSeOUv5Y+n+gfGTApaWRHLcLy6B4uR9do15sdw 1XA2HJxLuTMqkAtDer2bpF8IjjnFQ+zZrlxF8PT99gjhjiShO8milE1ZJmsyFXSAdDbi xWCD8G9t683h5Yqk1TRUp1fEeEHp3xC8fSPXFELa82La/iItpIPTCwiWtJ9JXD4DC4x5 fvLg3mSWULqYZuCovLQyyXzVl5HAgAqNzGW374YwJmUHQu8H7Uulm2ryJGPZVoaD/M+p gpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F0uECfBAkPnxcTaaBNKjvRgDOvagF9vnqC8sbabETVI=; b=gxP7VliBoUNw9R5fUwzSuCLr5/KmR3J3SDu8pDVm84WQrLTByD9LIKPdTL8kpkfXXe j+GL4QdXN9n7kdPL80UOUjj3wp3bXU73PMHQSdR9DHTaYntZDMl3az/xn6FEsBJqqUz6 0XgecXe9gGysRpS18QgkmcB/Q+RyXhuiDsxsRqA/PlxKzZeLboFq7BZyNL87YAUHlbqV OvF4HEQ1lY0Hv6j2jBs7/xmgNRc817+E+NpO9VA+fwAyMeZTjQbnZdF/qC5P/3AflC3r S1xs/SVQupzGzPND35MVihMncVwpBeFi+t5Fj9vuzLVLvD9/oEaq4HqT3ncUVnWsea3l 2Q1A== X-Gm-Message-State: AOAM530wkfPN6CXe3clxGveJnIFISraMMCAISiCX34NLWvOC3TXbkY0i qy/pl5cAKYwrsmX4+yNNTxq95zXi5nY= X-Google-Smtp-Source: ABdhPJxxWVtcxYU9iftgYazqCFP/sUSWmT5rCt1z6ncO18Obe7fDA9DTTFpIPtN7KUSLRq3trOGntQ== X-Received: by 2002:a7b:c192:: with SMTP id y18mr4590744wmi.31.1635427593520; Thu, 28 Oct 2021 06:26:33 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:33 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 2/6] drm/amdgpu: stop getting excl fence separately Date: Thu, 28 Oct 2021 15:26:26 +0200 Message-Id: <20211028132630.2330-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028132630.2330-1-christian.koenig@amd.com> References: <20211028132630.2330-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Just grab all fences for the display flip in one go. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index d58e37fd01f4..4da7eb65e744 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -457,7 +457,6 @@ struct amdgpu_flip_work { uint64_t base; struct drm_pending_vblank_event *event; struct amdgpu_bo *old_abo; - struct dma_fence *excl; unsigned shared_count; struct dma_fence **shared; struct dma_fence_cb cb; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index dc50c05f23fc..68108f151dad 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -83,9 +83,6 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work) unsigned i; int vpos, hpos; - if (amdgpu_display_flip_handle_fence(work, &work->excl)) - return; - for (i = 0; i < work->shared_count; ++i) if (amdgpu_display_flip_handle_fence(work, &work->shared[i])) return; @@ -203,7 +200,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, goto unpin; } - r = dma_resv_get_fences(new_abo->tbo.base.resv, &work->excl, + r = dma_resv_get_fences(new_abo->tbo.base.resv, NULL, &work->shared_count, &work->shared); if (unlikely(r != 0)) { DRM_ERROR("failed to get fences for buffer\n"); @@ -253,7 +250,6 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, cleanup: amdgpu_bo_unref(&work->old_abo); - dma_fence_put(work->excl); for (i = 0; i < work->shared_count; ++i) dma_fence_put(work->shared[i]); kfree(work->shared); From patchwork Thu Oct 28 13:26:27 2021 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: 12590179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C82C433F5 for ; Thu, 28 Oct 2021 13:26:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84A8660F9B for ; Thu, 28 Oct 2021 13:26:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 84A8660F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AB676E987; Thu, 28 Oct 2021 13:26:44 +0000 (UTC) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC8876E97B; Thu, 28 Oct 2021 13:26:35 +0000 (UTC) Received: by mail-wm1-x332.google.com with SMTP id j128-20020a1c2386000000b003301a98dd62so1013610wmj.5; Thu, 28 Oct 2021 06:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+ZOGlam3ZY615eG+CpWfufQSgg3eEwqr3uZmKnHNPog=; b=kL4LO01axEADDFgKoypKI5W3+0I51DQJlfaqAybcnrgDt7QcmKegUIZCTfzOrrgOnd WCLywig0D6KfHtiKzJBpknJctlOCbyW35Nrm3Csy5y9v0efZYhAPPc06nWaZyMMhxfWL B7xBEvGtltHfS947NahYNpNJoe1tu/bheIOzESB9djQht1XOYwb+IiEiFpIm7GhDKPwH hn5sMtvQjIUChX3cT6Fb1Uoe1G3KtDnrt0/tIKsZkpgfllbKQa28pZB6o5kXUh2FU84n 3R8xdd4aRZE57lgKL8wkgKDmJPz3eDGi0NUhJq94Po1F3tURR3HXfzWuCx4p/vTlJZpn bgQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ZOGlam3ZY615eG+CpWfufQSgg3eEwqr3uZmKnHNPog=; b=Nr1m5yPJdjjcE2No9JYGlNGzkh2QalczjellYlN9z4JNN00/x3PwGKALdv3qxmHCW1 tJ1LNua8FFWOtcYYv+sRb20TcTSuV16Sqsuap/u9cb6Vsb61Q3DBjDBYDCLfQdFFhFuG k27ZN+87ytLHLQyJDXxLhUePm+YL3jC7Bq9H9gQQ+0/6QkrTzeUtKYrKP8viAT5Svkeu 0T5FP4wJ6+ieWiESXOSlp+FDXyO4jZgKFCMwLn6W3Npm4eEySf1IsjxvvpbC5x4YH1Qs pjtr/i/rXH5Si/LrJzdr7yTP9vKhyH1wBaelVJL5bT0xht2fyVWKoOzWA+1TuuUU6NKE ahwQ== X-Gm-Message-State: AOAM530MmixL93yWCp4ARhIl0iYhzd8e89Z/ExCpszHSf0NNZS7S36GT TRdki4ymetkf2cSo77T3jQyB4XPdrM4= X-Google-Smtp-Source: ABdhPJwhMpsL5tAuu5HCCIQ8uQ0zuJwI57WPFv2ZZVxa4Y++aF7AwdEm+jlfxuSci85VLFZEpY5Inw== X-Received: by 2002:a05:600c:4293:: with SMTP id v19mr4468381wmc.187.1635427594441; Thu, 28 Oct 2021 06:26:34 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:34 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 3/6] drm/etnaviv: stop getting the excl fence separately here Date: Thu, 28 Oct 2021 15:26:27 +0200 Message-Id: <20211028132630.2330-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028132630.2330-1-christian.koenig@amd.com> References: <20211028132630.2330-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Just grab all fences in one go. Signed-off-by: Christian König Reviewed-by: Lucas Stach --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 8dc93863bf96..b5e8ce86dbe7 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -189,7 +189,7 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit) continue; if (bo->flags & ETNA_SUBMIT_BO_WRITE) { - ret = dma_resv_get_fences(robj, &bo->excl, + ret = dma_resv_get_fences(robj, NULL, &bo->nr_shared, &bo->shared); if (ret) From patchwork Thu Oct 28 13:26:28 2021 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: 12590177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DDB4C433FE for ; Thu, 28 Oct 2021 13:26:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CBE260F9B for ; Thu, 28 Oct 2021 13:26:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5CBE260F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CE0A6E824; Thu, 28 Oct 2021 13:26:40 +0000 (UTC) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3BA66E971; Thu, 28 Oct 2021 13:26:36 +0000 (UTC) Received: by mail-wm1-x334.google.com with SMTP id 71so3532371wma.4; Thu, 28 Oct 2021 06:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=v95g0BYyVm7oqc3UyTL12RDeRs7zSTqHv740e7M8i+c=; b=DTZiWj4oUApd/LXGV64BlgxEY2MI7EyYnhSPyEpXOm91e9yFWKWtmw9BYg0e+67uHl gwTiGIJUlWTSs99pUEpYtDpMYWNWE9CFCTrnTxyX9YVjC7JiP0+OWLIgx2fwKkShL5Er be2Z8GMtHE/04/GTOsEIGhB0yorCiYrjoTQHgVIiAXneuoOqy8ksrMmFlKktvP0hiIoW 1RwrQXPfkaWVegZG+FDj+fBfIStvGhtlMpNXStYqhSl2e6vI4VLZQXH22EtyTgtAMf7h qEhln2QBHuRwefw7qiVsCrxyd720UMfl2cAw5s3QQjUEs9plFbMyuNR5mggzyayYf0Jl 47Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v95g0BYyVm7oqc3UyTL12RDeRs7zSTqHv740e7M8i+c=; b=w4BO7PejZDxly1+3TFjL11/e9gX/uUbW5biZJl9qQOBMTwMNJU72AmCSSyoN/pSL3o cmYYuyMHgnDL5XZmM51n80B3IjAJsQLg6Amj7LZT3ZryH39jr7Qwun82ElGglrE8hdfO 9IFdE8oS6rQ8F6koN57SFHBzJaeVIJLKwarKEnWWm8s65Q7S2WMC4Jt1aSjluOgDbDYC eF+bnxvrmDyHX+ISS2mFTWM1ELWiwW5tsnI91ryw69SBpXyJ1k4WhMSea06KNnM8QsIJ sQyBTw7utbUN9D2HR6oUB9cH0n2sx0zpHmZ67LKPVOTiFmqmdg/wkPBgZqdVfks8LHyO 9ZYg== X-Gm-Message-State: AOAM532Ib87URGKV4cja7rd2nqswqjfVZx4sk9MGdJgI3aKQk2V9+oi9 cvQaZl9DrmOz9Prk7BftLSuJJ8I1y2Y= X-Google-Smtp-Source: ABdhPJx4Q8FsdsnQCZwf86vBd7iSmUGW1h3XnB3MkdUYEpqxZQ3KrkKwCQ9ZrywPcc0fZVuYsEXcpQ== X-Received: by 2002:a05:600c:3b19:: with SMTP id m25mr12321707wms.130.1635427595432; Thu, 28 Oct 2021 06:26:35 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:35 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 4/6] dma-buf: drop excl_fence parameter from dma_resv_get_fences Date: Thu, 28 Oct 2021 15:26:28 +0200 Message-Id: <20211028132630.2330-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028132630.2330-1-christian.koenig@amd.com> References: <20211028132630.2330-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Returning the exclusive fence separately is no longer used. Signed-off-by: Christian König --- drivers/dma-buf/dma-resv.c | 43 +++++++------------- drivers/dma-buf/st-dma-resv.c | 26 +++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 3 +- include/linux/dma-resv.h | 4 +- 6 files changed, 26 insertions(+), 56 deletions(-) diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index 64d4f95778c4..fb02860312fc 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -561,26 +561,21 @@ EXPORT_SYMBOL(dma_resv_copy_fences); * dma_resv_get_fences - Get an object's shared and exclusive * fences without update side lock held * @obj: the reservation object - * @fence_excl: the returned exclusive fence (or NULL) - * @shared_count: the number of shared fences returned - * @shared: the array of shared fence ptrs returned (array is krealloc'd to - * the required size, and must be freed by caller) + * @num_fences: the number of fences returned + * @fences: the array of fence ptrs returned (array is krealloc'd to the + * required size, and must be freed by caller) * - * Retrieve all fences from the reservation object. If the pointer for the - * exclusive fence is not specified the fence is put into the array of the - * shared fences as well. Returns either zero or -ENOMEM. + * Retrieve all fences from the reservation object. + * Returns either zero or -ENOMEM. */ -int dma_resv_get_fences(struct dma_resv *obj, struct dma_fence **fence_excl, - unsigned int *shared_count, struct dma_fence ***shared) +int dma_resv_get_fences(struct dma_resv *obj, unsigned int *num_fences, + struct dma_fence ***fences) { struct dma_resv_iter cursor; struct dma_fence *fence; - *shared_count = 0; - *shared = NULL; - - if (fence_excl) - *fence_excl = NULL; + *num_fences = 0; + *fences = NULL; dma_resv_iter_begin(&cursor, obj, true); dma_resv_for_each_fence_unlocked(&cursor, fence) { @@ -588,30 +583,22 @@ int dma_resv_get_fences(struct dma_resv *obj, struct dma_fence **fence_excl, if (dma_resv_iter_is_restarted(&cursor)) { unsigned int count; - while (*shared_count) - dma_fence_put((*shared)[--(*shared_count)]); - - if (fence_excl) - dma_fence_put(*fence_excl); + while (*num_fences) + dma_fence_put((*fences)[--(*num_fences)]); - count = cursor.shared_count; - count += fence_excl ? 0 : 1; + count = cursor.shared_count + 1; /* Eventually re-allocate the array */ - *shared = krealloc_array(*shared, count, + *fences = krealloc_array(*fences, count, sizeof(void *), GFP_KERNEL); - if (count && !*shared) { + if (count && !*fences) { dma_resv_iter_end(&cursor); return -ENOMEM; } } - dma_fence_get(fence); - if (dma_resv_iter_is_exclusive(&cursor) && fence_excl) - *fence_excl = fence; - else - (*shared)[(*shared_count)++] = fence; + (*fences)[(*num_fences)++] = dma_fence_get(fence); } dma_resv_iter_end(&cursor); diff --git a/drivers/dma-buf/st-dma-resv.c b/drivers/dma-buf/st-dma-resv.c index bc32b3eedcb6..fd742a60f7e0 100644 --- a/drivers/dma-buf/st-dma-resv.c +++ b/drivers/dma-buf/st-dma-resv.c @@ -275,7 +275,7 @@ static int test_shared_for_each_unlocked(void *arg) static int test_get_fences(void *arg, bool shared) { - struct dma_fence *f, *excl = NULL, **fences = NULL; + struct dma_fence *f, **fences = NULL; struct dma_resv resv; int r, i; @@ -304,35 +304,19 @@ static int test_get_fences(void *arg, bool shared) } dma_resv_unlock(&resv); - r = dma_resv_get_fences(&resv, &excl, &i, &fences); + r = dma_resv_get_fences(&resv, &i, &fences); if (r) { pr_err("get_fences failed\n"); goto err_free; } - if (shared) { - if (excl != NULL) { - pr_err("get_fences returned unexpected excl fence\n"); - goto err_free; - } - if (i != 1 || fences[0] != f) { - pr_err("get_fences returned unexpected shared fence\n"); - goto err_free; - } - } else { - if (excl != f) { - pr_err("get_fences returned unexpected excl fence\n"); - goto err_free; - } - if (i != 0) { - pr_err("get_fences returned unexpected shared fence\n"); - goto err_free; - } + if (i != 1 || fences[0] != f) { + pr_err("get_fences returned unexpected fence\n"); + goto err_free; } dma_fence_signal(f); err_free: - dma_fence_put(excl); while (i--) dma_fence_put(fences[i]); kfree(fences); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 68108f151dad..b8cf3740dd28 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -200,8 +200,8 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, goto unpin; } - r = dma_resv_get_fences(new_abo->tbo.base.resv, NULL, - &work->shared_count, &work->shared); + r = dma_resv_get_fences(new_abo->tbo.base.resv, &work->shared_count, + &work->shared); if (unlikely(r != 0)) { DRM_ERROR("failed to get fences for buffer\n"); goto unpin; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c index b7fb72bff2c1..4500d6b4fcd3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c @@ -112,7 +112,7 @@ void amdgpu_pasid_free_delayed(struct dma_resv *resv, unsigned count; int r; - r = dma_resv_get_fences(resv, NULL, &count, &fences); + r = dma_resv_get_fences(resv, &count, &fences); if (r) goto fallback; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index b5e8ce86dbe7..982bd7135a66 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -189,8 +189,7 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit) continue; if (bo->flags & ETNA_SUBMIT_BO_WRITE) { - ret = dma_resv_get_fences(robj, NULL, - &bo->nr_shared, + ret = dma_resv_get_fences(robj, &bo->nr_shared, &bo->shared); if (ret) return ret; diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index e0558429a5ee..cde0147e8830 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -459,8 +459,8 @@ int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences); void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence); void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence); void dma_resv_prune_unlocked(struct dma_resv *obj); -int dma_resv_get_fences(struct dma_resv *obj, struct dma_fence **pfence_excl, - unsigned *pshared_count, struct dma_fence ***pshared); +int dma_resv_get_fences(struct dma_resv *obj, unsigned int *num_fences, + struct dma_fence ***fences); int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src); long dma_resv_wait_timeout(struct dma_resv *obj, bool wait_all, bool intr, unsigned long timeout); From patchwork Thu Oct 28 13:26:29 2021 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: 12590173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9846C433FE for ; Thu, 28 Oct 2021 13:26:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93FD960F9B for ; Thu, 28 Oct 2021 13:26:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93FD960F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8A1F6E97F; Thu, 28 Oct 2021 13:26:38 +0000 (UTC) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB54C6E97E; Thu, 28 Oct 2021 13:26:37 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id o4-20020a1c7504000000b0032cab7473caso4689730wmc.1; Thu, 28 Oct 2021 06:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=e+8fJ8qEMMMqeIZ3F1ua658PpkVFhH+XcSxIsmdPPN0=; b=EU2MSDkmpLBlyxYoFxQDehm+rttAByW+1sx0AHb7428+3h4Vvhf1YLcR20jST2wIS8 RXO4c/1ovzIGzUhpa5LlIvUmni6QVo2WtF5r987qIIkmV/sk0mtJQitb9a3hR8j21OiA xe+ZsnT1yyWgxLL2pgz2Az2eQqWioHiGPvrzswLrd5pbh4TKlFNzrx8H8solOFT5D7Uh zz17J9aZs0uUQl4Usmjfo4ME3mXf5A0RWr3rkXCnJKGdtzHY8v2TzjR8NzYpeEA7Fcag E/ZOBk/5BZlM3okACjo4dGEJ6il5FzLaGEtHpdbJRktuDrWfpoQXiloWEgBZjvTyL/NS 6oBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e+8fJ8qEMMMqeIZ3F1ua658PpkVFhH+XcSxIsmdPPN0=; b=OUk7Tmk8CxXZyBIyjurdKd4+a3a3UjNcoOKbqVLKzHcQMblg0zQKcvf9G78uL8V/oM eEqO+Uq6OD//fp36ZMWyBvrQqEoWB9SyGq0hfQdFVt2zwvzWC3TOJlVxn+9p9DwpGtUt J4COTVLdUBwli69LI39SoYb+4gsL0JkNmwPImLv/561cwDJP7PZf9/c1ILpojrPQra/Z 0IchgaC2rKDWH+H574Dswhk/Pd3Lu+aPz1EvyKBpOqYd1mraA0WWt1zt5PEdD0aTAFyg XIZXsYQry+g+LRpnuG/o5VQui1c47UsktFU7dPANUNJpwdslgPGwOZ52CKoRTtI5XMga 8Dlg== X-Gm-Message-State: AOAM5317Btlwkp7JwDMYrQ0bkqI7QR9TKJBaTKWqtFPIpBz7VemKPABj XBS1V2R70cGj53n59OsjrpKQ2FArgXg= X-Google-Smtp-Source: ABdhPJxVYI6AkcFJUSk41xOEyRBmUiX5QjAXTS8UFeWQOkEEVBPh6d2GQPqGnmkDAIygbNjFjtpzsA== X-Received: by 2002:a05:600c:17d4:: with SMTP id y20mr9318505wmo.113.1635427596472; Thu, 28 Oct 2021 06:26:36 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:35 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 5/6] RDMA: use dma_resv_wait() instead of extracting the fence Date: Thu, 28 Oct 2021 15:26:29 +0200 Message-Id: <20211028132630.2330-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028132630.2330-1-christian.koenig@amd.com> References: <20211028132630.2330-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Use dma_resv_wait() instead of extracting the exclusive fence and waiting on it manually. Signed-off-by: Christian König --- drivers/infiniband/core/umem_dmabuf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/core/umem_dmabuf.c index e824baf4640d..258ba9b8c17d 100644 --- a/drivers/infiniband/core/umem_dmabuf.c +++ b/drivers/infiniband/core/umem_dmabuf.c @@ -13,7 +13,6 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf) { struct sg_table *sgt; struct scatterlist *sg; - struct dma_fence *fence; unsigned long start, end, cur = 0; unsigned int nmap = 0; int i; @@ -65,11 +64,8 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf) * may be not up-to-date. Wait for the exporter to finish * the migration. */ - fence = dma_resv_excl_fence(umem_dmabuf->attach->dmabuf->resv); - if (fence) - return dma_fence_wait(fence, false); - - return 0; + return dma_resv_wait_timeout(umem_dmabuf->attach->dmabuf->resv, false, + false, MAX_SCHEDULE_TIMEOUT); } EXPORT_SYMBOL(ib_umem_dmabuf_map_pages); From patchwork Thu Oct 28 13:26:30 2021 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: 12590181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BF56C433EF for ; Thu, 28 Oct 2021 13:26:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2885C60FC4 for ; Thu, 28 Oct 2021 13:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2885C60FC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4106C6E98B; Thu, 28 Oct 2021 13:26:45 +0000 (UTC) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F3406E981; Thu, 28 Oct 2021 13:26:39 +0000 (UTC) Received: by mail-wm1-x32b.google.com with SMTP id a20-20020a1c7f14000000b003231d13ee3cso9374071wmd.3; Thu, 28 Oct 2021 06:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=egdx3Ywv2yu3nUP1jLQlD5jYdd3fqDZiwOa9q8R+o2s=; b=aBAcGSAr9R1pFZVRu12YsAne8HtbedhP5B06ewdompnZQhByafZ2d1TS2FhMhrLDcI Xzix+FUdCnaZHli5XiOxJNDB1GHEysLC1/7tPKk40hEVCL+B50nu0M5j00AjRUAOeeWJ x4AQyn/SYuxks0V+yxbjkmtAoJI3zeF80qprDcTdLjOWJ0hGy1qKl6cHfR6D8HeZxWV0 h1L0UpqPWY3u9ZeMuwFZDmG+cjlnWJXfIibGH/i8YARbC9Sv40BgtNzN2BVrNRVi3eDJ 8cpXNMG64KJ9qr5wcIzC+Nwdy3mgBchGONRgZfs9rYZ1j2GuPX7TAz+X6G1jmj6DDOrh ktTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=egdx3Ywv2yu3nUP1jLQlD5jYdd3fqDZiwOa9q8R+o2s=; b=bPEa2S3yMT3j3J618NUQP0YC2IFp21Yz0twqGdSZdltQWYFO2uvIcw3c32HkAlrrBR +sKy5SPpznMNN3nQZrsLewD9772e+aFf92g5yBCiWBWHEBmkWpJ3JME18WdEFA8NkdPq s5ZPOqmvKzgBT9r91PuV8MIrBY4Wn20Nzd3S7pDDonXXXcpZ+J+zyKTSd/xlYC64jfFQ totDVgNLbmE96vl5opfB35sRfPgnQiUPPDfb/TUSRXiSsMzeQWH1CS0tOhJwX+jDXZkP 3xHCYx3BjWaNXOdETRikdYweFmIxDvLObZk6pzN5WBwZ6ThHBn1qRNr/CHU48EdN5DtZ 8tPw== X-Gm-Message-State: AOAM5335bQvXJTlppyBaNBAuXuiPfwhKDGJ5uaNMi6/V6wh8TVnGLff3 wXQiBPyGKt6Lwixj+2yW3RiFn1lpuG8= X-Google-Smtp-Source: ABdhPJzSb2AGqZ2hHQoqdIbV2oph49YUFYUmPMj8+frHGtYAnsyRaMDsJ0wp80qNzpOY2XZ0GZcqXw== X-Received: by 2002:a7b:c351:: with SMTP id l17mr4649970wmj.120.1635427597621; Thu, 28 Oct 2021 06:26:37 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l11sm2935695wrt.49.2021.10.28.06.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 06:26:37 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 6/6] drm/radeon: use dma_resv_wait_timeout() instead of manually waiting Date: Thu, 28 Oct 2021 15:26:30 +0200 Message-Id: <20211028132630.2330-6-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028132630.2330-1-christian.koenig@amd.com> References: <20211028132630.2330-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Don't touch the exclusive fence manually here, but rather use the general dma_resv function. We did that for better hw reset handling but this doesn't necessary work correctly. Signed-off-by: Christian König Acked-by: Nirmoy Das --- drivers/gpu/drm/radeon/radeon_uvd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 2ea86919d953..377f9cdb5b53 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -469,7 +469,6 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, { int32_t *msg, msg_type, handle; unsigned img_size = 0; - struct dma_fence *f; void *ptr; int i, r; @@ -479,13 +478,11 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, return -EINVAL; } - f = dma_resv_excl_fence(bo->tbo.base.resv); - if (f) { - r = radeon_fence_wait((struct radeon_fence *)f, false); - if (r) { - DRM_ERROR("Failed waiting for UVD message (%d)!\n", r); - return r; - } + r = dma_resv_wait_timeout(bo->tbo.base.resv, false, false, + MAX_SCHEDULE_TIMEOUT); + if (r <= 0) { + DRM_ERROR("Failed waiting for UVD message (%d)!\n", r); + return r ? r : -ETIME; } r = radeon_bo_kmap(bo, &ptr);