diff options
author | cwb <none@none> | 2007-07-13 04:56:35 -0700 |
---|---|---|
committer | cwb <none@none> | 2007-07-13 04:56:35 -0700 |
commit | a1af7ba02a81ee5af0f2cd6b30b99957a93fc605 (patch) | |
tree | d6271e21eafb90eddbbd73adae794b57dd8c0033 /usr/src | |
parent | 8e2accd0e57371254cfb396be303067a1ece53f3 (diff) | |
download | illumos-joyent-a1af7ba02a81ee5af0f2cd6b30b99957a93fc605.tar.gz |
6317341 KMDB uses siron (and children), which can be traced by DTrace
6565142 Need to remove unused code in the PSMs softint handling area
6578650 usr/src/uts/common/io/avintr.c needs to be cstyle clean with continuation line checking
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/avintr.c | 37 | ||||
-rw-r--r-- | usr/src/uts/common/os/softint.c | 10 | ||||
-rw-r--r-- | usr/src/uts/common/sys/kdi_impl.h | 1 | ||||
-rw-r--r-- | usr/src/uts/i86pc/io/pcplusmp/apic.c | 47 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/mp_machdep.c | 56 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/smp_impldefs.h | 4 | ||||
-rw-r--r-- | usr/src/uts/sun4/ml/interrupt.s | 6 | ||||
-rw-r--r-- | usr/src/uts/sun4/os/intr.c | 28 |
8 files changed, 79 insertions, 110 deletions
diff --git a/usr/src/uts/common/io/avintr.c b/usr/src/uts/common/io/avintr.c index cd5d474731..5bf7ce67e5 100644 --- a/usr/src/uts/common/io/avintr.c +++ b/usr/src/uts/common/io/avintr.c @@ -104,11 +104,22 @@ av_check_softint_pending(av_softinfo_t *infop, boolean_t check_all) } /* + * This is the wrapper function which is generally used to set a softint + * pending + */ +void +av_set_softint_pending(int pri, av_softinfo_t *infop) +{ + kdi_av_set_softint_pending(pri, infop); +} + +/* + * This is kmdb's private entry point to setsoftint called from kdi_siron * It first sets our av softint pending bit for the current CPU, * then it sets the CPU softint pending bit for pri. */ void -av_set_softint_pending(int pri, av_softinfo_t *infop) +kdi_av_set_softint_pending(int pri, av_softinfo_t *infop) { CPUSET_ATOMIC_ADD(infop->av_pending, CPU->cpu_seqid); @@ -196,7 +207,7 @@ add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name, int vect, if ((f = xxintr) == NULL) { printf("Attempt to add null vect for %s on vector %d\n", - name, vect); + name, vect); return (0); } @@ -213,7 +224,7 @@ add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name, int vect, if (((hi_pri > LOCK_LEVEL) && (lvl < LOCK_LEVEL)) || ((hi_pri < LOCK_LEVEL) && (lvl > LOCK_LEVEL))) { cmn_err(CE_WARN, multilevel2, name, lvl, vect, - hi_pri); + hi_pri); return (0); } if ((vecp->avh_lo_pri != lvl) || (hi_pri != lvl)) @@ -286,7 +297,7 @@ add_avsoftintr(void *intr_id, int lvl, avfunc xxintr, char *name, if (hdlp->ih_pending == NULL) { hdlp->ih_pending = - kmem_zalloc(sizeof (av_softinfo_t), KM_SLEEP); + kmem_zalloc(sizeof (av_softinfo_t), KM_SLEEP); } insert_av(intr_id, &softvect[lvl], xxintr, arg1, arg2, NULL, lvl, NULL); @@ -495,7 +506,7 @@ remove_av(void *intr_id, struct av_head *vectp, avfunc f, int pri_level, ipl = hi_pri; if (target == NULL) { /* not found */ printf("Couldn't remove function %p at %d, %d\n", - (void *)f, vect, pri_level); + (void *)f, vect, pri_level); mutex_exit(&av_lock); return; } @@ -536,6 +547,22 @@ remove_av(void *intr_id, struct av_head *vectp, avfunc f, int pri_level, } /* + * kmdb uses siron (and thus setsoftint) while the world is stopped in order to + * inform its driver component that there's work to be done. We need to keep + * DTrace from instrumenting kmdb's siron and setsoftint. We duplicate siron, + * giving kmdb's version a kdi prefix to keep DTrace at bay. We also + * provide a version of the various setsoftint functions available for kmdb to + * use using a kdi_ prefix while the main *setsoftint() functionality is + * implemented as a wrapper. This allows tracing, while still providing a + * way for kmdb to sneak in unmolested. + */ +void +kdi_siron(void) +{ + (*kdisetsoftint)(1, softlevel1_hdl.ih_pending); +} + +/* * Trigger a soft interrupt. */ void diff --git a/usr/src/uts/common/os/softint.c b/usr/src/uts/common/os/softint.c index 8169082adf..45bcbe1754 100644 --- a/usr/src/uts/common/os/softint.c +++ b/usr/src/uts/common/os/softint.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -82,6 +81,7 @@ static kmutex_t softcall_lock; static void (*kdi_softcall_func)(void); extern void siron(void); +extern void kdi_siron(void); void softcall_init(void) @@ -152,7 +152,7 @@ kdi_softcall(void (*func)(void)) kdi_softcall_func = func; if (softhead == NULL) - siron(); + kdi_siron(); } /* diff --git a/usr/src/uts/common/sys/kdi_impl.h b/usr/src/uts/common/sys/kdi_impl.h index e488ae6b14..5083a1ffa5 100644 --- a/usr/src/uts/common/sys/kdi_impl.h +++ b/usr/src/uts/common/sys/kdi_impl.h @@ -142,6 +142,7 @@ struct kdi { }; extern void kdi_softcall(void (*)(void)); +extern void kdi_setsoftint(uint64_t); extern int kdi_pread(caddr_t, size_t, uint64_t, size_t *); extern int kdi_pwrite(caddr_t, size_t, uint64_t, size_t *); extern size_t kdi_range_is_nontoxic(uintptr_t, size_t, int); diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic.c b/usr/src/uts/i86pc/io/pcplusmp/apic.c index 55f168a4ac..0dd2734030 100644 --- a/usr/src/uts/i86pc/io/pcplusmp/apic.c +++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c @@ -90,10 +90,8 @@ static void apic_picinit(void); static int apic_cpu_start(processorid_t, caddr_t); static int apic_post_cpu_start(void); static void apic_send_ipi(int cpun, int ipl); -static void apic_set_softintr(int softintr); static void apic_set_idlecpu(processorid_t cpun); static void apic_unset_idlecpu(processorid_t cpun); -static int apic_softlvl_to_irq(int ipl); static int apic_intr_enter(int ipl, int *vect); static void apic_setspl(int ipl); static int apic_addspl(int ipl, int vector, int min_ipl, int max_ipl); @@ -212,8 +210,8 @@ static struct psm_ops apic_ops = { apic_delspl, apic_disable_intr, apic_enable_intr, - apic_softlvl_to_irq, - apic_set_softintr, + (int (*)(int))NULL, /* psm_softlvl_to_irq */ + (void (*)(int))NULL, /* psm_set_softintr */ apic_set_idlecpu, apic_unset_idlecpu, @@ -870,28 +868,6 @@ apic_setspl(int ipl) } /* - * trigger a software interrupt at the given IPL - */ -static void -apic_set_softintr(int ipl) -{ - int vector; - ulong_t flag; - - vector = apic_resv_vector[ipl]; - - flag = intr_clear(); - - while (get_apic_cmd1() & AV_PENDING) - apic_ret(); - - /* generate interrupt at vector on itself only */ - apicadr[APIC_INT_CMD1] = AV_SH_SELF | vector; - - intr_restore(flag); -} - -/* * generates an interprocessor interrupt to another CPU */ static void @@ -1135,25 +1111,6 @@ apic_delspl(int irqno, int ipl, int min_ipl, int max_ipl) return (apic_delspl_common(irqno, ipl, min_ipl, max_ipl)); } -/* - * Return HW interrupt number corresponding to the given IPL - */ -/*ARGSUSED*/ -static int -apic_softlvl_to_irq(int ipl) -{ - /* - * Do not use apic to trigger soft interrupt. - * It will cause the system to hang when 2 hardware interrupts - * at the same priority with the softint are already accepted - * by the apic. Cause the AV_PENDING bit will not be cleared - * until one of the hardware interrupt is eoi'ed. If we need - * to send an ipi at this time, we will end up looping forever - * to wait for the AV_PENDING bit to clear. - */ - return (PSM_SV_SOFTWARE); -} - static int apic_post_cpu_start() { diff --git a/usr/src/uts/i86pc/os/mp_machdep.c b/usr/src/uts/i86pc/os/mp_machdep.c index e80a35c42b..4605f6e517 100644 --- a/usr/src/uts/i86pc/os/mp_machdep.c +++ b/usr/src/uts/i86pc/os/mp_machdep.c @@ -48,6 +48,7 @@ #include <sys/promif.h> #include <sys/mach_intr.h> #include <vm/hat_i86.h> +#include <sys/kdi_machimpl.h> #define OFFSETOF(s, m) (size_t)(&(((s *)0)->m)) @@ -64,7 +65,6 @@ static uint64_t mach_getcpufreq(void); static void mach_fixcpufreq(void); static int mach_clkinit(int, int *); static void mach_smpinit(void); -static void mach_set_softintr(int ipl, struct av_softinfo *); static int mach_softlvl_to_vect(int ipl); static void mach_get_platform(int owner); static void mach_construct_info(); @@ -106,6 +106,8 @@ void (*send_dirintf)() = return_instr; void (*setspl)(int) = (void (*)(int))return_instr; int (*addspl)(int, int, int, int) = (int (*)(int, int, int, int))return_instr; int (*delspl)(int, int, int, int) = (int (*)(int, int, int, int))return_instr; +void (*kdisetsoftint)(int, struct av_softinfo *)= + (void (*)(int, struct av_softinfo *))return_instr; void (*setsoftint)(int, struct av_softinfo *)= (void (*)(int, struct av_softinfo *))return_instr; int (*slvltovect)(int) = (int (*)(int))return_instr; @@ -1225,63 +1227,17 @@ mach_clkinit(int preferred_mode, int *set_mode) } } -/*ARGSUSED*/ -static void -mach_psm_set_softintr(int ipl, struct av_softinfo *pending) -{ - struct psm_ops *pops; - - /* invoke hardware interrupt */ - pops = mach_set[0]; - (*pops->psm_set_softintr)(ipl); -} +/*ARGSUSED*/ static int mach_softlvl_to_vect(int ipl) { - int softvect; - struct psm_ops *pops; - - pops = mach_set[0]; - - /* check for null handler for set soft interrupt call */ - if (pops->psm_set_softintr == NULL) { - setsoftint = av_set_softint_pending; - return (PSM_SV_SOFTWARE); - } - - softvect = (*pops->psm_softlvl_to_irq)(ipl); - /* check for hardware scheme */ - if (softvect > PSM_SV_SOFTWARE) { - setsoftint = mach_psm_set_softintr; - return (softvect); - } - - if (softvect == PSM_SV_SOFTWARE) - setsoftint = av_set_softint_pending; - else /* hardware and software mixed scheme */ - setsoftint = mach_set_softintr; + setsoftint = av_set_softint_pending; + kdisetsoftint = kdi_av_set_softint_pending; return (PSM_SV_SOFTWARE); } -static void -mach_set_softintr(int ipl, struct av_softinfo *pending) -{ - struct psm_ops *pops; - - /* set software pending bits */ - av_set_softint_pending(ipl, pending); - - /* check if dosoftint will be called at the end of intr */ - if (CPU_ON_INTR(CPU) || (curthread->t_intr)) - return; - - /* invoke hardware interrupt */ - pops = mach_set[0]; - (*pops->psm_set_softintr)(ipl); -} - #ifdef DEBUG /* * This is here to allow us to simulate cpus that refuse to start. diff --git a/usr/src/uts/i86pc/sys/smp_impldefs.h b/usr/src/uts/i86pc/sys/smp_impldefs.h index 27beafeac7..266c0e43a1 100644 --- a/usr/src/uts/i86pc/sys/smp_impldefs.h +++ b/usr/src/uts/i86pc/sys/smp_impldefs.h @@ -81,8 +81,12 @@ extern int (*delspl)(int, int, int, int); /* delete intr mask of vector */ /* trigger a software intr */ extern void (*setsoftint)(int, struct av_softinfo *); +/* kmdb private entry point */ +extern void (*kdisetsoftint)(int, struct av_softinfo *); + extern uint_t xc_serv(caddr_t, caddr_t); /* cross call service routine */ extern void av_set_softint_pending(); /* set software interrupt pending */ +extern void kdi_av_set_softint_pending(); /* kmdb private entry point */ extern void microfind(void); /* initialize tenmicrosec */ /* map physical address */ diff --git a/usr/src/uts/sun4/ml/interrupt.s b/usr/src/uts/sun4/ml/interrupt.s index f3cd4f7250..302dbc0777 100644 --- a/usr/src/uts/sun4/ml/interrupt.s +++ b/usr/src/uts/sun4/ml/interrupt.s @@ -1552,12 +1552,12 @@ cbe_level14(void) /* ARGSUSED */ void -setsoftint(uint64_t iv_p) +kdi_setsoftint(uint64_t iv_p) {} #else /* lint */ - ENTRY_NP(setsoftint) + ENTRY_NP(kdi_setsoftint) save %sp, -SA(MINFRAME), %sp ! get a new window rdpr %pstate, %l5 andn %l5, PSTATE_IE, %l1 @@ -1628,7 +1628,7 @@ setsoftint(uint64_t iv_p) wrpr %g0, %l5, %pstate ! %pstate = saved %pstate (in %l5) ret restore - SET_SIZE(setsoftint) + SET_SIZE(kdi_setsoftint) #endif /* lint */ diff --git a/usr/src/uts/sun4/os/intr.c b/usr/src/uts/sun4/os/intr.c index 15fcca1791..6ccf1da742 100644 --- a/usr/src/uts/sun4/os/intr.c +++ b/usr/src/uts/sun4/os/intr.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -43,6 +43,7 @@ #include <vm/seg_kp.h> #include <sys/debug.h> #include <sys/cyclic.h> +#include <sys/kdi_impl.h> #include <sys/cpu_sgnblk_defs.h> @@ -130,9 +131,32 @@ poke_cpu_intr(caddr_t arg1, caddr_t arg2) } /* - * siron - primitive for sun/os/softint.c + * kmdb uses siron (and thus setsoftint) while the world is stopped in order to + * inform its driver component that there's work to be done. We need to keep + * DTrace from instrumenting kmdb's siron and setsoftint. We duplicate siron, + * giving kmdb's version a kdi_ prefix to keep DTrace at bay. The + * implementation of setsoftint is complicated enough that we don't want to + * duplicate it, but at the same time we don't want to preclude tracing either. + * The meat of setsoftint() therefore goes into kdi_setsoftint, with + * setsoftint() implemented as a wrapper. This allows tracing, while still + * providing a way for kmdb to sneak in unmolested. */ void +kdi_siron(void) +{ + if (siron_inum != 0) + kdi_setsoftint(siron_inum); + else + siron_pending = 1; +} + +void +setsoftint(uint64_t inum) +{ + kdi_setsoftint(inum); +} + +void siron(void) { if (siron_inum != 0) |