• Guo Ren's avatar
    riscv: kexec: Fixup crash_smp_send_stop without multi cores · 9b932aad
    Guo Ren authored
    Current crash_smp_send_stop is the same as the generic one in
    kernel/panic and misses crash_save_cpu in percpu. This patch is inspired
    by 78fd584c ("arm64: kdump: implement machine_crash_shutdown()")
    and adds the same mechanism for riscv.
    
    Before this patch, test result:
    crash> help -r
    CPU 0: [OFFLINE]
    
    CPU 1:
    epc : ffffffff80009ff0 ra : ffffffff800b789a sp : ff2000001098bb40
     gp : ffffffff815fca60 tp : ff60000004680000 t0 : 6666666666663c5b
     t1 : 0000000000000000 t2 : 666666666666663c s0 : ff2000001098bc90
     s1 : ffffffff81600798 a0 : ff2000001098bb48 a1 : 0000000000000000
     a2 : 0000000000000000 a3 : 0000000000000001 a4 : 0000000000000000
     a5 : ff60000004690800 a6 : 0000000000000000 a7 : 0000000000000000
     s2 : ff2000001098bb48 s3 : ffffffff81093ec8 s4 : ffffffff816004ac
     s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80e7f720
     s8 : 00fffffffffff3f0 s9 : 0000000000000007 s10: 00aaaaaaaab98700
     s11: 0000000000000001 t3 : ffffffff819a8097 t4 : ffffffff819a8097
     t5 : ffffffff819a8098 t6 : ff2000001098b9a8
    
    CPU 2: [OFFLINE]
    
    CPU 3: [OFFLINE]
    
    After this patch, test result:
    crash> help -r
    CPU 0:
    epc : ffffffff80003f34 ra : ffffffff808caa7c sp : ffffffff81403eb0
     gp : ffffffff815fcb48 tp : ffffffff81413400 t0 : 0000000000000000
     t1 : 0000000000000000 t2 : 0000000000000000 s0 : ffffffff81403ec0
     s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000
     a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
     a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
     s2 : ffffffff816001c8 s3 : ffffffff81600370 s4 : ffffffff80c32e18
     s5 : ffffffff819d3018 s6 : ffffffff810e2110 s7 : 0000000000000000
     s8 : 0000000000000000 s9 : 0000000080039eac s10: 0000000000000000
     s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
     t5 : 0000000000000000 t6 : 0000000000000000
    
    CPU 1:
    epc : ffffffff80003f34 ra : ffffffff808caa7c sp : ff2000000068bf30
     gp : ffffffff815fcb48 tp : ff6000000240d400 t0 : 0000000000000000
     t1 : 0000000000000000 t2 : 0000000000000000 s0 : ff2000000068bf40
     s1 : 0000000000000001 a0 : 0000000000000000 a1 : 0000000000000000
     a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
     a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
     s2 : ffffffff816001c8 s3 : ffffffff81600370 s4 : ffffffff80c32e18
     s5 : ffffffff819d3018 s6 : ffffffff810e2110 s7 : 0000000000000000
     s8 : 0000000000000000 s9 : 0000000080039ea8 s10: 0000000000000000
     s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
     t5 : 0000000000000000 t6 : 0000000000000000
    
    CPU 2:
    epc : ffffffff80003f34 ra : ffffffff808caa7c sp : ff20000000693f30
     gp : ffffffff815fcb48 tp : ff6000000240e900 t0 : 0000000000000000
     t1 : 0000000000000000 t2 : 0000000000000000 s0 : ff20000000693f40
     s1 : 0000000000000002 a0 : 0000000000000000 a1 : 0000000000000000
     a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
     a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
     s2 : ffffffff816001c8 s3 : ffffffff81600370 s4 : ffffffff80c32e18
     s5 : ffffffff819d3018 s6 : ffffffff810e2110 s7 : 0000000000000000
     s8 : 0000000000000000 s9 : 0000000080039eb0 s10: 0000000000000000
     s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
     t5 : 0000000000000000 t6 : 0000000000000000
    
    CPU 3:
    epc : ffffffff8000a1e4 ra : ffffffff800b7bba sp : ff200000109bbb40
     gp : ffffffff815fcb48 tp : ff6000000373aa00 t0 : 6666666666663c5b
     t1 : 0000000000000000 t2 : 666666666666663c s0 : ff200000109bbc90
     s1 : ffffffff816007a0 a0 : ff200000109bbb48 a1 : 0000000000000000
     a2 : 0000000000000000 a3 : 0000000000000001 a4 : 0000000000000000
     a5 : ff60000002c61c00 a6 : 0000000000000000 a7 : 0000000000000000
     s2 : ff200000109bbb48 s3 : ffffffff810941a8 s4 : ffffffff816004b4
     s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80e7f7a0
     s8 : 00fffffffffff3f0 s9 : 0000000000000007 s10: 00aaaaaaaab98700
     s11: 0000000000000001 t3 : ffffffff819a8097 t4 : ffffffff819a8097
     t5 : ffffffff819a8098 t6 : ff200000109bb9a8
    
    Fixes: ad943893 ("RISC-V: Fixup schedule out issue in machine_crash_shutdown()")
    Reviewed-by: default avatarXianting Tian <xianting.tian@linux.alibaba.com>
    Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
    Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
    Cc: Nick Kossifidis <mick@ics.forth.gr>
    Link: https://lore.kernel.org/r/20221020141603.2856206-3-guoren@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
    9b932aad
smp.h 2.35 KB