Sat Jul 18 16:12:09 2020 UTC ()
Always call pmap_segtab_activate in pmap_activate.  pmap_segtab_activate
does the right thing if called with non-curlwp.


(skrll)
diff -r1.49 -r1.50 src/sys/uvm/pmap/pmap.c

cvs diff -r1.49 -r1.50 src/sys/uvm/pmap/pmap.c (expand / switch to unified diff)

--- src/sys/uvm/pmap/pmap.c 2020/04/12 15:36:18 1.49
+++ src/sys/uvm/pmap/pmap.c 2020/07/18 16:12:09 1.50
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.49 2020/04/12 15:36:18 skrll Exp $ */ 1/* $NetBSD: pmap.c,v 1.50 2020/07/18 16:12:09 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center and by Chris G. Demetriou. 9 * NASA Ames Research Center and by Chris G. Demetriou.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -57,27 +57,27 @@ @@ -57,27 +57,27 @@
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE. 63 * SUCH DAMAGE.
64 * 64 *
65 * @(#)pmap.c 8.4 (Berkeley) 1/26/94 65 * @(#)pmap.c 8.4 (Berkeley) 1/26/94
66 */ 66 */
67 67
68#include <sys/cdefs.h> 68#include <sys/cdefs.h>
69 69
70__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.49 2020/04/12 15:36:18 skrll Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.50 2020/07/18 16:12:09 skrll Exp $");
71 71
72/* 72/*
73 * Manages physical address maps. 73 * Manages physical address maps.
74 * 74 *
75 * In addition to hardware address maps, this 75 * In addition to hardware address maps, this
76 * module is called upon to provide software-use-only 76 * module is called upon to provide software-use-only
77 * maps which may or may not be stored in the same 77 * maps which may or may not be stored in the same
78 * form as hardware maps. These pseudo-maps are 78 * form as hardware maps. These pseudo-maps are
79 * used to store intermediate results from copy 79 * used to store intermediate results from copy
80 * operations to and from address spaces. 80 * operations to and from address spaces.
81 * 81 *
82 * Since the information managed by this module is 82 * Since the information managed by this module is
83 * also stored by the logical address mapping module, 83 * also stored by the logical address mapping module,
@@ -713,29 +713,27 @@ pmap_reference(pmap_t pmap) @@ -713,29 +713,27 @@ pmap_reference(pmap_t pmap)
713void 713void
714pmap_activate(struct lwp *l) 714pmap_activate(struct lwp *l)
715{ 715{
716 pmap_t pmap = l->l_proc->p_vmspace->vm_map.pmap; 716 pmap_t pmap = l->l_proc->p_vmspace->vm_map.pmap;
717 717
718 UVMHIST_FUNC(__func__); 718 UVMHIST_FUNC(__func__);
719 UVMHIST_CALLARGS(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l, 719 UVMHIST_CALLARGS(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l,
720 (uintptr_t)pmap, 0, 0); 720 (uintptr_t)pmap, 0, 0);
721 PMAP_COUNT(activate); 721 PMAP_COUNT(activate);
722 722
723 kpreempt_disable(); 723 kpreempt_disable();
724 pmap_tlb_miss_lock_enter(); 724 pmap_tlb_miss_lock_enter();
725 pmap_tlb_asid_acquire(pmap, l); 725 pmap_tlb_asid_acquire(pmap, l);
726 if (l == curlwp) { 726 pmap_segtab_activate(pmap, l);
727 pmap_segtab_activate(pmap, l); 
728 } 
729 pmap_tlb_miss_lock_exit(); 727 pmap_tlb_miss_lock_exit();
730 kpreempt_enable(); 728 kpreempt_enable();
731 729
732 UVMHIST_LOG(pmaphist, " <-- done (%ju:%ju)", l->l_proc->p_pid, 730 UVMHIST_LOG(pmaphist, " <-- done (%ju:%ju)", l->l_proc->p_pid,
733 l->l_lid, 0, 0); 731 l->l_lid, 0, 0);
734} 732}
735 733
736/* 734/*
737 * Remove this page from all physical maps in which it resides. 735 * Remove this page from all physical maps in which it resides.
738 * Reflects back modify bits to the pager. 736 * Reflects back modify bits to the pager.
739 */ 737 */
740void 738void
741pmap_page_remove(struct vm_page *pg) 739pmap_page_remove(struct vm_page *pg)