Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch comments



details:   https://anonhg.NetBSD.org/src/rev/8f015528e7d1
branches:  trunk
changeset: 932905:8f015528e7d1
user:      ad <ad%NetBSD.org@localhost>
date:      Sun May 17 12:11:11 2020 +0000

description:
comments

diffstat:

 sys/arch/amd64/amd64/spl.S |   9 +++++++--
 sys/arch/i386/i386/spl.S   |  14 ++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 7c96dcb3def1 -r 8f015528e7d1 sys/arch/amd64/amd64/spl.S
--- a/sys/arch/amd64/amd64/spl.S        Sun May 17 11:54:39 2020 +0000
+++ b/sys/arch/amd64/amd64/spl.S        Sun May 17 12:11:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spl.S,v 1.45 2020/05/02 11:12:49 maxv Exp $    */
+/*     $NetBSD: spl.S,v 1.46 2020/05/17 12:11:11 ad Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -157,7 +157,12 @@
        movq    L_PCB(%r15),%rcx
        movq    PCB_RSP(%rcx),%rsp
 
-       xchgq   %r15,CPUVAR(CURLWP)     /* must be globally visible */
+       /*
+        * for non-interlocked mutex release to work safely the change
+        * to ci_curlwp must not languish in the store buffer. therefore
+        * we use XCHG and not MOV here.  see kern_mutex.c.
+        */
+       xchgq   %r15,CPUVAR(CURLWP)     /* restore curlwp */
        popq    %r15                    /* unwind switchframe */
        addq    $(5 * 8),%rsp
        jmp     *%r13                   /* back to Xspllower/Xdoreti */
diff -r 7c96dcb3def1 -r 8f015528e7d1 sys/arch/i386/i386/spl.S
--- a/sys/arch/i386/i386/spl.S  Sun May 17 11:54:39 2020 +0000
+++ b/sys/arch/i386/i386/spl.S  Sun May 17 12:11:11 2020 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: spl.S,v 1.54 2020/05/01 09:40:47 maxv Exp $    */
+/*     $NetBSD: spl.S,v 1.55 2020/05/17 12:12:22 ad Exp $      */
 
 /*
- * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.54 2020/05/01 09:40:47 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.55 2020/05/17 12:12:22 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -359,7 +359,13 @@
        CLI(%ecx)
        movl    L_PCB(%esi),%ecx
        movl    PCB_ESP(%ecx),%esp
-       xchgl   %esi,CPUVAR(CURLWP)     /* must be globally visible */
+
+       /*
+        * for non-interlocked mutex release to work safely the change
+        * to ci_curlwp must not languish in the store buffer. therefore
+        * we use XCHG and not MOV here.  see kern_mutex.c.
+        */
+       xchgl   %esi,CPUVAR(CURLWP)     /* restore ci_curlwp */
        popl    %edi                    /* unwind switchframe */
        popl    %esi
        addl    $8,%esp



Home | Main Index | Thread Index | Old Index