lkml.org 
[lkml]   [2020]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 01/27] lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions
On Fri, Feb 21, 2020 at 10:08:55AM -0500, Steven Rostedt wrote:
> On Fri, 21 Feb 2020 14:34:17 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
>
> > --- a/kernel/locking/lockdep.c
> > +++ b/kernel/locking/lockdep.c
> > @@ -379,13 +379,13 @@ void lockdep_init_task(struct task_struc
> >
> > void lockdep_off(void)
> > {
> > - current->lockdep_recursion++;
> > + current->lockdep_recursion += BIT(16);
> > }
> > EXPORT_SYMBOL(lockdep_off);
> >
> > void lockdep_on(void)
> > {
> > - current->lockdep_recursion--;
> > + current->lockdep_recursion -= BIT(16);
> > }
> > EXPORT_SYMBOL(lockdep_on);
> >
>
> > +
> > +static bool lockdep_nmi(void)
> > +{
> > + if (current->lockdep_recursion & 0xFFFF)
>
> Nitpick, but the association with bit 16 and this mask really should be
> defined as a macro somewhere and not have hard coded numbers.

Right, I suppose I can do something like:

#define LOCKDEP_RECURSION_BITS 16
#define LOCKDEP_OFF (1U << LOCKDEP_RECURSION_BITS)
#define LOCKDEP_RECURSION_MASK (LOCKDEP_OFF - 1)


\
 
 \ /
  Last update: 2020-02-21 21:26    [W:0.326 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site