Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 aarch64: Refactor splhigh and resto...



details:   https://anonhg.NetBSD.org/src/rev/47082286320e
branches:  trunk
changeset: 368687:47082286320e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jul 28 09:14:12 2022 +0000

description:
aarch64: Refactor splhigh and restore in dosoftints.

No functional change intended.  splhigh always returns ci->ci_cpl,
which should not be changing at this point.  Makes the bracketing by
splhigh/splx clearer.

diffstat:

 sys/arch/aarch64/aarch64/cpu_machdep.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r ce7a2b3593ad -r 47082286320e sys/arch/aarch64/aarch64/cpu_machdep.c
--- a/sys/arch/aarch64/aarch64/cpu_machdep.c    Thu Jul 28 07:15:27 2022 +0000
+++ b/sys/arch/aarch64/aarch64/cpu_machdep.c    Thu Jul 28 09:14:12 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.12 2021/09/23 15:19:03 ryo Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.12 2021/09/23 15:19:03 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -114,8 +114,10 @@
        struct cpu_info * const ci = curcpu();
        const int opl = ci->ci_cpl;
        const uint32_t softiplmask = SOFTIPLMASK(opl);
+       int s;
 
-       splhigh();
+       s = splhigh();
+       KASSERT(s == opl);
        for (;;) {
                u_int softints = ci->ci_softints & softiplmask;
                KASSERT((softints != 0) == ((ci->ci_softints >> opl) != 0));
@@ -130,8 +132,7 @@
                                kpreempt(-2);
                        }
 #endif
-                       splx(opl);
-                       return;
+                       break;
                }
 #define DOSOFTINT(n) \
                if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) {\
@@ -147,6 +148,7 @@
                DOSOFTINT(CLOCK);
                panic("dosoftints wtf (softints=%u?, ipl=%d)", softints, opl);
        }
+       splx(s);
 }
 #endif /* !__HAVE_PIC_FAST_SOFTINTS */
 #endif /* __HAVE_FAST_SOFTINTS */



Home | Main Index | Thread Index | Old Index