diff options
author | anish <none@none> | 2006-05-05 13:27:41 -0700 |
---|---|---|
committer | anish <none@none> | 2006-05-05 13:27:41 -0700 |
commit | d7b41ca400354f0823f3c776bf7b2b43d2182821 (patch) | |
tree | a0c539b9f383766f43d5d02d5ba41d3566629f88 /usr/src/cmd | |
parent | ad594bad1d26d2ba406bea498f57ac72bd2c0775 (diff) | |
download | illumos-gate-d7b41ca400354f0823f3c776bf7b2b43d2182821.tar.gz |
6381739 mdb ::interrupts shouldn't print information for unloaded driver modules
6417129 ::interrupts format needs improvement
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/Makefile | 12 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c | 74 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/Makefile | 12 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/amd64/Makefile | 9 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/ia32/Makefile | 9 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c | 80 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h | 68 | ||||
-rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c | 85 |
8 files changed, 219 insertions, 130 deletions
diff --git a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/Makefile b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/Makefile index 08c851c0c7..fddfa8db13 100644 --- a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/Makefile +++ b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/Makefile @@ -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 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -28,7 +27,7 @@ MODULE = pcplusmp.so MDBTGT = kvm -MODSRCS = apic.c +MODSRCS = apic.c intr_common.c include ../../../../../Makefile.cmd include ../../../../../Makefile.cmd.64 @@ -36,7 +35,10 @@ include ../../../../intel/Makefile.amd64 include ../../../Makefile.i86pc include ../../../../Makefile.module +MODSRCS_DIR = ../../uppc + CPPFLAGS += -DMP -D_MACHDEP CPPFLAGS += -I../../../../common +CPPFLAGS += -I../../uppc CPPFLAGS += -I$(SRC)/uts/intel CPPFLAGS += -I$(SRC)/uts/i86pc diff --git a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c index ac00ae5c52..b305351429 100644 --- a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c +++ b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c @@ -25,12 +25,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#include <stddef.h> -#include <sys/mdb_modapi.h> -#include <mdb/mdb_ks.h> -#include <sys/modctl.h> -#include <sys/avintr.h> -#include <io/pcplusmp/apic.h> +#include "intr_common.h" /* * Globals @@ -60,26 +55,6 @@ static char *businfo_array[] = { static struct av_head avec_tbl[APIC_MAX_VECTOR+1]; - -/* - * Option usage - */ -#define INTR_DISPLAY_DRVR_INST 0x1 /* -d option */ -#define INTR_DISPLAY_INTRSTAT 0x2 /* -i option */ - -int option_flags; - - -void -interrupt_help(void) -{ - mdb_printf("Prints the interrupt usage on the system.\n" - "By default, only interrupt service routine names are printed.\n\n" - "Switches:\n" - " -d instead of ISR, print <driver_name><instance#>\n" - " -i show like intrstat, cpu# ISR/<driver_name><instance#>\n"); -} - /* * get_interrupt_type: * @@ -103,7 +78,6 @@ get_interrupt_type(short index) return ("Fixed"); } - /* * interrupt_display_info: * @@ -113,15 +87,12 @@ static void interrupt_display_info(apic_irq_t irqp, int i) { int bus_type; - int share_cnt; + int j; char *intr_type; char ioapic_iline[10]; char ipl[3]; - char driver_name[MODMAXNAMELEN + 1]; char cpu_assigned[4]; uchar_t assigned_cpu; - uintptr_t dip_addr; - struct dev_info dev_info; struct autovec avhp; /* If invalid index; continue */ @@ -158,20 +129,18 @@ interrupt_display_info(apic_irq_t irqp, int i) (void) mdb_snprintf(cpu_assigned, 4, "ALL"); (void) mdb_snprintf(ipl, 3, "%d", avec_tbl[i].avh_hi_pri); } else { - (void) mdb_snprintf(cpu_assigned, 4, "0x%x", assigned_cpu); + (void) mdb_snprintf(cpu_assigned, 4, "%d", assigned_cpu); (void) mdb_snprintf(ipl, 3, "%d", irqp.airq_ipl); } - share_cnt = irqp.airq_share; - /* Print each interrupt entry */ if (option_flags & INTR_DISPLAY_INTRSTAT) mdb_printf("cpu%s\t", cpu_assigned); else - mdb_printf("%3d 0x%x %-3s %-5s %-6s%-4s %2d %-9s ", + mdb_printf("%-3d 0x%x %-3s %-5s %-6s%-4s%-3d %-9s ", i, irqp.airq_vector, ipl, (bus_type ? businfo_array[bus_type] : " "), - intr_type, cpu_assigned, share_cnt, ioapic_iline); + intr_type, cpu_assigned, irqp.airq_share, ioapic_iline); /* If valid dip found; print driver name */ if (irqp.airq_dip) { @@ -181,22 +150,21 @@ interrupt_display_info(apic_irq_t irqp, int i) /* * Loop thru all the shared IRQs */ - while (irqp.airq_mps_intr_index != FREE_INDEX && - share_cnt-- > 0) { - if (option_flags & INTR_DISPLAY_DRVR_INST) { - dip_addr = (uintptr_t)avhp.av_dip; - if (dip_addr && mdb_devinfo2driver(dip_addr, - driver_name, sizeof (driver_name)) == 0) { - (void) mdb_vread(&dev_info, - sizeof (dev_info), dip_addr); - mdb_printf("%s#%d", driver_name, - dev_info.devi_instance); - } - } else - mdb_printf("%a", avhp.av_vector); + if (irqp.airq_share) + interrupt_print_isr((uintptr_t)avhp.av_vector, + (uintptr_t)avhp.av_intarg1, (uintptr_t)avhp.av_dip); + + for (j = 1; irqp.airq_mps_intr_index != FREE_INDEX && + j < irqp.airq_share; j++) { if (mdb_vread(&avhp, sizeof (struct autovec), - (uintptr_t)avhp.av_link) != -1) + (uintptr_t)avhp.av_link) != -1) { mdb_printf(", "); + interrupt_print_isr((uintptr_t)avhp.av_vector, + (uintptr_t)avhp.av_intarg1, + (uintptr_t)avhp.av_dip); + } else { + break; + } } } else { @@ -280,5 +248,11 @@ static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, NULL }; const mdb_modinfo_t * _mdb_init(void) { + GElf_Sym sym; + + if (mdb_lookup_by_name("gld_intr", &sym) != -1) + if (GELF_ST_TYPE(sym.st_info) == STT_FUNC) + gld_intr_addr = (uintptr_t)sym.st_value; + return (&modinfo); } diff --git a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/Makefile b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/Makefile index fe103446ae..3964bf6bde 100644 --- a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/Makefile +++ b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/Makefile @@ -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 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -28,14 +27,17 @@ MODULE = pcplusmp.so MDBTGT = kvm -MODSRCS = apic.c +MODSRCS = apic.c intr_common.c include ../../../../../Makefile.cmd include ../../../../intel/Makefile.ia32 include ../../../Makefile.i86pc include ../../../../Makefile.module +MODSRCS_DIR = ../../uppc + CPPFLAGS += -DMP -D_MACHDEP CPPFLAGS += -I../../../../common +CPPFLAGS += -I../../uppc CPPFLAGS += -I$(SRC)/uts/intel CPPFLAGS += -I$(SRC)/uts/i86pc diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/amd64/Makefile b/usr/src/cmd/mdb/i86pc/modules/uppc/amd64/Makefile index 5d087152f4..0bcf1cd107 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/amd64/Makefile +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/amd64/Makefile @@ -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 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -28,7 +27,7 @@ MODULE = uppc.so MDBTGT = kvm -MODSRCS = uppc.c +MODSRCS = uppc.c intr_common.c include ../../../../../Makefile.cmd include ../../../../../Makefile.cmd.64 diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/ia32/Makefile b/usr/src/cmd/mdb/i86pc/modules/uppc/ia32/Makefile index b0c6d4be65..e7778d3e05 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/ia32/Makefile +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/ia32/Makefile @@ -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 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -28,7 +27,7 @@ MODULE = uppc.so MDBTGT = kvm -MODSRCS = uppc.c +MODSRCS = uppc.c intr_common.c include ../../../../../Makefile.cmd include ../../../../intel/Makefile.ia32 diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c new file mode 100644 index 0000000000..93b1648689 --- /dev/null +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * 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. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include "intr_common.h" +#include <sys/multidata.h> +#include <sys/gld.h> +#include <sys/gldpriv.h> + + +int option_flags; +uintptr_t gld_intr_addr; + +void +interrupt_help(void) +{ + mdb_printf("Prints the interrupt usage on the system.\n" + "By default, only interrupt service routine names are printed.\n\n" + "Switches:\n" + " -d instead of ISR, print <driver_name><instance#>\n" + " -i show like intrstat, cpu# ISR/<driver_name><instance#>\n"); +} + +void +interrupt_print_isr(uintptr_t vector, uintptr_t arg1, uintptr_t dip) +{ + uintptr_t isr_addr = vector; + struct dev_info dev_info; + + /* + * figure out the real ISR function name from gld_intr() + */ + if (isr_addr == gld_intr_addr) { + gld_mac_info_t macinfo; + + if (mdb_vread(&macinfo, sizeof (gld_mac_info_t), arg1) != -1) { + /* verify gld data structure and get the real ISR */ + if (macinfo.gldm_GLD_version == GLD_VERSION) + isr_addr = (uintptr_t)macinfo.gldm_intr; + } + } + + if ((option_flags & INTR_DISPLAY_DRVR_INST) && dip) { + char drvr_name[MODMAXNAMELEN + 1]; + + if (dip && mdb_devinfo2driver(dip, drvr_name, + sizeof (drvr_name)) == 0) { + (void) mdb_vread(&dev_info, sizeof (dev_info), dip); + mdb_printf("%s#%d", drvr_name, dev_info.devi_instance); + } else { + mdb_printf("%a", isr_addr); + } + + } else { + mdb_printf("%a", isr_addr); + } +} diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h new file mode 100644 index 0000000000..f0a9cf05d2 --- /dev/null +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * 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. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _MDB_INTR_COMMON_H +#define _MDB_INTR_COMMON_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> +#include <sys/mdb_modapi.h> +#include <mdb/mdb_ks.h> +#include <sys/modctl.h> +#include <sys/avintr.h> +#include <sys/psm_common.h> +#include <sys/pic.h> +#include <io/pcplusmp/apic.h> + +/* + * Function prototypes + */ +void interrupt_help(void); +void interrupt_print_isr(uintptr_t vector, uintptr_t arg1, uintptr_t dip); + +/* + * ::interrupts usage related defines and variables + * -d and -i options are supported and saved in option_flags + */ +#define INTR_DISPLAY_DRVR_INST 0x1 /* -d option */ +#define INTR_DISPLAY_INTRSTAT 0x2 /* -i option */ + +extern int option_flags; + +/* + * gld_intr_addr is used to save address of gld_intr() ISR + */ +extern uintptr_t gld_intr_addr; + +#ifdef __cplusplus +} +#endif + +#endif /* _MDB_INTR_COMMON_H */ diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c b/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c index fd4615bd7d..23c41e3ad0 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c @@ -25,34 +25,10 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#include <stddef.h> -#include <sys/mdb_modapi.h> -#include <mdb/mdb_ks.h> -#include <sys/modctl.h> -#include <sys/avintr.h> -#include <sys/psm_common.h> -#include <sys/pic.h> - -static struct av_head avec_tbl[256]; -static uint16_t shared_tbl[MAX_ISA_IRQ + 1]; - -/* - * Option usage - */ -#define INTR_DISPLAY_DRVR_INST 0x1 /* -d option */ -#define INTR_DISPLAY_INTRSTAT 0x2 /* -i option */ +#include "intr_common.h" -int option_flags; - -void -interrupt_help(void) -{ - mdb_printf("Prints the interrupt usage on the system.\n" - "By default, only interrupt service routine names are printed.\n\n" - "Switches:\n" - " -d instead of ISR, print <driver_name><instance#>\n" - " -i show like intrstat, cpu# ISR/<driver_name><instance#>\n"); -} +static struct av_head avec_tbl[APIC_MAX_VECTOR+1]; +static uint16_t shared_tbl[MAX_ISA_IRQ + 1]; static char * interrupt_print_bus(uintptr_t dip_addr) @@ -82,26 +58,6 @@ interrupt_print_bus(uintptr_t dip_addr) } -static void -interrupt_print_isr(struct autovec avhp) -{ - char driver_name[MODMAXNAMELEN + 1]; - uintptr_t dip_addr = (uintptr_t)avhp.av_dip; - struct dev_info dev_info; - - if (option_flags & INTR_DISPLAY_DRVR_INST) { - if (dip_addr && mdb_devinfo2driver(dip_addr, driver_name, - sizeof (driver_name)) == 0) { - (void) mdb_vread(&dev_info, sizeof (dev_info), - dip_addr); - mdb_printf("%s#%d", driver_name, - dev_info.devi_instance); - } else - mdb_printf("%a", avhp.av_vector); - } else - mdb_printf("%a", avhp.av_vector); -} - /* * uppc_interrupt_dump: * Dump uppc(7d) interrupt information. @@ -111,7 +67,7 @@ int uppc_interrupt_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { - int i, share_cnt; + int i, j; boolean_t found = B_FALSE; struct autovec avhp; @@ -133,11 +89,10 @@ uppc_interrupt_dump(uintptr_t addr, uint_t flags, int argc, } /* - * All x86 systems load uppc(7d) by default. - * Now, this becomes interesting on APIC based systems. - * 'interrupts' dcmd is supported by both the .so modules - * So, uppc(7d) needs to be unloaded somehow on APIC based systems - * Here a check for shared_tbl[i] and returning NULL takes care of that + * By default, on all x86 systems ::interrupts from uppc(7d) gets + * loaded first. For APIC systems the ::interrupts from pcplusmp(7d) + * ought to be executed. Confusion stems as both modules export the + * same dcmd. */ for (i = 0; i < MAX_ISA_IRQ + 1; i++) if (shared_tbl[i]) { @@ -169,24 +124,28 @@ uppc_interrupt_dump(uintptr_t addr, uint_t flags, int argc, continue; /* Print each interrupt entry */ - share_cnt = shared_tbl[i]; if (option_flags & INTR_DISPLAY_INTRSTAT) mdb_printf("cpu0\t"); else - mdb_printf("%3d 0x%2x %4d/%-2d %-4s %3d ", + mdb_printf("%-3d 0x%2x %4d/%-2d %-4s %-3d ", i, i + PIC_VECTBASE, avec_tbl[i].avh_lo_pri, avec_tbl[i].avh_hi_pri, avhp.av_dip ? interrupt_print_bus((uintptr_t)avhp.av_dip) : " - ", - share_cnt); + shared_tbl[i]); - if (share_cnt) - interrupt_print_isr(avhp); + if (shared_tbl[i]) + interrupt_print_isr((uintptr_t)avhp.av_vector, + (uintptr_t)avhp.av_intarg1, (uintptr_t)avhp.av_dip); - while (share_cnt-- > 0) { + for (j = 1; j < shared_tbl[i]; j++) { if (mdb_vread(&avhp, sizeof (struct autovec), (uintptr_t)avhp.av_link) != -1) { mdb_printf(", "); - interrupt_print_isr(avhp); + interrupt_print_isr((uintptr_t)avhp.av_vector, + (uintptr_t)avhp.av_intarg1, + (uintptr_t)avhp.av_dip); + } else { + break; } } mdb_printf("\n"); @@ -210,5 +169,11 @@ static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, NULL }; const mdb_modinfo_t * _mdb_init(void) { + GElf_Sym sym; + + if (mdb_lookup_by_name("gld_intr", &sym) != -1) + if (GELF_ST_TYPE(sym.st_info) == STT_FUNC) + gld_intr_addr = (uintptr_t)sym.st_value; + return (&modinfo); } |