Messages in this thread | | | From | Yuyang Du <> | Date | Fri, 26 Apr 2019 14:45:31 +0800 | 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@infradead.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.
| |