Page MenuHomeFreeBSD

LinuxKPI: avoid userret: Returning with with pinned thread
ClosedPublic

Authored by bz on Jun 9 2021, 7:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 2 2024, 10:56 AM
Unknown Object (File)
Oct 1 2024, 5:00 AM
Unknown Object (File)
Sep 30 2024, 3:51 AM
Unknown Object (File)
Sep 29 2024, 3:29 PM
Unknown Object (File)
Sep 27 2024, 11:28 PM
Unknown Object (File)
Sep 19 2024, 12:02 PM
Unknown Object (File)
Sep 18 2024, 9:31 PM
Unknown Object (File)
Sep 13 2024, 6:30 PM

Details

Summary

Some code manually calls local_bh_disable() and spin_lock() but
then calls spin_unlock_bh() (or vice versa).
Our code then calls local_bh_disable() again from spin_lock()
which means we have the thread pin count increased twice and that
means we get out of synch and are still pinned when returning to
user space.

Avoid this by adding the explicit local_bh_{enable,disable}() to
the spin_[un]lock_bh() versions.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Jun 9 2021, 7:13 PM
bz removed a subscriber: linuxkpi.

I am assuming the reason the sched_[un]pin() are in the spin_[un]lock() and not just in the _bh versions has its reason in Linux and not just in simplification as otherwise we could avoid the "double-pinning"?

I'd really love to get this one sorted quickly as well.

This revision is now accepted and ready to land.Jun 11 2021, 9:56 AM