Chris Wilson
2016-Sep-07 20:21 UTC
[Nouveau] [PATCH] drm/nouveau: Skip fence context seqno check if notifies are enabled
If the fence context has notifies enabled, each of the fences' FENCE_FLAG_SIGNALED_BIT will be updated from the interrupt. We can rely on this status for reporting the current fence_is_signaled() and so avoid an expensive uncached read. Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk> Cc: Ben Skeggs <bskeggs at redhat.com> Cc: dri-devel at lists.freedesktop.org Cc: nouveau at lists.freedesktop.org --- drivers/gpu/drm/nouveau/nouveau_fence.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 4bb9ab892ae1..7daed5c33043 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -510,6 +510,16 @@ static bool nouveau_fence_is_signaled(struct fence *f) struct nouveau_channel *chan; bool ret = false; + /* If the notify is already active, we can rely on + * FENCE_FLAG_SIGNALED_BIT being accurate and skip checking the + * current seqno as fctx->read() requires an expensive uncached read. + */ + if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags)) + return false; + + if (READ_ONCE(fctx->notify_ref)) + return false; + rcu_read_lock(); chan = rcu_dereference(fence->channel); if (chan) -- 2.9.3
Chris Wilson
2016-Sep-07 20:40 UTC
[Nouveau] [PATCH] drm/nouveau: Skip fence context seqno check if notifies are enabled
On Wed, Sep 07, 2016 at 09:21:05PM +0100, Chris Wilson wrote:> If the fence context has notifies enabled, each of the fences' > FENCE_FLAG_SIGNALED_BIT will be updated from the interrupt. We can rely > on this status for reporting the current fence_is_signaled() and so > avoid an expensive uncached read. > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk> > Cc: Ben Skeggs <bskeggs at redhat.com> > Cc: dri-devel at lists.freedesktop.org > Cc: nouveau at lists.freedesktop.org > --- > drivers/gpu/drm/nouveau/nouveau_fence.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c > index 4bb9ab892ae1..7daed5c33043 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_fence.c > +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c > @@ -510,6 +510,16 @@ static bool nouveau_fence_is_signaled(struct fence *f) > struct nouveau_channel *chan; > bool ret = false; > > + /* If the notify is already active, we can rely on > + * FENCE_FLAG_SIGNALED_BIT being accurate and skip checking the > + * current seqno as fctx->read() requires an expensive uncached read. > + */ > + if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags)) > + return false; > + > + if (READ_ONCE(fctx->notify_ref)) > + return false;Missed that nouveau_fence_is_signaled() is called after first enabling the interrupt - and there the uncached read is required in case the seqno passed before the interrupts were enabled. In that case we just want the test_bit and not the fctx->notify_ref check. -Chris -- Chris Wilson, Intel Open Source Technology Centre
Apparently Analagous Threads
- [PATCH] nouveau: rip out fence irq allow/block sequences.
- [PATCH] nouveau: rip out fence irq allow/block sequences.
- [PATCH 01/19] fence: add debugging lines to fence_is_signaled for the callback
- [RFC PATCH v1 00/16] Convert all ttm drivers to use the new reservation interface
- nouveau GSP fixes