Module Name:    src
Committed By:   riastradh
Date:           Sun Feb 27 19:22:03 UTC 2022

Modified Files:
        src/sys/arch/mips/include: asm.h
        src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Omit needless SYNC in mutex_exit.

This change deletes a memory barrier.  However, it should be safe:
The semantic requirement for this is already provided by the SYNC_REL
above, before the ll.  And as currently defined, SYNC_REL is at least
as strong as SYNC, so this change can't hurt correctness on its own
(barring CPU errata, which would apply to other users of SYNC_REL and
can be addressed in the definition of SYNC_REL).

Later, perhaps we can relax SYNC_REL to syncw on Octeon if we prove
that it is correct (e.g., if Octeon follows the SPARCv9 partial store
order semantics).

Nix now-unused SYNC macro in asm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/mips/lock_stubs_llsc.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.66 src/sys/arch/mips/include/asm.h:1.67
--- src/sys/arch/mips/include/asm.h:1.66	Sun Feb 27 19:21:53 2022
+++ src/sys/arch/mips/include/asm.h	Sun Feb 27 19:22:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.66 2022/02/27 19:21:53 riastradh Exp $	*/
+/*	$NetBSD: asm.h,v 1.67 2022/02/27 19:22:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -574,7 +574,6 @@ _C_LABEL(x):
 #if defined(__OCTEON__)
 				/* early cnMIPS have erratum which means 2 */
 #define	LLSCSYNC	sync 4; sync 4
-#define	SYNC		sync 4		/* sync 4 == syncw - sync all writes */
 #define	BDSYNC		sync 4		/* sync 4 == syncw - sync all writes */
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync
@@ -583,7 +582,6 @@ _C_LABEL(x):
 #define	SYNC_PLUNGER	sync 4
 #elif __mips >= 3 || !defined(__mips_o32)
 #define	LLSCSYNC	sync
-#define	SYNC		sync
 #define	BDSYNC		sync
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync
@@ -592,7 +590,6 @@ _C_LABEL(x):
 #define	SYNC_PLUNGER	/* nothing */
 #else
 #define	LLSCSYNC	/* nothing */
-#define	SYNC		/* nothing */
 #define	BDSYNC		nop
 #define	BDSYNC_ACQ	nop
 #define	SYNC_ACQ	/* nothing */

Index: src/sys/arch/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.15 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.16
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.15	Sun Feb 27 19:21:53 2022
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sun Feb 27 19:22:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.15 2022/02/27 19:21:53 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.15 2022/02/27 19:21:53 riastradh Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $")
 
 #include "assym.h"
 
@@ -207,7 +207,6 @@ STATIC_LEAF(llsc_mutex_exit)
 	SYNC_REL
 	LLSCSYNC
 	PTR_LL	t0, MTX_OWNER(a0)
-	SYNC
 1:
 	bne	t0, MIPS_CURLWP, 2f
 	 move	t2, zero

Reply via email to