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)
Fri, Apr 19, 6:24 AM
Unknown Object (File)
Mar 21 2024, 11:02 PM
Unknown Object (File)
Mar 5 2024, 5:12 PM
Unknown Object (File)
Feb 5 2024, 4:09 AM
Unknown Object (File)
Dec 20 2023, 12:26 AM
Unknown Object (File)
Dec 12 2023, 1:30 PM
Unknown Object (File)
Nov 30 2023, 7:06 AM
Unknown Object (File)
Nov 12 2023, 3:49 AM

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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 39824
Build 36713: arc lint + arc unit

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