Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2019 15:33:52 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r348622 - stable/12/sys/riscv/riscv
Message-ID:  <201906041533.x54FXqxB038327@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Tue Jun  4 15:33:52 2019
New Revision: 348622
URL: https://svnweb.freebsd.org/changeset/base/348622

Log:
  MFC r347226:
  
  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:
  stable/12/sys/riscv/riscv/machdep.c

Modified: stable/12/sys/riscv/riscv/machdep.c
==============================================================================
--- stable/12/sys/riscv/riscv/machdep.c	Tue Jun  4 15:32:56 2019	(r348621)
+++ stable/12/sys/riscv/riscv/machdep.c	Tue Jun  4 15:33:52 2019	(r348622)
@@ -460,11 +460,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?201906041533.x54FXqxB038327>