From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
olvaffe@gmail.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de,
lionel.g.landwerlin@intel.com, dri-devel@lists.freedesktop.org,
faith.ekstrand@collabora.com, simona@ffwll.ch
Subject: Re: [PATCH] dma-buf: fix dma_fence_array_signaled
Date: Fri, 8 Nov 2024 16:03:09 +0100 [thread overview]
Message-ID: <20241108160309.484c08b5@collabora.com> (raw)
In-Reply-To: <f9d27c0a-084f-4b35-bd6c-af25a6bb830d@gmail.com>
On Fri, 8 Nov 2024 15:18:38 +0100
Christian König <ckoenig.leichtzumerken@gmail.com> wrote:
> > }
> > }
> >
> > dma_fence_array_clear_pending_error(array);
> > return true;
> > }
> >
> > Or if the optimisation to not walk the array when signalling is
> > already enabled is deemed important, perhaps a less thinking inducing
> > way would be this:
> ...
> > Decrementing locally cached num_pending in the loop I think does not
> > bring anything since when signalling is not enabled it will be stuck
> > at num_fences. So the loop walks the whole array versus bail on first
> > unsignalled, so latter even more efficient.
>
> That is not for optimization but for correctness.
>
> What the patch basically does is the following:
> 1. Grab the current value of num_pending.
>
> 2. Test if num_pending was potentially already modified because
> signaling is already enabled, if yes just test it and return the result.
>
> 3. If it wasn't modified go over the fences and see if we already have
> at least num_pending signaled.
>
> I should probably add a code comment explaining that.
Sorry, I didn't sync my inbox before replying. Looks like we're on the
same page here: the code clearly needs comments to explain what's going
on.
next prev parent reply other threads:[~2024-11-08 15:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 9:42 Ensure progress for dma_fence_array Christian König
2024-11-08 9:42 ` [PATCH] dma-buf: fix dma_fence_array_signaled Christian König
2024-11-08 13:01 ` Tvrtko Ursulin
2024-11-08 14:18 ` Christian König
2024-11-08 15:03 ` Boris Brezillon [this message]
2024-11-08 15:52 ` Tvrtko Ursulin
2024-11-12 12:16 ` Christian König
2024-11-08 14:54 ` Boris Brezillon
2024-11-09 0:32 ` Ensure progress for dma_fence_array Chia-I Wu
2024-11-12 12:00 ` Christian König
2024-11-12 21:10 ` Chia-I Wu
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=20241108160309.484c08b5@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=lionel.g.landwerlin@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=olvaffe@gmail.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.