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();
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to