On Tue, 05 May 2020 15:16:26 +0200
Thomas Gleixner <[email protected]> wrote:
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -3639,9 +3639,6 @@ static void __trace_hardirqs_on_caller(u
>  {
>       struct task_struct *curr = current;
>  
> -     /* we'll do an OFF -> ON transition: */
> -     curr->hardirqs_enabled = 1;
> -
>       /*
>        * We are going to turn hardirqs on, so set the
>        * usage bit for all held locks:
> @@ -3653,16 +3650,13 @@ static void __trace_hardirqs_on_caller(u
>        * bit for all held locks. (disabled hardirqs prevented
>        * this bit from being set before)
>        */
> -     if (curr->softirqs_enabled)
> +     if (curr->softirqs_enabled) {
>               if (!mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ))
>                       return;

The above can be turned into:

        if (curr->softirqs_enabled)
                mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ);

No need for the condition or the return.


> -
> -     curr->hardirq_enable_ip = ip;
> -     curr->hardirq_enable_event = ++curr->irq_events;
> -     debug_atomic_inc(hardirqs_on_events);
> +     }
>  }
>  
> -void lockdep_hardirqs_on(unsigned long ip)
> +void lockdep_hardirqs_on_prepare(unsigned long ip)
>  {
>       if (unlikely(!debug_locks || current->lockdep_recursion))
>               return;
> @@ -3698,20 +3692,62 @@ void lockdep_hardirqs_on(unsigned long i
>       if (DEBUG_LOCKS_WARN_ON(current->hardirq_context))
>               return;
>  
> +     current->hardirq_chain_key = current->curr_chain_key;
> +
>       current->lockdep_recursion++;
>       __trace_hardirqs_on_caller(ip);
>       lockdep_recursion_finish();
>  }
> -NOKPROBE_SYMBOL(lockdep_hardirqs_on);
> +EXPORT_SYMBOL_GPL(lockdep_hardirqs_on_prepare);
> +
> +void noinstr lockdep_hardirqs_on(unsigned long ip)
> +{

Would be nice to have some kerneldoc explaining the difference between
lockdep_hardirqs_on_prepare() and lockdep_hardirqs_on().

-- Steve

Reply via email to