Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't call pcu_do_op in pcu_load to save current co...



details:   https://anonhg.NetBSD.org/src/rev/1d1c15b7dc31
branches:  trunk
changeset: 764728:1d1c15b7dc31
user:      matt <matt%NetBSD.org@localhost>
date:      Mon May 02 06:33:16 2011 +0000

description:
Don't call pcu_do_op in pcu_load to save current context, use pcu_cpu_op
instead (since it will deal with ci->ci_pcu_curlwp[id] being NULL).

diffstat:

 sys/kern/subr_pcu.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 1d67dd831acd -r 1d1c15b7dc31 sys/kern/subr_pcu.c
--- a/sys/kern/subr_pcu.c       Mon May 02 06:29:23 2011 +0000
+++ b/sys/kern/subr_pcu.c       Mon May 02 06:33:16 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pcu.c,v 1.5 2011/05/02 01:43:37 matt Exp $        */
+/*     $NetBSD: subr_pcu.c,v 1.6 2011/05/02 06:33:16 matt Exp $        */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.5 2011/05/02 01:43:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.6 2011/05/02 06:33:16 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -125,7 +125,8 @@
 }
 
 /*
- * pcu_cpu_op: helper routine to call pcu_do_op() via xcall(9).
+ * pcu_cpu_op: helper routine to call pcu_do_op() via xcall(9) or
+ * by pcu_load.
  */
 static void
 pcu_cpu_op(const pcu_ops_t *pcu, const int flags)
@@ -133,7 +134,7 @@
        const u_int id = pcu->pcu_id;
        lwp_t * const l = curcpu()->ci_pcu_curlwp[id];
 
-       KASSERT(cpu_softintr_p());
+       //KASSERT(cpu_softintr_p());
 
        /* If no state - nothing to do. */
        if (l == NULL) {
@@ -164,7 +165,9 @@
                /*
                 * State is on the current CPU - just perform the operations.
                 */
-               KASSERT(ci->ci_pcu_curlwp[id] == l);
+               KASSERTMSG(ci->ci_pcu_curlwp[id] == l,
+                   ("%s: cpu%u: pcu_curlwp[%u] (%p) != l (%p)",
+                    __func__, cpu_index(ci), id, ci->ci_pcu_curlwp[id], l));
                pcu_do_op(pcu, l, flags);
                splx(s);
                return;
@@ -227,7 +230,7 @@
        KASSERT(l->l_pcu_cpu[id] == NULL);
 
        /* Save the PCU state on the current CPU, if there is any. */
-       pcu_do_op(pcu, l, PCU_SAVE | PCU_RELEASE);
+       pcu_cpu_op(pcu, PCU_SAVE | PCU_RELEASE);
        KASSERT(curci->ci_pcu_curlwp[id] == NULL);
 
        /*



Home | Main Index | Thread Index | Old Index