Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 2015 14:01:18 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287536 - head/sys/arm64/arm64
Message-ID:  <201509071401.t87E1IgI065372@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Sep  7 14:01:18 2015
New Revision: 287536
URL: https://svnweb.freebsd.org/changeset/base/287536

Log:
  Use load-acquire semantics while waiting for td_lock to be released. The
  store should have release semantics and will have due to the dsb above it
  so add a comment to explain this. [1]
  
  While here update the code to not reload the current thread, it's already
  in a register, we just need to not trash it.
  
  Suggested by:	kib [1]
  Sponsored by:	ABT Systems Ltd

Modified:
  head/sys/arm64/arm64/swtch.S

Modified: head/sys/arm64/arm64/swtch.S
==============================================================================
--- head/sys/arm64/arm64/swtch.S	Mon Sep  7 14:00:38 2015	(r287535)
+++ head/sys/arm64/arm64/swtch.S	Mon Sep  7 14:01:18 2015	(r287536)
@@ -160,17 +160,18 @@ ENTRY(cpu_switch)
 	dsb	sy
 	isb
 
-	/* Release the old thread */
+	/*
+	 * Release the old thread. This doesn't need to be a store-release
+	 * as the above dsb instruction will provide release semantics.
+	 */
 	str	x2, [x0, #TD_LOCK]
 #if defined(SCHED_ULE) && defined(SMP)
 	/* Read the value in blocked_lock */
 	ldr	x0, =_C_LABEL(blocked_lock)
-	ldr	x1, [x0]
-	/* Load curthread */
-	ldr	x2, [x18, #PC_CURTHREAD]
+	ldr	x2, [x0]
 1:
-	ldr	x3, [x2, #TD_LOCK]
-	cmp	x3, x1
+	ldar	x3, [x1, #TD_LOCK]
+	cmp	x3, x2
 	b.eq	1b
 #endif
 



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