Re: [PATCH] lockdep: call time_hardirqs_off after clearing hardirqs_enabled

From: Steven Rostedt
Date: Mon Mar 13 2017 - 23:04:59 EST


On Tue, 14 Mar 2017 10:00:07 +0800
Qi Hou <qi.hou@xxxxxxxxxxxxx> wrote:

> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 577f026..e8b35e4 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -2627,8 +2627,6 @@ __visible void trace_hardirqs_off_caller(unsigned long ip)
> {
> struct task_struct *curr = current;
>
> - time_hardirqs_off(CALLER_ADDR0, ip);
> -
> if (unlikely(!debug_locks || current->lockdep_recursion))
> return;

You do realize that this breaks irqsoff tracing if lockdep ever
triggers. Right?

-- Steve

>
> @@ -2649,6 +2647,8 @@ __visible void trace_hardirqs_off_caller(unsigned long ip)
> debug_atomic_inc(hardirqs_off_events);
> } else
> debug_atomic_inc(redundant_hardirqs_off);
> +
> + time_hardirqs_off(CALLER_ADDR0, ip);
> }
> EXPORT_SYMBOL(trace_hardirqs_off_caller);
>