Re: [PATCH v2] kcsan: Don't enter an nbcon emergency section for verbose reports
From: Breno Leitao
Date: Thu Nov 05 2026 - 05:44:30 EST
Hello Petr,
On Thu, Nov 05, 2026 at 10:59:59AM +0100, Petr Mladek wrote:
> And there seems to be one more lockdep-caller of
> print_irqtrace_events():
>
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -4649,6 +4649,8 @@ void lockdep_cleanup_dead_cpu(unsigned int cpu, struct task_struct *idle)
> if (unlikely(!debug_locks))
> return;
>
> + nbcon_cpu_emergency_enter();
> +
> if (unlikely(per_cpu(hardirqs_enabled, cpu))) {
> pr_warn("CPU %u left hardirqs enabled!", cpu);
> if (idle)
> @@ -4656,6 +4658,8 @@ void lockdep_cleanup_dead_cpu(unsigned int cpu, struct task_struct *idle)
> /* Clean it up for when the CPU comes online again. */
> per_cpu(hardirqs_enabled, cpu) = 0;
> }
> +
> + nbcon_cpu_emergency_enter();
> }
>
> static int
>
> What do you think, please?
If print_irqtrace_events() is going to be used both inside and outside
emergency sections, wouldn't it be cleaner to keep a variant that enters
the section itself, for check_flags(), instead of open-coding
nbcon_cpu_emergency_enter()/exit() around the call? Something similar to
this current patchset approach (maybe with a better function naming?)