Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64 Restore the previous pmap_remove_all behavi...



details:   https://anonhg.NetBSD.org/src/rev/456fca583f1e
branches:  trunk
changeset: 359605:456fca583f1e
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Jan 14 07:21:53 2022 +0000

description:
Restore the previous pmap_remove_all behaviour as the new method meant
the n1sdp couldn't complete a build.

No noticeable change in kernel build performance.

diffstat:

 sys/arch/aarch64/aarch64/pmap.c |  70 ++++------------------------------------
 sys/arch/aarch64/include/pmap.h |   4 +-
 2 files changed, 9 insertions(+), 65 deletions(-)

diffs (156 lines):

diff -r 95350393e2bd -r 456fca583f1e sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Thu Jan 13 16:03:38 2022 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Fri Jan 14 07:21:53 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.122 2022/01/04 05:55:45 skrll Exp $ */
+/*     $NetBSD: pmap.c,v 1.123 2022/01/14 07:21:53 skrll Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.122 2022/01/04 05:55:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.123 2022/01/14 07:21:53 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1511,7 +1511,6 @@
 
        kcpuset_create(&pm->pm_active, true);
        kcpuset_create(&pm->pm_onproc, true);
-       pm->pm_remove_all = false;
 
        pm->pm_l0table_pa = pmap_alloc_pdp(pm, NULL, 0, true);
        KASSERT(pm->pm_l0table_pa != POOL_PADDR_INVALID);
@@ -1531,9 +1530,8 @@
        unsigned int refcnt;
 
        UVMHIST_FUNC(__func__);
-       UVMHIST_CALLARGS(pmaphist,
-           "pm=%p, pm_l0table=%016lx, pm_remove_all=%jd, refcnt=%jd",
-           pm, pm->pm_l0table, pm->pm_remove_all, pm->pm_refcnt);
+       UVMHIST_CALLARGS(pmaphist, "pm=%p, pm_l0table=%016lx, refcnt=%jd",
+           pm, pm->pm_l0table, pm->pm_refcnt, 0);
 
        if (pm == NULL)
                return;
@@ -1541,16 +1539,12 @@
        if (pm == pmap_kernel())
                panic("cannot destroy kernel pmap");
 
-       if (pm->pm_remove_all) {
-               pmap_tlb_asid_release_all(pm);
-               pm->pm_remove_all = false;
-       }
-
        refcnt = atomic_dec_uint_nv(&pm->pm_refcnt);
        if (refcnt > 0)
                return;
 
        KASSERT(LIST_EMPTY(&pm->pm_pvlist));
+       pmap_tlb_asid_release_all(pm);
 
        _pmap_free_pdp_all(pm, true);
        mutex_destroy(&pm->pm_lock);
@@ -2054,41 +2048,6 @@
 }
 
 
-
-void
-pmap_update(pmap_t pm)
-{
-
-       UVMHIST_FUNC(__func__);
-       UVMHIST_CALLARGS(maphist, "pm=%#jx remove_all %jd", (uintptr_t)pm,
-           pm->pm_remove_all, 0, 0);
-
-       kpreempt_disable();
-       /*
-        * If pmap_remove_all was called, we deactivated ourselves and released
-        * our ASID.  Now we have to reactivate ourselves.
-        */
-       if (__predict_false(pm->pm_remove_all)) {
-               pm->pm_remove_all = false;
-
-               KASSERT(pm != pmap_kernel());
-
-               /* this calls tlb_set_asid which calls cpu_set_ttbr0 */
-               pmap_tlb_asid_acquire(pm, curlwp);
-
-               /* Enable translation table walks using TTBR0 */
-               uint64_t tcr = reg_tcr_el1_read();
-               reg_tcr_el1_write(tcr & ~TCR_EPD0);
-               isb();
-
-               pm->pm_activated = true;
-       }
-
-       kpreempt_enable();
-
-       UVMHIST_LOG(maphist, "  <-- done", 0, 0, 0, 0);
-}
-
 bool
 pmap_remove_all(struct pmap *pm)
 {
@@ -2102,23 +2061,6 @@
 
        KASSERT(pm != pmap_kernel());
 
-       struct cpu_info * const ci = curcpu();
-       // This should be the last CPU with this pmap onproc
-       KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(ci)));
-       if (kcpuset_isset(pm->pm_onproc, cpu_index(ci))) {
-               /* Disable translation table walks using TTBR0 */
-               uint64_t tcr = reg_tcr_el1_read();
-               reg_tcr_el1_write(tcr | TCR_EPD0);
-               isb();
-
-               pmap_tlb_asid_deactivate(pm);
-       }
-
-       KASSERT(kcpuset_iszero(pm->pm_onproc));
-
-       pmap_tlb_asid_release_all(pm);
-       pm->pm_remove_all = true;
-
        UVMHIST_LOG(pmaphist, "pm=%p, asid=%d", pm,
            PMAP_PAI(pm, cpu_tlb_info(ci))->pai_asid, 0, 0);
 
@@ -2155,6 +2097,8 @@
        /* clear L0 page table page */
        pmap_zero_page(pm->pm_l0table_pa);
 
+       aarch64_tlbi_by_asid(PMAP_PAI(pm, cpu_tlb_info(ci))->pai_asid);
+
        /* free L1-L3 page table pages, but not L0 */
        _pmap_free_pdp_all(pm, false);
 
diff -r 95350393e2bd -r 456fca583f1e sys/arch/aarch64/include/pmap.h
--- a/sys/arch/aarch64/include/pmap.h   Thu Jan 13 16:03:38 2022 +0000
+++ b/sys/arch/aarch64/include/pmap.h   Fri Jan 14 07:21:53 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.49 2021/10/10 07:15:25 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.50 2022/01/14 07:21:53 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -125,7 +125,6 @@
 
        struct pmap_asid_info pm_pai[PMAP_TLB_MAX];
        bool pm_activated;
-       bool pm_remove_all;
 };
 
 static inline paddr_t
@@ -384,6 +383,7 @@
 #define pmap_phys_address(pa)          aarch64_ptob((pa))
 #define pmap_mmap_flags(ppn)           aarch64_mmap_flags((ppn))
 
+#define pmap_update(pmap)              ((void)0)
 #define pmap_copy(dp,sp,d,l,s)         ((void)0)
 #define pmap_wired_count(pmap)         ((pmap)->pm_stats.wired_count)
 #define pmap_resident_count(pmap)      ((pmap)->pm_stats.resident_count)



Home | Main Index | Thread Index | Old Index