From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Christian König" <christian.koenig@amd.com>
Subject: [Intel-gfx] [PATCH 1/8] dma-fence: Bypass signaling annotation from dma_fence_is_signaled
Date: Fri, 9 Jun 2023 13:11:36 +0100 [thread overview]
Message-ID: <20230609121143.1232420-2-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20230609121143.1232420-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
For dma_fence_is_signaled signaling critical path annotations are an
annoying cause of false positives when using dma_fence_is_signaled and
indirectly higher level helpers such as dma_resv_test_signaled etc.
Drop the critical path annotation since the "is signaled" API does not
guarantee to ever change the signaled status anyway.
We do that by adding a low level _dma_fence_signal helper and use it from
dma_fence_is_signaled.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/dma-buf/dma-fence.c | 26 ++++++++++++++++++++------
include/linux/dma-fence.h | 3 ++-
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index f177c56269bb..f216a189a755 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -444,6 +444,25 @@ int dma_fence_signal_locked(struct dma_fence *fence)
}
EXPORT_SYMBOL(dma_fence_signal_locked);
+/**
+ * _dma_fence_signal - signal completion of a fence bypassing critical section annotation
+ * @fence: the fence to signal
+ *
+ * This low-level helper should not be used by code external to dma-fence.h|c!
+ */
+int _dma_fence_signal(struct dma_fence *fence)
+{
+ unsigned long flags;
+ int ret;
+
+ spin_lock_irqsave(fence->lock, flags);
+ ret = dma_fence_signal_timestamp_locked(fence, ktime_get());
+ spin_unlock_irqrestore(fence->lock, flags);
+
+ return ret;
+}
+EXPORT_SYMBOL(_dma_fence_signal);
+
/**
* dma_fence_signal - signal completion of a fence
* @fence: the fence to signal
@@ -459,7 +478,6 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
*/
int dma_fence_signal(struct dma_fence *fence)
{
- unsigned long flags;
int ret;
bool tmp;
@@ -467,11 +485,7 @@ int dma_fence_signal(struct dma_fence *fence)
return -EINVAL;
tmp = dma_fence_begin_signalling();
-
- spin_lock_irqsave(fence->lock, flags);
- ret = dma_fence_signal_timestamp_locked(fence, ktime_get());
- spin_unlock_irqrestore(fence->lock, flags);
-
+ ret = _dma_fence_signal(fence);
dma_fence_end_signalling(tmp);
return ret;
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index d54b595a0fe0..d94768ad70e4 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -387,6 +387,7 @@ static inline void dma_fence_end_signalling(bool cookie) {}
static inline void __dma_fence_might_wait(void) {}
#endif
+int _dma_fence_signal(struct dma_fence *fence);
int dma_fence_signal(struct dma_fence *fence);
int dma_fence_signal_locked(struct dma_fence *fence);
int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp);
@@ -452,7 +453,7 @@ dma_fence_is_signaled(struct dma_fence *fence)
return true;
if (fence->ops->signaled && fence->ops->signaled(fence)) {
- dma_fence_signal(fence);
+ _dma_fence_signal(fence);
return true;
}
--
2.39.2
next prev parent reply other threads:[~2023-06-09 12:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 12:11 [Intel-gfx] [PATCH v3 0/8] fdinfo memory stats Tvrtko Ursulin
2023-06-09 12:11 ` Tvrtko Ursulin [this message]
2023-06-09 12:11 ` [Intel-gfx] [PATCH 2/8] drm/i915: Track buffer objects belonging to clients Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 3/8] drm/i915: Record which clients own a VM Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 4/8] drm/i915: Track page table backing store usage Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 5/8] drm/i915: Account ring buffer and context state storage Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 6/8] drm: Add drm_gem_prime_fd_to_handle_obj Tvrtko Ursulin
2023-06-09 12:44 ` Iddamsetty, Aravind
2023-06-09 14:12 ` Tvrtko Ursulin
2023-06-09 17:09 ` Rob Clark
2023-06-12 8:26 ` Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 7/8] drm/i915: Track imported dma-buf objects in memory stats Tvrtko Ursulin
2023-06-09 12:11 ` [Intel-gfx] [PATCH 8/8] drm/i915: Implement fdinfo memory stats printing Tvrtko Ursulin
2023-06-09 12:48 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for fdinfo memory stats (rev2) Patchwork
2023-06-09 12:48 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-06-09 17:47 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
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=20230609121143.1232420-2-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.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