Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Slight tweak to last: Our IPL gets rais...



details:   https://anonhg.NetBSD.org/src/rev/d0c9dc76ceaf
branches:  trunk
changeset: 960944:d0c9dc76ceaf
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Apr 03 15:29:02 2021 +0000

description:
Slight tweak to last: Our IPL gets raised to IPL_SCHED by simply *trying*
to acquire the pmap activation lock, regardless of whether or not that was
successful.  So, in addition to remember if we acquired it, also remember
if we tried, and drop back to IPL_VM if so.

diffstat:

 sys/arch/alpha/alpha/pmap.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (68 lines):

diff -r 0e243ea09e33 -r d0c9dc76ceaf sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Sat Apr 03 15:22:23 2021 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Sat Apr 03 15:29:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.275 2021/04/03 14:56:13 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.275 2021/04/03 14:56:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -915,7 +915,7 @@
        const struct cpu_info *ci = curcpu();
        const u_long this_cpu = 1UL << ci->ci_cpuid;
        u_long active_cpus;
-       bool activation_locked;
+       bool activation_locked, activation_lock_tried;
 
        /*
         * Figure out who to notify.  If it's for the kernel or
@@ -929,6 +929,7 @@
        if (TLB_CTX_FLAGS(tlbctx) & (TLB_CTX_F_ASM | TLB_CTX_F_MULTI)) {
                active_cpus = pmap_all_cpus();
                activation_locked = false;
+               activation_lock_tried = false;
        } else {
                KASSERT(tlbctx->t_pmap != NULL);
                activation_locked = PMAP_ACT_TRYLOCK(tlbctx->t_pmap);
@@ -938,6 +939,7 @@
                        TLB_COUNT(shootnow_over_notify);
                        active_cpus = pmap_all_cpus();
                }
+               activation_lock_tried = true;
        }
 
 #if defined(MULTIPROCESSOR)
@@ -959,14 +961,17 @@
         * Now that the remotes have been notified, release the
         * activation lock.
         */
-       if (activation_locked) {
-               KASSERT(tlbctx->t_pmap != NULL);
-               PMAP_ACT_UNLOCK(tlbctx->t_pmap);
+       if (activation_lock_tried) {
+               if (activation_locked) {
+                       KASSERT(tlbctx->t_pmap != NULL);
+                       PMAP_ACT_UNLOCK(tlbctx->t_pmap);
+               }
                /*
-                * When we acquired the activation lock, we
-                * raised IPL to IPL_SCHED, which blocks out
-                * IPIs.  Force our IPL back down to IPL_VM
-                * so that we can receive IPIs.
+                * When we tried to acquire the activation lock, we
+                * raised IPL to IPL_SCHED (even if we ultimately
+                * failed to acquire the lock), which blocks out IPIs.
+                * Force our IPL back down to IPL_VM so that we can
+                * receive IPIs.
                 */
                alpha_pal_swpipl(IPL_VM);
        }



Home | Main Index | Thread Index | Old Index