From: "Christian König" <christian.koenig@amd.com>
To: "Philipp Stanner" <phasta@kernel.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Jesse Zhang" <jesse.zhang@amd.com>,
"Timur Kristóf" <timur.kristof@gmail.com>,
"Kexin Sun" <kexinsun@smail.nju.edu.cn>,
"Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu: amdgpu_fence: remove ops->release()
Date: Tue, 27 Oct 2026 14:40:56 +0100 [thread overview]
Message-ID: <54e6cd9f-57ca-402f-93b6-27fe2b15b29c@amd.com> (raw)
In-Reply-To: <20261027133727.748652-2-phasta@kernel.org>
On 10/27/26 14:37, Philipp Stanner wrote:
> amdgpu's fence implements the deprecated fence_ops->release() callback
> which prevents the driver from ever unloading robustly.
>
> amdgpu's implementation merely uses a call_rcu() that performs a kfree()
> on the fence - this functionality is already centrally implemented by
> the dma_fence backend.
>
> The dma_fence backend invokes a kfree_rcu() on the dma_fence, which is
> fine since this is always the first member of a struct amdgpu_fence.
> Thus, amdgpu's implementation is redundant.
>
> Remove fence_ops->release().
>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
I have exactly the same patch in my pipeline as well.
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> Just saw that this should be unnecessary? Don't have a setup for amdgpu
> testing right now, so please take a close look, just compile-tested.
>
> P.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 29 -----------------------
> 1 file changed, 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 3043ad041bb4..3f8b2571d74a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -892,39 +892,10 @@ static bool amdgpu_fence_enable_signaling(struct dma_fence *f)
> return true;
> }
>
> -/**
> - * amdgpu_fence_free - free up the fence memory
> - *
> - * @rcu: RCU callback head
> - *
> - * Free up the fence memory after the RCU grace period.
> - */
> -static void amdgpu_fence_free(struct rcu_head *rcu)
> -{
> - struct dma_fence *f = container_of(rcu, struct dma_fence, rcu);
> -
> - /* free fence_slab if it's separated fence*/
> - kfree(to_amdgpu_fence(f));
> -}
> -
> -/**
> - * amdgpu_fence_release - callback that fence can be freed
> - *
> - * @f: fence
> - *
> - * This function is called when the reference count becomes zero.
> - * It just RCU schedules freeing up the fence.
> - */
> -static void amdgpu_fence_release(struct dma_fence *f)
> -{
> - call_rcu(&f->rcu, amdgpu_fence_free);
> -}
> -
> static const struct dma_fence_ops amdgpu_fence_ops = {
> .get_driver_name = amdgpu_fence_get_driver_name,
> .get_timeline_name = amdgpu_fence_get_timeline_name,
> .enable_signaling = amdgpu_fence_enable_signaling,
> - .release = amdgpu_fence_release,
> };
>
> /*
>
> base-commit: 731ba09867520c047c7de53f92e384808e0b638e
prev parent reply other threads:[~2026-10-27 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 13:37 Philipp Stanner
2026-10-27 13:40 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54e6cd9f-57ca-402f-93b6-27fe2b15b29c@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesse.zhang@amd.com \
--cc=kexinsun@smail.nju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=phasta@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=simona@ffwll.ch \
--cc=srinivasan.shanmugam@amd.com \
--cc=sumit.semwal@linaro.org \
--cc=timur.kristof@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®