[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180223113643.GX25201@hirez.programming.kicks-ass.net>
Date: Fri, 23 Feb 2018 12:36:43 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Andrea Parri <parri.andrea@...il.com>
Subject: Re: [RFC tip/locking/lockdep v5 08/17] lockdep: Fix recursive read
lock related safe->unsafe detection
On Fri, Feb 23, 2018 at 04:58:12PM +0800, Boqun Feng wrote:
> Hmm... think again, maybe I can combine case 1 with 3, and case 2 with
> 4, because each of them could share the same find_usage_backwards(), and
> find_usage_forwards() uses a usage_match_forwards() as follow for the
> match function:
>
> static inline int usage_match_forwards(struct lock_list *entry, void *bit)
> {
> enum lock_usage_bit ub = (enum lock_usage_bit)bit;
> unsigned long mask;
> unsigned long read_mask;
>
> /* mask out the read bit */
> ub &= ~1;
>
> mask = 1ULL << ub;
> read_mask = 1ULL << (ub + 1);
>
> return (entry->class->usage_mask & mask) || // *-> L2 and L2 is an irq-unsafe lock
> ((entry->class->usage_mask & read_mask) && !entry->is_rr); // N-> L2 and L2 is an irq-read-unsafe lock
> }
>
> Got a bus to catch, I can explain this later, if you need ;-)
Right, that's about what I was thinking of. Clearly that needs a wee
comment but it's much better.
Powered by blists - more mailing lists