| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.277 2021/05/23 19:13:27 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 | | 4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 |
5 | * The NetBSD Foundation, Inc. | | 5 | * The NetBSD Foundation, Inc. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 9 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
10 | * NASA Ames Research Center, by Andrew Doran and Mindaugas Rasiukevicius, | | 10 | * NASA Ames Research Center, by Andrew Doran and Mindaugas Rasiukevicius, |
11 | * and by Chris G. Demetriou. | | 11 | * and by Chris G. Demetriou. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -125,27 +125,27 @@ | | | @@ -125,27 +125,27 @@ |
125 | * this module may delay invalidate or reduced protection | | 125 | * this module may delay invalidate or reduced protection |
126 | * operations until such time as they are actually | | 126 | * operations until such time as they are actually |
127 | * necessary. This module is given full information as | | 127 | * necessary. This module is given full information as |
128 | * to which processors are currently using which maps, | | 128 | * to which processors are currently using which maps, |
129 | * and to when physical maps must be made correct. | | 129 | * and to when physical maps must be made correct. |
130 | */ | | 130 | */ |
131 | | | 131 | |
132 | #include "opt_lockdebug.h" | | 132 | #include "opt_lockdebug.h" |
133 | #include "opt_sysv.h" | | 133 | #include "opt_sysv.h" |
134 | #include "opt_multiprocessor.h" | | 134 | #include "opt_multiprocessor.h" |
135 | | | 135 | |
136 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 136 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
137 | | | 137 | |
138 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $"); | | 138 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.277 2021/05/23 19:13:27 thorpej Exp $"); |
139 | | | 139 | |
140 | #include <sys/param.h> | | 140 | #include <sys/param.h> |
141 | #include <sys/systm.h> | | 141 | #include <sys/systm.h> |
142 | #include <sys/kernel.h> | | 142 | #include <sys/kernel.h> |
143 | #include <sys/proc.h> | | 143 | #include <sys/proc.h> |
144 | #include <sys/malloc.h> | | 144 | #include <sys/malloc.h> |
145 | #include <sys/pool.h> | | 145 | #include <sys/pool.h> |
146 | #include <sys/buf.h> | | 146 | #include <sys/buf.h> |
147 | #include <sys/evcnt.h> | | 147 | #include <sys/evcnt.h> |
148 | #include <sys/atomic.h> | | 148 | #include <sys/atomic.h> |
149 | #include <sys/cpu.h> | | 149 | #include <sys/cpu.h> |
150 | | | 150 | |
151 | #include <uvm/uvm.h> | | 151 | #include <uvm/uvm.h> |
| @@ -733,26 +733,29 @@ static void | | | @@ -733,26 +733,29 @@ static void |
733 | pmap_tlb_shootdown_all_user(pmap_t const pmap, pt_entry_t const pte_bits, | | 733 | pmap_tlb_shootdown_all_user(pmap_t const pmap, pt_entry_t const pte_bits, |
734 | struct pmap_tlb_context * const tlbctx) | | 734 | struct pmap_tlb_context * const tlbctx) |
735 | { | | 735 | { |
736 | KASSERT(pmap != pmap_kernel()); | | 736 | KASSERT(pmap != pmap_kernel()); |
737 | | | 737 | |
738 | TLB_COUNT(shootdown_all_user); | | 738 | TLB_COUNT(shootdown_all_user); |
739 | | | 739 | |
740 | /* Note if an I-stream sync is also needed. */ | | 740 | /* Note if an I-stream sync is also needed. */ |
741 | if (pte_bits & PG_EXEC) { | | 741 | if (pte_bits & PG_EXEC) { |
742 | TLB_COUNT(shootdown_all_user_imb); | | 742 | TLB_COUNT(shootdown_all_user_imb); |
743 | TLB_CTX_SET_FLAG(tlbctx, TLB_CTX_F_IMB); | | 743 | TLB_CTX_SET_FLAG(tlbctx, TLB_CTX_F_IMB); |
744 | } | | 744 | } |
745 | | | 745 | |
| | | 746 | KASSERT(tlbctx->t_pmap == NULL || tlbctx->t_pmap == pmap); |
| | | 747 | tlbctx->t_pmap = pmap; |
| | | 748 | |
746 | TLB_CTX_SET_ALLVA(tlbctx); | | 749 | TLB_CTX_SET_ALLVA(tlbctx); |
747 | } | | 750 | } |
748 | | | 751 | |
749 | static void | | 752 | static void |
750 | pmap_tlb_shootdown_pv(const pv_entry_t pv, pt_entry_t const pte_bits, | | 753 | pmap_tlb_shootdown_pv(const pv_entry_t pv, pt_entry_t const pte_bits, |
751 | struct pmap_tlb_context * const tlbctx) | | 754 | struct pmap_tlb_context * const tlbctx) |
752 | { | | 755 | { |
753 | uintptr_t flags = TLB_CTX_F_PV; | | 756 | uintptr_t flags = TLB_CTX_F_PV; |
754 | | | 757 | |
755 | TLB_COUNT(shootdown_pv); | | 758 | TLB_COUNT(shootdown_pv); |
756 | | | 759 | |
757 | if (tlbctx->t_pmap == NULL || tlbctx->t_pmap == pv->pv_pmap) { | | 760 | if (tlbctx->t_pmap == NULL || tlbctx->t_pmap == pv->pv_pmap) { |
758 | if (tlbctx->t_pmap == NULL) { | | 761 | if (tlbctx->t_pmap == NULL) { |