linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: phasta@kernel.org, Lyude Paul <lyude@redhat.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/nouveau: Don't signal when killing the fence context
Date: Thu, 22 May 2025 14:59:16 +0200	[thread overview]
Message-ID: <aC8fpEXYWZ9Oy41J@pollux> (raw)
In-Reply-To: <eae0ff0f-31a6-433a-b255-9bdb4727a940@amd.com>

On Thu, May 22, 2025 at 02:34:33PM +0200, Christian König wrote:
> See all the functions inside include/linux/dma-fence.h can be used by everybody. It's basically the public interface of the dma_fence object.

As you write below, in certain cases it is valid to call this from drivers, so
it's not unreasonable to have it as part of the public API.

> So testing if a fence is signaled without calling the callback is only allowed by whoever implemented the fence.
> 
> In other words nouveau can test nouveau fences, i915 can test i915 fences, amdgpu can test amdgpu fences etc... But if you have the wrapper that makes it officially allowed that nouveau starts testing i915 fences and that would be problematic.

In general, I like the  __dma_fence_is_signaled() helper, because this way we
can document in which cases it is allowed to be used, i.e. the ones you descibe
above.

test_bit() can be called by anyone and there is no documentation comment
explaining that it is only allowed under certain conditions.

Having the __dma_fence_is_signaled() helper properly documented could get you
rid of having to explain in which case the test_bit() dance is allowed to do
over and over again. :-)

I also think the name is good, since the '__' prefix already implies that there
are some restrictions on the use of this helper.

  parent reply	other threads:[~2025-05-22 12:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 11:25 [PATCH 1/2] dma-buf: Add __dma_fence_is_signaled() Philipp Stanner
2025-05-22 11:25 ` [PATCH 2/2] drm/nouveau: Don't signal when killing the fence context Philipp Stanner
2025-05-22 12:06   ` Christian König
2025-05-22 12:20     ` Philipp Stanner
2025-05-22 12:34       ` Christian König
2025-05-22 12:42         ` Philipp Stanner
2025-05-22 13:05           ` Christian König
2025-05-22 13:50             ` Danilo Krummrich
2025-05-22 15:01               ` Christian König
2025-05-22 12:57         ` Tvrtko Ursulin
2025-05-22 13:15           ` Christian König
2025-05-22 12:59         ` Danilo Krummrich [this message]
2025-05-22 13:09           ` Christian König
2025-05-22 13:16             ` Philipp Stanner
2025-05-22 13:24               ` Christian König
2025-05-22 13:43                 ` Philipp Stanner
2025-05-22 14:35                   ` Christian König
2025-05-22 13:41             ` Danilo Krummrich
2025-05-23 14:47 ` [PATCH 1/2] dma-buf: Add __dma_fence_is_signaled() Tvrtko Ursulin

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=aC8fpEXYWZ9Oy41J@pollux \
    --to=dakr@kernel.org \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=phasta@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).