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
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to