Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2019 14:32:17 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347226 - head/sys/riscv/riscv
Message-ID:  <201905071432.x47EWHYH012346@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905071432.x47EWHYH012346>