Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc powerpc: Optimization: Omit needles...



details:   https://anonhg.NetBSD.org/src/rev/abafeaf4d5f1
branches:  trunk
changeset: 373791:abafeaf4d5f1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 01 08:18:13 2023 +0000

description:
powerpc: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

 sys/arch/powerpc/powerpc/locore_subr.S |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (26 lines):

diff -r 21a37e4266a2 -r abafeaf4d5f1 sys/arch/powerpc/powerpc/locore_subr.S
--- a/sys/arch/powerpc/powerpc/locore_subr.S    Wed Mar 01 08:18:03 2023 +0000
+++ b/sys/arch/powerpc/powerpc/locore_subr.S    Wed Mar 01 08:18:13 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_subr.S,v 1.67 2023/02/23 14:56:11 riastradh Exp $       */
+/*     $NetBSD: locore_subr.S,v 1.68 2023/03/01 08:18:13 riastradh Exp $       */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -418,9 +418,13 @@
        sync    /* XXX eieio */         /* for mutex_enter; see cpu_switchto */
 #endif
        stptr   %r3, CI_CURLWP(%r7)
-#ifdef MULTIPROCESSOR
-       sync                            /* for mutex_enter; see cpu_switchto */
-#endif
+       /*
+        * No need for barrier after ci->ci_curlwp = softlwp -- when we
+        * enter a softint lwp, it can't be holding any mutexes, so it
+        * can't release any until after it has acquired them, so we
+        * need not participate in the protocol with mutex_vector_enter
+        * barriers here.
+        */
        mr      %r13, %r3
 #ifdef PPC_BOOKE
        mtsprg2 %r3



Home | Main Index | Thread Index | Old Index