Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips mips: Omit needless SYNC in mutex_exit.



details:   https://anonhg.NetBSD.org/src/rev/539462a4a3ea
branches:  trunk
changeset: 362455:539462a4a3ea
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Feb 27 19:22:02 2022 +0000

description:
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.

diffstat:

 sys/arch/mips/include/asm.h          |  5 +----
 sys/arch/mips/mips/lock_stubs_llsc.S |  5 ++---
 2 files changed, 3 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 1886f2ce8a20 -r 539462a4a3ea sys/arch/mips/include/asm.h
--- a/sys/arch/mips/include/asm.h       Sun Feb 27 19:21:53 2022 +0000
+++ b/sys/arch/mips/include/asm.h       Sun Feb 27 19:22:02 2022 +0000
@@ -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 @@
 #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 @@
 #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 @@
 #define        SYNC_PLUNGER    /* nothing */
 #else
 #define        LLSCSYNC        /* nothing */
-#define        SYNC            /* nothing */
 #define        BDSYNC          nop
 #define        BDSYNC_ACQ      nop
 #define        SYNC_ACQ        /* nothing */
diff -r 1886f2ce8a20 -r 539462a4a3ea sys/arch/mips/mips/lock_stubs_llsc.S
--- a/sys/arch/mips/mips/lock_stubs_llsc.S      Sun Feb 27 19:21:53 2022 +0000
+++ b/sys/arch/mips/mips/lock_stubs_llsc.S      Sun Feb 27 19:22:02 2022 +0000
@@ -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 @@
        SYNC_REL
        LLSCSYNC
        PTR_LL  t0, MTX_OWNER(a0)
-       SYNC
 1:
        bne     t0, MIPS_CURLWP, 2f
         move   t2, zero



Home | Main Index | Thread Index | Old Index