freebsd-skq/sys/riscv
Mitchell Horne 958a094323 Enable interrupts while handling traps
I observed hangs post-r362977 in QEMU with -smp 2, in which one thread
would acquire write access to an rm_lock (sysctllock) and get stuck
waiting in smp_rendezvous_cpus while the other CPU was servicing a trap.
The other thread was waiting for read access to the same lock, thus
causing deadlock.

It's clear that this is just one symptom of a larger problem. The
general expectation of MI kernel code is that interrupts are enabled.
Violating this assumption will at best create some additional latency,
but otherwise might cause locking or other unforeseen issues. All other
architectures do so for some subset of trap values, but this somehow got
missed in the RISC-V port. Enable interrupts now during kernel page
faults and for all user trap types.

The code in exception.S already knows to disable interrupts while
handling the return from exception, so there are no changes required
there.

Reviewed by:	jhb, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26017
2020-08-13 14:21:05 +00:00
..
conf Add DDB_CTF to the arm64 and riscv kernel configs 2020-08-05 11:54:51 +00:00
include Use uintptr_t instead of uint64_t for pointers in stack frames. 2020-08-12 20:29:49 +00:00
riscv Enable interrupts while handling traps 2020-08-13 14:21:05 +00:00
sifive riscv/sifive: add FE310 Always-on driver 2020-04-02 00:33:15 +00:00