Module Name: src
Committed By: riastradh
Date: Sat Feb 25 00:31:40 UTC 2023
Modified Files:
src/sys/arch/x86/x86: cpu.c
src/sys/arch/xen/x86: cpu.c
Log Message:
x86: Assert kpreempt_disabled() in cpu_load_pmap.
No functional change intended. Just makes it easier to audit
curcpu() usage.
To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/xen/x86/cpu.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/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.206 src/sys/arch/x86/x86/cpu.c:1.207
--- src/sys/arch/x86/x86/cpu.c:1.206 Sat Sep 24 11:05:18 2022
+++ src/sys/arch/x86/x86/cpu.c Sat Feb 25 00:31:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.206 2022/09/24 11:05:18 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.207 2023/02/25 00:31:40 riastradh Exp $ */
/*
* Copyright (c) 2000-2020 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.206 2022/09/24 11:05:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.207 2023/02/25 00:31:40 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -1433,6 +1433,9 @@ x86_cpu_idle_halt(void)
void
cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
{
+
+ KASSERT(kpreempt_disabled());
+
#ifdef SVS
if (svs_enabled && pmap_is_user(pmap)) {
svs_pdir_switch(pmap);
Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.142 src/sys/arch/xen/x86/cpu.c:1.143
--- src/sys/arch/xen/x86/cpu.c:1.142 Sat Aug 20 23:48:51 2022
+++ src/sys/arch/xen/x86/cpu.c Sat Feb 25 00:31:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.142 2022/08/20 23:48:51 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.143 2023/02/25 00:31:40 riastradh Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.142 2022/08/20 23:48:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.143 2023/02/25 00:31:40 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -1109,6 +1109,7 @@ cpu_load_pmap(struct pmap *pmap, struct
cpuid_t cid = cpu_index(ci);
int i;
+ KASSERT(kpreempt_disabled());
KASSERT(pmap != pmap_kernel());
mutex_enter(&ci->ci_kpm_mtx);