Commit e616cb8d authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner
Browse files

lockdep: Always inline lockdep_{off,on}()



These functions are called {early,late} in nmi_{enter,exit} and should
not be traced or probed. They are also puny, so 'inline' them.

Reported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarAlexandre Chartre <alexandre.chartre@oracle.com>
Link: https://lkml.kernel.org/r/20200505134101.048523500@linutronix.de
parent 69ea03b5
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -308,8 +308,27 @@ extern void lockdep_set_selftest_task(struct task_struct *task);

extern void lockdep_init_task(struct task_struct *task);

extern void lockdep_off(void);
extern void lockdep_on(void);
/*
 * Split the recrursion counter in two to readily detect 'off' vs recursion.
 */
#define LOCKDEP_RECURSION_BITS	16
#define LOCKDEP_OFF		(1U << LOCKDEP_RECURSION_BITS)
#define LOCKDEP_RECURSION_MASK	(LOCKDEP_OFF - 1)

/*
 * lockdep_{off,on}() are macros to avoid tracing and kprobes; not inlines due
 * to header dependencies.
 */

#define lockdep_off()					\
do {							\
	current->lockdep_recursion += LOCKDEP_OFF;	\
} while (0)

#define lockdep_on()					\
do {							\
	current->lockdep_recursion -= LOCKDEP_OFF;	\
} while (0)

extern void lockdep_register_key(struct lock_class_key *key);
extern void lockdep_unregister_key(struct lock_class_key *key);
+0 −19
Original line number Diff line number Diff line
@@ -393,25 +393,6 @@ void lockdep_init_task(struct task_struct *task)
	task->lockdep_recursion = 0;
}

/*
 * Split the recrursion counter in two to readily detect 'off' vs recursion.
 */
#define LOCKDEP_RECURSION_BITS	16
#define LOCKDEP_OFF		(1U << LOCKDEP_RECURSION_BITS)
#define LOCKDEP_RECURSION_MASK	(LOCKDEP_OFF - 1)

void lockdep_off(void)
{
	current->lockdep_recursion += LOCKDEP_OFF;
}
EXPORT_SYMBOL(lockdep_off);

void lockdep_on(void)
{
	current->lockdep_recursion -= LOCKDEP_OFF;
}
EXPORT_SYMBOL(lockdep_on);

static inline void lockdep_recursion_finish(void)
{
	if (WARN_ON_ONCE(--current->lockdep_recursion))