RISC-V updates for v5.4-rc3

Some RISC-V fixes for v5.4-rc3:
 
 - Fix several bugs in the breakpoint trap handler
 
 - Drop an unnecessary loop around calls to preempt_schedule_irq()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEElRDoIDdEz9/svf2Kx4+xDQu9KksFAl2iMdsACgkQx4+xDQu9
 KkvoEhAAkvtzyQKqV0SSsJLA9XxTUYqUYf+lJkG39uj/Bn6W/LdIvzXRZ3t8ZIiZ
 VQq4Uof+KOQshDCfiUTFHaeEG21CzXW7DBdrq0SxfKmBpSWnS30fjUFaOVN7BhQK
 AehWwSADgd/z2y9Rwa7j3NmfOQOdBYIme13dY1gP2VNHdy/dRymzYr2x1ynKUCF9
 JCIRw7ylTQUMx4ShUpH6i7txn8OlnTEkIOWjpcHPqxAbD9x7fyzHOnB9Pv3e2hm+
 F9Bq98jmxh0jfrplvKABiOGDhFYMrP7TMth+DSD01thfC5MnofhxCQVFxNEGTxJk
 fQmM2iztw5grBaAPLDIbialzsns5RIP6SCtpaxlJcK0EIYB4mvjc+9wWj+kd/4VC
 QY6wW4AIwt/LZHwRbbCoUXHWqDS1dMg7VBC3UtXqkI5ftoNM9ha72Nd//jEpxJmw
 Y/Q2YBzHUcXqvIUwdPHCVloLElucmWL9kyQhnA2pJx9m2iYh6Jl2NO3kfHhSuicB
 FL4+YQpUuCMh1UvMYc6KxY+eOFiGjUZB7Jv3GDBCuSJydCcHpfF1jALNyK2mTV92
 Rrx89bEMufSNXcmEFIKO9sHwfnruTL05KHF/hMMTTtTCMqMHfIiAKPRWuw/ZcIhj
 +2X8+acjLgqp/gPMYihfmBhRix3caKsF5ffV13Q04mQf6TuAPoQ=
 =TYAz
 -----END PGP SIGNATURE-----

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:
Linus Torvalds 2019-10-12 14:25:38 -07:00
commit 48acba989e
2 changed files with 8 additions and 9 deletions

View File

@ -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:

View File

@ -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