Skip to content

Commit 28ea295

Browse files
committed
bugs/core: Reorganize fields in the first line of WARNING output, add ->comm[] output
With the introduction of the condition string as part of the 'file' string output of kernel warnings, the first line has become a bit harder to read: WARNING: CPU: 0 PID: 0 at [ptr == 0 && 1] kernel/sched/core.c:8511 sched_init+0x20/0x410 Re-order the fields by importance (higher to lower), make the 'at' meaningful again, and add '->comm[]' output which is often more valuable than a PID. Also, remove the 'PID' prefix - in combination with comm it's clear what it is. These changes make the output only slightly longer: WARNING: [ptr == 0 && 1] kernel/sched/core.c:8511 at sched_init+0x20/0x410 CPU#0: swapper/0 While adding more information and making it better organized. Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> # Rebased ancestor commits Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-arch@vger.kernel.org Link: https://lore.kernel.org/r/20250515124644.2958810-16-mingo@kernel.org
1 parent be2ba2f commit 28ea295

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

kernel/panic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,15 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
753753

754754
disable_trace_on_warning();
755755

756-
if (file)
757-
pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
758-
raw_smp_processor_id(), current->pid, file, line,
759-
caller);
760-
else
761-
pr_warn("WARNING: CPU: %d PID: %d at %pS\n",
762-
raw_smp_processor_id(), current->pid, caller);
756+
if (file) {
757+
pr_warn("WARNING: %s:%d at %pS, CPU#%d: %s/%d\n",
758+
file, line, caller,
759+
raw_smp_processor_id(), current->comm, current->pid);
760+
} else {
761+
pr_warn("WARNING: at %pS, CPU#%d: %s/%d\n",
762+
caller,
763+
raw_smp_processor_id(), current->comm, current->pid);
764+
}
763765

764766
#pragma GCC diagnostic push
765767
#ifndef __clang__

0 commit comments

Comments
 (0)