On Wed, Jan 15, 2020 at 03:33:47PM +0100, Peter Zijlstra wrote: > On Wed, Jan 15, 2020 at 09:24:28AM -0400, Jason Gunthorpe wrote: > > > I was interested because you are talking about allowing the read/write side > > of a rw sem to be held across a return to user space/etc, which is the > > same basic problem. > > No it is not; allowing the lock to be held across userspace doesn't > change the owner. This is a crucial difference, PI depends on there > being a distinct owner. That said, allowing the lock to be held across > userspace still breaks PI in that it completely wrecks the ability to > analyze the critical section. Thinking about this from a PI point of view, the problem is not that we returned to userspace still holding the lock, it's that boosting this process's priority will not help release the lock faster because this process no longer owns the lock. If we had a lock owner handoff API (ie I can donate my lock to another owner), that would solve this problem. We'd want to have special owners to denote "RCU" "bottom halves" or "irq" so we know what we can do about PI. I don't think we need a "I have stolen this lock from somebody else" API, but maybe I'm wrong there.