Module Name: src
Committed By: skrll
Date: Sat Jun 10 07:33:32 UTC 2023
Modified Files:
src/sys/arch/aarch64/aarch64: cpufunc.c
Log Message:
KASSERT(kpreempt_disabled()) before accessing curcpu() to reflect why
preemption needs to be disabled more clearly.
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/aarch64/aarch64/cpufunc.c
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/aarch64/aarch64/cpufunc.c
diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.34 src/sys/arch/aarch64/aarch64/cpufunc.c:1.35
--- src/sys/arch/aarch64/aarch64/cpufunc.c:1.34 Sat Feb 25 00:40:22 2023
+++ src/sys/arch/aarch64/aarch64/cpufunc.c Sat Jun 10 07:33:32 2023
@@ -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 <[email protected]>
@@ -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;