Xianting Tian
357628e68f
RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context
...
Use __smp_processor_id() to avoid check the preemption context when
CONFIG_DEBUG_PREEMPT enabled, as we will enter crash kernel and no
return.
Without the patch,
[ 103.781044] sysrq: Trigger a crash
[ 103.784625] Kernel panic - not syncing: sysrq triggered crash
[ 103.837634] CPU1: off
[ 103.889668] CPU2: off
[ 103.933479] CPU3: off
[ 103.939424] Starting crashdump kernel...
[ 103.943442] BUG: using smp_processor_id() in preemptible [00000000] code: sh/346
[ 103.950884] caller is debug_smp_processor_id+0x1c/0x26
[ 103.956051] CPU: 0 PID: 346 Comm: sh Kdump: loaded Not tainted 5.10.113-00002-gce03f03bf4ec-dirty #149
[ 103.965355] Call Trace:
[ 103.967805] [<ffffffe00020372a>] walk_stackframe+0x0/0xa2
[ 103.973206] [<ffffffe000bcf1f4>] show_stack+0x32/0x3e
[ 103.978258] [<ffffffe000bd382a>] dump_stack_lvl+0x72/0x8e
[ 103.983655] [<ffffffe000bd385a>] dump_stack+0x14/0x1c
[ 103.988705] [<ffffffe000bdc8fe>] check_preemption_disabled+0x9e/0xaa
[ 103.995057] [<ffffffe000bdc926>] debug_smp_processor_id+0x1c/0x26
[ 104.001150] [<ffffffe000206c64>] machine_kexec+0x22/0xd0
[ 104.006463] [<ffffffe000291a7e>] __crash_kexec+0x6a/0xa4
[ 104.011774] [<ffffffe000bcf3fa>] panic+0xfc/0x2b0
[ 104.016480] [<ffffffe000656ca4>] sysrq_reset_seq_param_set+0x0/0x70
[ 104.022745] [<ffffffe000657310>] __handle_sysrq+0x8c/0x154
[ 104.028229] [<ffffffe0006577e8>] write_sysrq_trigger+0x5a/0x6a
[ 104.034061] [<ffffffe0003d90e0>] proc_reg_write+0x58/0xd4
[ 104.039459] [<ffffffe00036cff4>] vfs_write+0x7e/0x254
[ 104.044509] [<ffffffe00036d2f6>] ksys_write+0x58/0xbe
[ 104.049558] [<ffffffe00036d36a>] sys_write+0xe/0x16
[ 104.054434] [<ffffffe000201b9a>] ret_from_syscall+0x0/0x2
[ 104.067863] Will call new kernel at ecc00000 from hart id 0
[ 104.074939] FDT image at fc5ee000
[ 104.079523] Bye...
With the patch we can got clear output,
[ 67.740553] sysrq: Trigger a crash
[ 67.744166] Kernel panic - not syncing: sysrq triggered crash
[ 67.809123] CPU1: off
[ 67.865210] CPU2: off
[ 67.909075] CPU3: off
[ 67.919123] Starting crashdump kernel...
[ 67.924900] Will call new kernel at ecc00000 from hart id 0
[ 67.932045] FDT image at fc5ee000
[ 67.935560] Bye...
Fixes: 0e105f1d0037 ("riscv: use hart id instead of cpu id on machine_kexec")
Reviewed-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220811074150.3020189-2-xianting.tian@linux.alibaba.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-11 08:54:32 -07:00
..
2022-04-26 13:36:53 -07:00
2021-10-27 11:21:49 -04:00
2022-04-26 13:36:53 -07:00
2020-03-25 11:50:48 +01:00
2022-05-11 21:36:33 -07:00
2022-03-10 09:29:31 -08:00
2021-09-01 10:29:10 +02:00
2022-05-17 16:37:21 -07:00
2022-04-26 13:36:25 -07:00
2022-03-31 12:44:32 -07:00
2022-01-20 09:27:08 -08:00
2022-01-20 09:27:16 -08:00
2022-02-10 09:16:50 -08:00
2022-05-21 12:20:04 -07:00
2022-06-04 14:04:27 -07:00
2022-04-29 14:37:59 -07:00
2021-04-26 08:25:23 -07:00
2020-10-02 14:31:16 -07:00
2022-05-28 11:39:31 +02:00
2022-05-19 12:19:03 -07:00
2022-04-26 13:36:31 -07:00
2019-11-05 09:20:42 -08:00
2022-05-26 21:13:00 -04:00
2022-01-20 09:27:16 -08:00
2022-06-01 21:46:23 -07:00
2021-02-18 23:18:00 -08:00
2020-06-09 19:11:24 -07:00
2020-07-30 11:37:43 -07:00
2022-01-09 10:38:06 -08:00
2020-07-09 20:09:30 -07:00
2022-05-19 12:14:18 -07:00
2022-08-11 08:54:32 -07:00
2022-05-19 16:26:50 -07:00
2021-01-14 15:09:05 -08:00
2021-04-26 08:25:01 -07:00
2019-10-28 00:46:01 -07:00
2022-05-11 21:36:31 -07:00
2022-04-22 08:29:24 -07:00
2022-03-30 23:01:42 -07:00
2020-11-09 18:12:34 +01:00
2022-06-03 16:03:05 -07:00
2022-05-17 16:37:22 -07:00
2022-05-19 19:30:30 +02:00
2020-12-10 17:27:54 -08:00
2022-02-14 12:27:45 -08:00
2022-06-01 22:03:50 -07:00
2022-05-17 16:37:21 -07:00
2022-01-09 12:13:31 -08:00
2022-05-11 21:36:32 -07:00
2021-01-07 19:00:50 -08:00
2022-03-30 15:15:27 -07:00
2022-05-25 14:43:33 -07:00
2022-03-10 09:29:31 -08:00
2022-04-26 13:36:25 -07:00
2021-10-02 13:42:23 -07:00
2021-05-06 09:24:18 -07:00
2022-02-24 20:30:30 -08:00
2022-02-24 20:30:30 -08:00
2020-04-03 10:45:33 -07:00
2022-05-11 21:36:31 -07:00
2022-05-25 17:24:06 -07:00
2022-01-05 17:53:37 -08:00
2022-01-05 17:53:37 -08:00