Merge tag 'riscv/for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley: - Fix several bugs in the breakpoint trap handler - Drop an unnecessary loop around calls to preempt_schedule_irq() * tag 'riscv/for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: RISC-V: entry: Remove unneeded need_resched() loop riscv: Correct the handling of unexpected ebreak in do_trap_break() riscv: avoid sending a SIGTRAP to a user thread trapped in WARN() riscv: avoid kernel hangs when trapped in BUG()
This commit is contained in:
@@ -273,12 +273,11 @@ restore_all:
|
||||
resume_kernel:
|
||||
REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
|
||||
bnez s0, restore_all
|
||||
need_resched:
|
||||
REG_L s0, TASK_TI_FLAGS(tp)
|
||||
andi s0, s0, _TIF_NEED_RESCHED
|
||||
beqz s0, restore_all
|
||||
call preempt_schedule_irq
|
||||
j need_resched
|
||||
j restore_all
|
||||
#endif
|
||||
|
||||
work_pending:
|
||||
|
||||
@@ -124,24 +124,24 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
|
||||
|
||||
asmlinkage void do_trap_break(struct pt_regs *regs)
|
||||
{
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
if (!user_mode(regs)) {
|
||||
enum bug_trap_type type;
|
||||
|
||||
type = report_bug(regs->sepc, regs);
|
||||
switch (type) {
|
||||
case BUG_TRAP_TYPE_NONE:
|
||||
break;
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
case BUG_TRAP_TYPE_WARN:
|
||||
regs->sepc += get_break_insn_length(regs->sepc);
|
||||
break;
|
||||
return;
|
||||
case BUG_TRAP_TYPE_BUG:
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
default:
|
||||
die(regs, "Kernel BUG");
|
||||
}
|
||||
} else {
|
||||
force_sig_fault(SIGTRAP, TRAP_BRKPT,
|
||||
(void __user *)(regs->sepc));
|
||||
}
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)(regs->sepc));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
|
||||
Reference in New Issue
Block a user