Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm/pmap KASSERT(kpreempt_disabled()) before accessing c...
details: https://anonhg.NetBSD.org/src/rev/c3d67226ef3e
branches: trunk
changeset: 374407:c3d67226ef3e
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Apr 22 10:22:43 2023 +0000
description:
KASSERT(kpreempt_disabled()) before accessing curcpu()
diffstat:
sys/uvm/pmap/pmap_tlb.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diffs (83 lines):
diff -r 98c009195f58 -r c3d67226ef3e sys/uvm/pmap/pmap_tlb.c
--- a/sys/uvm/pmap/pmap_tlb.c Sat Apr 22 10:09:12 2023 +0000
+++ b/sys/uvm/pmap/pmap_tlb.c Sat Apr 22 10:22:43 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $ */
+/* $NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $");
/*
* Manages address spaces in a TLB.
@@ -655,7 +655,10 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
UVMHIST_FUNC(__func__);
UVMHIST_CALLARGS(maphist, "pm %#jx", (uintptr_t)pm, 0, 0, 0);
+ KASSERT(kpreempt_disabled());
+
const struct cpu_info * const ci = curcpu();
+
kcpuset_t *pm_active = ci->ci_shootdowncpus;
kcpuset_copy(pm_active, pm->pm_active);
kcpuset_remove(pm_active, cpu_tlb_info(curcpu())->ti_kcpuset);
@@ -745,6 +748,8 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
int
pmap_tlb_update_addr(pmap_t pm, vaddr_t va, pt_entry_t pte, u_int flags)
{
+ KASSERT(kpreempt_disabled());
+
struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
int rv = -1;
@@ -753,8 +758,6 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t
UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx, pte=%#jx flags=%#jx)",
(uintptr_t)pm, va, pte_value(pte), flags);
- KASSERT(kpreempt_disabled());
-
KASSERTMSG(pte_valid_p(pte), "va %#"PRIxVADDR" %#"PRIxPTE,
va, pte_value(pte));
@@ -785,6 +788,8 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t
void
pmap_tlb_invalidate_addr(pmap_t pm, vaddr_t va)
{
+ KASSERT(kpreempt_disabled());
+
struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
@@ -792,8 +797,6 @@ pmap_tlb_invalidate_addr(pmap_t pm, vadd
UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx) ti=%#jx asid=%#jx",
(uintptr_t)pm, va, (uintptr_t)ti, pai->pai_asid);
- KASSERT(kpreempt_disabled());
-
TLBINFO_LOCK(ti);
if (pm == pmap_kernel() || PMAP_PAI_ASIDVALID_P(pai, ti)) {
pmap_tlb_asid_check();
@@ -908,6 +911,8 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info
void
pmap_tlb_asid_acquire(pmap_t pm, struct lwp *l)
{
+ KASSERT(kpreempt_disabled());
+
struct cpu_info * const ci = l->l_cpu;
struct pmap_tlb_info * const ti = cpu_tlb_info(ci);
struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
@@ -916,8 +921,6 @@ pmap_tlb_asid_acquire(pmap_t pm, struct
UVMHIST_CALLARGS(maphist, "(pm=%#jx, l=%#jx, ti=%#jx)", (uintptr_t)pm,
(uintptr_t)l, (uintptr_t)ti, 0);
- KASSERT(kpreempt_disabled());
-
/*
* Kernels use a fixed ASID and thus doesn't need to acquire one.
*/
Home |
Main Index |
Thread Index |
Old Index