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 KASSERT(kpreempt_disabled()) before...



details:   https://anonhg.NetBSD.org/src/rev/da7219c44193
branches:  trunk
changeset: 376310:da7219c44193
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jun 10 07:33:32 2023 +0000

description:
KASSERT(kpreempt_disabled()) before accessing curcpu() to reflect why
preemption needs to be disabled more clearly.

diffstat:

 sys/arch/aarch64/aarch64/cpufunc.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (63 lines):

diff -r 275b970dd7e4 -r da7219c44193 sys/arch/aarch64/aarch64/cpufunc.c
--- a/sys/arch/aarch64/aarch64/cpufunc.c        Sat Jun 10 07:30:57 2023 +0000
+++ b/sys/arch/aarch64/aarch64/cpufunc.c        Sat Jun 10 07:33:32 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.c,v 1.34 2023/02/25 00:40:22 riastradh Exp $   */
+/*     $NetBSD: cpufunc.c,v 1.35 2023/06/10 07:33:32 skrll Exp $       */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.34 2023/02/25 00:40:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.35 2023/06/10 07:33:32 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -365,12 +365,12 @@ ln_dcache_inv_all(int level, struct aarc
 void
 aarch64_dcache_wbinv_all(void)
 {
+       KASSERT(kpreempt_disabled());
+
        struct cpu_info * const ci = curcpu();
        struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
        int level;
 
-       KASSERT(kpreempt_disabled());
-
        for (level = 0; level < MAX_CACHE_LEVEL; level++) {
                if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
                        break;
@@ -384,12 +384,12 @@ aarch64_dcache_wbinv_all(void)
 void
 aarch64_dcache_inv_all(void)
 {
+       KASSERT(kpreempt_disabled());
+
        struct cpu_info * const ci = curcpu();
        struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
        int level;
 
-       KASSERT(kpreempt_disabled());
-
        for (level = 0; level < MAX_CACHE_LEVEL; level++) {
                if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
                        break;
@@ -403,12 +403,12 @@ aarch64_dcache_inv_all(void)
 void
 aarch64_dcache_wb_all(void)
 {
+       KASSERT(kpreempt_disabled());
+
        struct cpu_info * const ci = curcpu();
        struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
        int level;
 
-       KASSERT(kpreempt_disabled());
-
        for (level = 0; level < MAX_CACHE_LEVEL; level++) {
                if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
                        break;



Home | Main Index | Thread Index | Old Index