Skip to content

gpiolib: Don't bypass SRCU when CONFIG_LOCKDEP is enabled - #7548

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
mairacanal:gpio/downstream/lockdep
Aug 12, 2026
Merged

gpiolib: Don't bypass SRCU when CONFIG_LOCKDEP is enabled#7548
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
mairacanal:gpio/downstream/lockdep

Conversation

@mairacanal

Copy link
Copy Markdown
Contributor

Commit 6c96741 ("gpiolib: Avoid the hotplug performance reduction") stubs out gpiolib's SRCU read-side locking to recover the throughput lost to the hotplug interlock. That trade-off is deliberate, but it leaves the core's lockdep_assert_held(&gc->gpiodev->srcu) checks in place while the lock is never actually taken. Since those are WARN_ON(), every GPIO access splats with CONFIG_LOCKDEP=y and the log fills up with backtraces.

Therefore, only enable REJECT_HOTPLUG_TAX when CONFIG_LOCKDEP is disabled. This way, the optimisation is kept for production builds, but developers can still debug the kernel with lockdep enabled.


I found this issue while testing the DRM scheduler series for VC4 with LOCKDEP enabled. This commit might be useful for other RPi developers in the kernel, but I can understand that it also brings the maintenance cost of increasing the delta to upstream. If you believe that it's not worth the cost, feel free to close this MR.

Commit 6c96741 ("gpiolib: Avoid the hotplug performance reduction")
stubs out gpiolib's SRCU read-side locking to recover the throughput lost
to the hotplug interlock. That trade-off is deliberate, but it leaves the
core's lockdep_assert_held(&gc->gpiodev->srcu) checks in place while the
lock is never actually taken. Since those are WARN_ON(), every GPIO access
splats with CONFIG_LOCKDEP=y and the log fills up with backtraces.

Therefore, only enable REJECT_HOTPLUG_TAX when CONFIG_LOCKDEP is
disabled. This way, the optimisation is kept for production builds, but
developers can still debug the kernel with lockdep enabled.

Fixes: 6c96741 ("gpiolib: Avoid the hotplug performance reduction")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
@nbuchwitz

Copy link
Copy Markdown
Contributor

Funny, I've stumbled over this very same issue last week with a colleague. In order to reduce the initial penalty upstream I'm currently testing something like this nbuchwitz@1ed0cf1

Testing shows that this at least halves the penalty, but probably has other caveats. Happy to keep you in the loop once / if I send the patches.

@pelwell pelwell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pragmatic solution, and easy to understand.

@pelwell
pelwell merged commit ce0873c into raspberrypi:rpi-6.18.y Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants