svn commit: r347226 - head/sys/riscv/riscv
Ruslan Bukin
br at FreeBSD.org
Tue May 7 14:32:18 UTC 2019
Author: br
Date: Tue May 7 14:32:17 2019
New Revision: 347226
URL: https://svnweb.freebsd.org/changeset/base/347226
Log:
Disable interrupts first and then set spinlock_count to 1.
Otherwise interrupt can be generated just after setting spinlock_count
and before disabling interrupts.
Sponsored by: DARPA, AFRL
Modified:
head/sys/riscv/riscv/machdep.c
Modified: head/sys/riscv/riscv/machdep.c
==============================================================================
--- head/sys/riscv/riscv/machdep.c Tue May 7 13:41:43 2019 (r347225)
+++ head/sys/riscv/riscv/machdep.c Tue May 7 14:32:17 2019 (r347226)
@@ -457,11 +457,13 @@ void
spinlock_enter(void)
{
struct thread *td;
+ register_t reg;
td = curthread;
if (td->td_md.md_spinlock_count == 0) {
+ reg = intr_disable();
td->td_md.md_spinlock_count = 1;
- td->td_md.md_saved_sstatus_ie = intr_disable();
+ td->td_md.md_saved_sstatus_ie = reg;
} else
td->td_md.md_spinlock_count++;
critical_enter();
More information about the svn-src-all
mailing list