Re: [tip: locking/urgent] locking/ww_mutex: Treat ww_mutex_lock() like a trylock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip: locking/urgent] locking/ww_mutex: Treat ww_mutex_lock() like a trylock
- From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Date: Wed, 17 Mar 2021 14:31:15 +0100
- Cc: linux-tip-commits@xxxxxxxxxxxxxxx, Waiman Long <longman@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, x86@xxxxxxxxxx
- In-reply-to: <YFIASRkXowQWgj2s@hirez.programming.kicks-ass.net>
- References: <20210316153119.13802-4-longman@redhat.com> <161598470197.398.8903908266426306140.tip-bot2@tip-bot2> <YFIASRkXowQWgj2s@hirez.programming.kicks-ass.net>
On Wed, Mar 17, 2021 at 02:12:41PM +0100, Peter Zijlstra wrote:
> On Wed, Mar 17, 2021 at 12:38:21PM -0000, tip-bot2 for Waiman Long wrote:
> > + /*
> > + * Treat as trylock for ww_mutex.
> > + */
> > + mutex_acquire_nest(&lock->dep_map, subclass, !!ww_ctx, nest_lock, ip);
>
> I'm confused... why isn't nest_lock working here?
>
> For ww_mutex, we're supposed to have ctx->dep_map as a nest_lock, and
> all lock acquisitions under a nest lock should be fine. Afaict the above
> is just plain wrong.
To clarify:
mutex_lock(&A); ww_mutex_lock(&B, ctx);
ww_mutex_lock(&B, ctx); mutex_lock(&A);
should still very much be a deadlock, but your 'fix' makes it not report
that.
Only order within the ww_ctx can be ignored, and that's exactly what
nest_lock should be doing.
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]