1. 17 Sep, 2024 1 commit
    • Jinjie Ruan's avatar
      RISC-V: Implement kgdb_roundup_cpus() to enable future NMI Roundup · 983f1214
      Jinjie Ruan authored
      Until now, the generic weak kgdb_roundup_cpus() has been used for kgdb on
      RISCV. A custom one allows to debug CPUs that are stuck with interrupts
      disabled with NMI support in the future. And using an IPI is better than
      the generic one since it avoids the potential situation described in the
      generic kgdb_call_nmi_hook(). As Andrew pointed out, once there is NMI
      support, we can easily extend this and the CPU backtrace support
      to use NMIs.
      
      After this patch, the kgdb test show that:
      	# echo g > /proc/sysrq-trigger
      	[2]kdb> btc
      	btc: cpu status: Currently on cpu 2
      	Available cpus: 0-1(-), 2, 3(-)
      	Stack traceback for pid 0
      	0xffffffff81c13a40        0        0  1    0   -  0xffffffff81c14510  swapper/0
      	CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.10.0-g3120273055b6-dirty #51
      	Hardware name: riscv-virtio,qemu (DT)
      	Call Trace:
      	[<ffffffff80006c48>] dump_backtrace+0x28/0x30
      	[<ffffffff80fceb38>] show_stack+0x38/0x44
      	[<ffffffff80fe6a04>] dump_stack_lvl+0x58/0x7a
      	[<ffffffff80fe6a3e>] dump_stack+0x18/0x20
      	[<ffffffff801143fa>] kgdb_cpu_enter+0x682/0x6b2
      	[<ffffffff801144ca>] kgdb_nmicallback+0xa0/0xac
      	[<ffffffff8000a392>] handle_IPI+0x9c/0x120
      	[<ffffffff800a2baa>] handle_percpu_devid_irq+0xa4/0x1e4
      	[<ffffffff8009cca8>] generic_handle_domain_irq+0x28/0x36
      	[<ffffffff800a9e5c>] ipi_mux_process+0xe8/0x110
      	[<ffffffff806e1e30>] imsic_handle_irq+0xf8/0x13a
      	[<ffffffff8009cca8>] generic_handle_domain_irq+0x28/0x36
      	[<ffffffff806dff12>] riscv_intc_aia_irq+0x2e/0x40
      	[<ffffffff80fe6ab0>] handle_riscv_irq+0x54/0x86
      	[<ffffffff80ff2e4a>] call_on_irq_stack+0x32/0x40
      
      Rebased on Ryo Takakura's "RISC-V: Enable IPI CPU Backtrace" patch.
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Link: https://lore.kernel.org/r/20240727063438.886155-1-ruanjinjie@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      983f1214
  2. 16 Sep, 2024 8 commits
  3. 15 Sep, 2024 8 commits
  4. 14 Sep, 2024 2 commits
  5. 12 Sep, 2024 9 commits
  6. 03 Sep, 2024 2 commits
  7. 15 Aug, 2024 2 commits
  8. 14 Aug, 2024 2 commits
  9. 07 Aug, 2024 1 commit
    • Ryo Takakura's avatar
      RISC-V: Enable IPI CPU Backtrace · f15c21a3
      Ryo Takakura authored
      Add arch_trigger_cpumask_backtrace() which is a generic infrastructure
      for sampling other CPUs' backtrace using IPI.
      
      The feature is used when lockups are detected or in case of oops/panic
      if parameters are set accordingly.
      
      Below is the case of oops with the oops_all_cpu_backtrace enabled.
      
      $ sysctl kernel.oops_all_cpu_backtrace=1
      
      triggering oops shows:
      [  212.214237] NMI backtrace for cpu 1
      [  212.214390] CPU: 1 PID: 610 Comm: in:imklog Tainted: G           OE      6.10.0-rc6 #1
      [  212.214570] Hardware name: riscv-virtio,qemu (DT)
      [  212.214690] epc : fallback_scalar_usercopy+0x8/0xdc
      [  212.214809]  ra : _copy_to_user+0x20/0x40
      [  212.214913] epc : ffffffff80c3a930 ra : ffffffff8059ba7e sp : ff20000000eabb50
      [  212.215061]  gp : ffffffff82066f90 tp : ff6000008e958000 t0 : 3463303866660000
      [  212.215210]  t1 : 000000000000005b t2 : 3463303866666666 s0 : ff20000000eabb60
      [  212.215358]  s1 : 0000000000000386 a0 : 00007ff6e81df926 a1 : ff600000824df800
      [  212.215505]  a2 : 000000000000003f a3 : 7fffffffffffffc0 a4 : 0000000000000000
      [  212.215651]  a5 : 000000000000003f a6 : 0000000000000000 a7 : 0000000000000000
      [  212.215857]  s2 : ff600000824df800 s3 : ffffffff82066cc0 s4 : 0000000000001c1a
      [  212.216074]  s5 : ffffffff8206a5a8 s6 : 00007ff6e81df926 s7 : ffffffff8206a5a0
      [  212.216278]  s8 : ff600000824df800 s9 : ffffffff81e25de0 s10: 000000000000003f
      [  212.216471]  s11: ffffffff8206a59d t3 : ff600000824df812 t4 : ff600000824df812
      [  212.216651]  t5 : ff600000824df818 t6 : 0000000000040000
      [  212.216796] status: 0000000000040120 badaddr: 0000000000000000 cause: 8000000000000001
      [  212.217035] [<ffffffff80c3a930>] fallback_scalar_usercopy+0x8/0xdc
      [  212.217207] [<ffffffff80095f56>] syslog_print+0x1f4/0x2b2
      [  212.217362] [<ffffffff80096e5c>] do_syslog.part.0+0x94/0x2d8
      [  212.217502] [<ffffffff800979e8>] do_syslog+0x66/0x88
      [  212.217636] [<ffffffff803a5dda>] kmsg_read+0x44/0x5c
      [  212.217764] [<ffffffff80392dbe>] proc_reg_read+0x7a/0xa8
      [  212.217952] [<ffffffff802ff726>] vfs_read+0xb0/0x24e
      [  212.218090] [<ffffffff803001ba>] ksys_read+0x64/0xe4
      [  212.218264] [<ffffffff8030025a>] __riscv_sys_read+0x20/0x2c
      [  212.218453] [<ffffffff80c4af9a>] do_trap_ecall_u+0x60/0x1d4
      [  212.218664] [<ffffffff80c56998>] ret_from_exception+0x0/0x64
      Signed-off-by: default avatarRyo Takakura <takakura@valinux.co.jp>
      Link: https://lore.kernel.org/r/20240718093659.158912-1-takakura@valinux.co.jpSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      f15c21a3
  10. 06 Aug, 2024 1 commit
  11. 05 Aug, 2024 4 commits