Linux Media Controller development
 help / color / mirror / Atom feed
From: Mikko Perttunen <cyndis@kapsi.fi>
To: "Sumit Semwal" <sumit.semwal@linaro.org>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Christian König" <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	 linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	 Mikko Perttunen <mperttunen@nvidia.com>
Subject: [PATCH] dma_buf/sync_file: Enable signaling for fences when querying status
Date: Tue, 08 Jul 2025 21:03:49 +0900	[thread overview]
Message-ID: <20250708-syncfile-enable-signaling-v1-1-9f6e6cd9fcda@nvidia.com> (raw)

From: Mikko Perttunen <mperttunen@nvidia.com>

dma_fence_get_status is not guaranteed to return valid information
on if the fence has been signaled or not if SW signaling has not
been enabled for the fence. To ensure valid information is reported,
enable SW signaling for fences before getting their status.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/dma-buf/sync_file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 747e377fb95417ddd506b528618a4288bea9d459..a6fd1d14dde155561b9fd2c07e6aa20dc9863a8d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -271,6 +271,8 @@ static int sync_fill_fence_info(struct dma_fence *fence,
 	const char __rcu *timeline;
 	const char __rcu *driver;
 
+	dma_fence_enable_sw_signaling(fence);
+
 	rcu_read_lock();
 
 	driver = dma_fence_driver_name(fence);
@@ -320,6 +322,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	 * info->num_fences.
 	 */
 	if (!info.num_fences) {
+		dma_fence_enable_sw_signaling(sync_file->fence);
 		info.status = dma_fence_get_status(sync_file->fence);
 		goto no_fences;
 	} else {

---
base-commit: 58ba80c4740212c29a1cf9b48f588e60a7612209
change-id: 20250708-syncfile-enable-signaling-a993acff1860


             reply	other threads:[~2025-07-08 12:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 12:03 Mikko Perttunen [this message]
2025-07-08 14:20 ` [PATCH] dma_buf/sync_file: Enable signaling for fences when querying status Christian König
2025-07-09  1:28   ` Mikko Perttunen
  -- strict thread matches above, loose matches on Subject: below --
2023-07-25  7:46 Mikko Perttunen
2023-09-01  9:37 ` Mikko Perttunen

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=20250708-syncfile-enable-signaling-v1-1-9f6e6cd9fcda@nvidia.com \
    --to=cyndis@kapsi.fi \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --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