[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHttsrZhg9tF_dng0LEqszYaK6Y48pyKAYKLAa+yZTkgQQaBXA@mail.gmail.com>
Date: Fri, 26 Apr 2019 14:45:31 +0800
From: Yuyang Du <duyuyang@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: will.deacon@....com, Ingo Molnar <mingo@...nel.org>,
Bart Van Assche <bvanassche@....org>, ming.lei@...hat.com,
Frederic Weisbecker <frederic@...nel.org>, tglx@...utronix.de,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 23/28] locking/lockdep: Update irqsafe lock bitmaps
Thanks for review.
On Fri, 26 Apr 2019 at 03:55, Peter Zijlstra <peterz@...radead.org> wrote:
> > + if (!dir) {
> > + unsigned long *bitmaps[4] = {
> > + lock_classes_hardirq_safe,
> > + lock_classes_hardirq_safe_read,
> > + lock_classes_softirq_safe,
> > + lock_classes_softirq_safe_read
>
> That again should be something CPP magic using lockdep_states.h.
Yes.
> Also, that array can be static const, right? It's just an index into the
> static bitmaps.
Sure.
[...]
> > +static inline void remove_irqsafe_lock_bitmap(struct lock_class *class)
> > +{
> > +#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
> > + unsigned long usage = class->usage_mask;
> > +
> > + if (usage & LOCKF_USED_IN_HARDIRQ)
> > + __clear_bit(class - lock_classes, lock_classes_hardirq_safe);
> > + if (usage & LOCKF_USED_IN_HARDIRQ_READ)
> > + __clear_bit(class - lock_classes, lock_classes_hardirq_safe_read);
> > + if (usage & LOCKF_USED_IN_SOFTIRQ)
> > + __clear_bit(class - lock_classes, lock_classes_softirq_safe);
> > + if (usage & LOCKF_USED_IN_SOFTIRQ_READ)
> > + __clear_bit(class - lock_classes, lock_classes_softirq_safe_read);
>
> More CPP foo required here.
Definitely.
> Also, do we really need to test, we could
> just unconditionally clear the bits.
Actually, these tests are used later for another cause: we want to
know which safe usage may be changed by zapping this lock.
Powered by blists - more mailing lists