Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash_core: use panic_try_start() in crash_kexec()

crash_kexec() had its own code to exclude parallel execution by setting
panic_cpu. This is already handled by panic_try_start(). Switch to
panic_try_start() to remove the duplication and keep the logic consistent.

Link: https://lkml.kernel.org/r/20250825022947.1596226-4-wangjinchao600@gmail.com
Signed-off-by: Jinchao Wang <wangjinchao600@gmail.com>
Cc: Anna Schumaker <anna.schumaker@oracle.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: Dave Young <dyoung@redhat.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Joanthan Cameron <Jonathan.Cameron@huawei.com>
Cc: Joel Granados <joel.granados@kernel.org>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Kees Cook <kees@kernel.org>
Cc: Li Huafei <lihuafei1@huawei.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Luo Gengkun <luogengkun@huaweicloud.com>
Cc: Max Kellermann <max.kellermann@ionos.com>
Cc: Nam Cao <namcao@linutronix.de>
Cc: oushixiong <oushixiong@kylinos.cn>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Qianqiang Liu <qianqiang.liu@163.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Sohil Mehta <sohil.mehta@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Cc: Thomas Zimemrmann <tzimmermann@suse.de>
Cc: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: Yunhui Cui <cuiyunhui@bytedance.com>
Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Jinchao Wang and committed by
Andrew Morton
33effbca f7998e7f

+3 -12
+3 -12
kernel/crash_core.c
··· 4 4 * Copyright (C) 2002-2004 Eric Biederman <ebiederm@xmission.com> 5 5 */ 6 6 7 + #include "linux/panic.h" 7 8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8 9 9 10 #include <linux/buildid.h> ··· 144 143 145 144 __bpf_kfunc void crash_kexec(struct pt_regs *regs) 146 145 { 147 - int old_cpu, this_cpu; 148 - 149 - /* 150 - * Only one CPU is allowed to execute the crash_kexec() code as with 151 - * panic(). Otherwise parallel calls of panic() and crash_kexec() 152 - * may stop each other. To exclude them, we use panic_cpu here too. 153 - */ 154 - old_cpu = PANIC_CPU_INVALID; 155 - this_cpu = raw_smp_processor_id(); 156 - 157 - if (atomic_try_cmpxchg(&panic_cpu, &old_cpu, this_cpu)) { 146 + if (panic_try_start()) { 158 147 /* This is the 1st CPU which comes here, so go ahead. */ 159 148 __crash_kexec(regs); 160 149 ··· 152 161 * Reset panic_cpu to allow another panic()/crash_kexec() 153 162 * call. 154 163 */ 155 - atomic_set(&panic_cpu, PANIC_CPU_INVALID); 164 + panic_reset(); 156 165 } 157 166 } 158 167