Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Zqiang <qiang.zhang@linux.dev>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpiolib: Use srcu_barrier() instead of synchronize_srcu() in gpiodev_release()
Date: Thu, 26 Nov 2026 08:52:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-235059@kernel.org> (raw)
In-Reply-To: <20261126084233.17381-1-qiang.zhang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] gpiolib: missing Fixes trailer for srcu_barrier() fix in
  gpiodev_release()
--

commit a9a1a00addf42a3f612e043479c9501ad1c6053c
Author: Zqiang <qiang.zhang@linux.dev>

> gpiolib: Use srcu_barrier() instead of synchronize_srcu() in gpiodev_release()
>
> The gpio_desc_label object are freed asynchronously via call_srcu() on
> gdev->desc_srcu (see desc_set_label()). to drain these pending SRCU
> callbacks before cleanup the SRCU structure, gpiodev_release() currently
> calls synchronize_srcu(&gdev->desc_srcu).
>
> However, synchronize_srcu() only waits for a grace period to elapse and
> for its own wakeme_after_rcu callback to be invoked. it does not guarantee
> that callbacks queued on other CPUs have actually been invoked by the time
> it returns. The following race may happen:
>
>               CPUA                                        CPUB
> call_srcu(desc_srcu, desc_free_label)
>
>                                                gpiodev_release()
>                                                ->synchronize_srcu()
>                                                  ->call_srcu() queue wakeme_after_rcu()
>
> SRCU GP end
> timer_reduce(delay_work)
>
>                                                SRCU GP end
>                                                 synchronize_srcu() return
>                                                ->cleanup_srcu_struct()
> /* timer still pending! */                        ->for CPUA timer_delete_sync() return true
>                                                     and cblist not empty. tigger WARN_ON()
>
> This commit therefore use srcu_barrier() instead of synchronize_srcu() on
> gdev->desc_srcu,  it entrains a barrier callback on every CPU that has callbacks
> queued and waits until all of them have been invoked.
>
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>

[Severity: Low]
Since this fixes the use of synchronize_srcu() to drain call_srcu()
callbacks before cleanup_srcu_struct() in gpiodev_release(), should this
include:

  Fixes: a86d27693066 ("gpiolib: fix the speed of descriptor label setting with SRCU")
  Fixes: 7765ffed533d ("gpiolib: use a single SRCU struct for all GPIO descriptors")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126084233.17381-1-qiang.zhang@linux.dev?part=1

      parent reply	other threads:[~2026-11-26  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:42 [PATCH] gpiolib: Use srcu_barrier() instead of synchronize_srcu() in gpiodev_release() Zqiang
2026-11-26  8:42 ` [PATCH] gpiolib: Use srcu_dereference() in gpiod_get_label() Zqiang
2026-11-26  8:52 ` sashiko-bot [this message]

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=sashiko-outbox-235059@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=qiang.zhang@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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