Remove interrupt debug code
Subsystems (2)
cover Remove interrupt debug code
This patch series removes some interrupt debug code:
printk statements, associated macros, dead code, etc.
Finn Thain (3):
m68k/mac: Improve NMI handler
m68k/mac: Remove SHUTUP_SONIC interrupt hack m68k/mac: Clean up interrupt debug macros and printk statements
arch/m68k/include/asm/macints.h | 16 -------- arch/m68k/mac/baboon.c | 16 -------- arch/m68k/mac/macints.c | 87 ++++------------------------------------- arch/m68k/mac/oss.c | 20 ---------- arch/m68k/mac/psc.c | 11 ------ arch/m68k/mac/via.c | 8 ---- 6 files changed, 8 insertions(+), 150 deletions(-)
Signature · 1 line
2.10.2
PATCH 1/3 m68k/mac: Improve NMI handler
mac_nmi_handler() is useless in its present form and locks up my PowerBook
180. Let's throw out the dead code and make it do something useful: print a register dump and a stack trace.
mac_debug_handler() is also dead code. Remove it along with its static data.
--- arch/m68k/mac/macints.c | 67 ++++++------------------------------------------- 1 file changed, 8 insertions(+), 59 deletions(-)
arch/m68k/mac/macints.c +8 -59
@@ -127,12 +127,9 @@#define SHUTUP_SONIC -/* -* console_loglevel determines NMI handler function -*/ +extern void show_registers (struct pt_regs *);irqreturn_t mac_nmi_handler (int ,void *); -irqreturn_t mac_debug_handler (int ,void *);/* #define DEBUG_MACINTS */
@@ -276,65 +273,17 @@ static void mac_irq_shutdown(struct irq_data *data)mac_irq_disable (data); } -static int num_debug[8 ]; - -irqreturn_t mac_debug_handler (int irq,void *dev_id) -{ -if (num_debug[irq] <10 ) { -printk ("DEBUG: Unexpected IRQ %d\n" , irq); - num_debug[irq]++; - } -return IRQ_HANDLED ; -} - -static int in_nmi; -static volatile int nmi_hold; +static volatile int in_nmi;irqreturn_t mac_nmi_handler (int irq,void *dev_id) { -int i; -/* -* generate debug output on NMI switch if 'debug' kernel option given -* (only works with Penguin!) -*/ - - in_nmi++; -for (i=0 ; i<100 ; i++) -udelay (1000 ); - -if (in_nmi ==1 ) { - nmi_hold =1 ; -printk ("... pausing, press NMI to resume ..." ); - }else { -printk (" ok!\n" ); - nmi_hold =0 ; - } +if (in_nmi) +return IRQ_HANDLED ; + in_nmi =1 ; -barrier (); +pr_info ("Non-Maskable Interrupt\n" ); +show_registers (get_irq_regs ()); -while (nmi_hold ==1 ) -udelay (1000 ); - -if (console_loglevel >=8 ) { -#if 0 -struct pt_regs *fp =get_irq_regs (); -show_state (); -printk ("PC: %08lx\nSR: %04x SP: %p\n" , fp->pc, fp->sr, fp); -printk ("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n" , - fp->d0, fp->d1, fp->d2, fp->d3); -printk ("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n" , - fp->d4, fp->d5, fp->a0, fp->a1); - -if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page) -printk ("Corrupted stack page\n" ); -printk ("Process %s (pid: %d, stackpage=%08lx)\n" , - current->comm, current->pid, current->kernel_stack_page); -if (intr_count ==1 ) -dump_stack ((struct frame *)fp); -#else -/* printk("NMI "); */ -#endif - } - in_nmi--; + in_nmi =0 ;return IRQ_HANDLED ; }
Signature · 1 line
2.10.2
Geert Uytterhoeven
maintainerRe: [PATCH 1/3] m68k/mac: Improve NMI handler
Hi Finn,
Quoted 6 lines · Finn Thain
mac_nmi_handler()is useless in its present form and locks up my PowerBook
180. Let's throw out the dead code and make it do something useful: print a register dump and a stack trace.
mac_debug_handler()is also dead code. Remove it along with its static data.
Thanks for your patch!
arch/m68k/mac/macints.c line 130
Quoted 10 lines
arch/m68k/mac/macints.c +1
-3@@ -127,12 +127,9 @@#define SHUTUP_SONIC -/* -* console_loglevel determines NMI handler function -*/ +extern void show_registers (struct pt_regs *);
Seems like we do have a declaration in ... <linux/kprobes.h>.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 1/3] m68k/mac: Improve NMI handler
Quoted 8 lines · Geert Uytterhoeven
arch/m68k/mac/macints.c line 130
Quoted 5 lines
arch/m68k/mac/macints.c +1
-3-/* -* console_loglevel determines NMI handler function -*/ +extern void show_registers (struct pt_regs *);Seems like we do have a declaration in ... <
linux/kprobes.h>.
Yes, and it would have to be moved outside of the #ifdef CONFIG_KPROBES portion before it could be used by m68k, openrisc, cris or mn10300, which all lack HAVE_KPROBES.
I can't see why linux/kprobes.h is more appropriate for this declaration than, say linux/sched.h.
Despite the checkpatch warning, placing the extern at the call site is very popular.
$ egrep -r "extern.*show_registers" arch/ arch/mips/kernel/unaligned.c:extern void show_registers(struct pt_regs *regs); arch/openrisc/kernel/process.c: extern void show_registers(struct pt_regs *regs); arch/cris/kernel/traps.c:extern void show_registers(struct pt_regs *regs); arch/cris/mm/fault.c:extern void show_registers(struct pt_regs *regs); arch/cris/arch-v32/mach-a3/arbiter.c:extern void show_registers(struct pt_regs *regs); arch/cris/arch-v32/kernel/time.c:extern void show_registers(struct pt_regs *regs); arch/cris/arch-v32/mach-fs/arbiter.c:extern void show_registers(struct pt_regs *regs); arch/mn10300/include/asm/gdb-stub.h:extern void show_registers_only(struct pt_regs *regs); arch/mn10300/include/asm/processor.h:extern void show_registers(struct pt_regs *regs); arch/frv/include/asm/gdb-stub.h:extern void show_registers_only(struct pt_regs *regs); $ $ egrep -r "extern.*show_registers" include/ include/linux/kprobes.h:extern void show_registers(struct pt_regs *regs); $
The situation with show_regs(struct pt_regs *) is a bit better in that the declaration is not found at multiple call sites (as with cris) but still appears in multiple header files.
$ egrep -r "extern.*show_regs" arch/ arch/x86/include/asm/kdebug.h:extern void __show_regs(struct pt_regs *regs, int all); arch/nios2/include/asm/ptrace.h:extern void show_regs(struct pt_regs *); arch/arm/include/asm/bug.h:extern void __show_regs(struct pt_regs *); arch/tile/include/asm/stack.h:extern void tile_show_regs(struct pt_regs *); arch/arm64/include/asm/system_misc.h:extern void __show_regs(struct pt_regs *); arch/c6x/include/asm/ptrace.h:extern void show_regs(struct pt_regs *); arch/avr32/include/asm/processor.h:extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl); arch/unicore32/kernel/setup.h:extern void __show_regs(struct pt_regs *); arch/alpha/kernel/proto.h:extern void dik_show_regs(struct pt_regs *regs, unsigned long *r9_15); $ $ egrep -r "extern.*show_regs" include/ include/linux/sched.h:extern void show_regs(struct pt_regs *); $
I guess we could put a show_registers() declaration in arch/m68k/include/asm/ptrace.h, as that's where struct pt_regs definition comes from (actually uapi/asm/ptrace.h). Both nios2 and c6x do this for show_regs().
Or we could just leave the patch as it is, because thus far m68k has no need for any declaration except a sole call site in macints.c.
Geert Uytterhoeven
maintainerRe: [PATCH 1/3] m68k/mac: Improve NMI handler
Hi Finn,
Quoted 9 lines · Finn Thain
Quoted 7 lines · Geert Uytterhoeven
arch/m68k/mac/macints.c line 130
Quoted 5 lines
arch/m68k/mac/macints.c +1
-3-/* -* console_loglevel determines NMI handler function -*/ +extern void show_registers (struct pt_regs *);Seems like we do have a declaration in ... <
linux/kprobes.h>.
Quoted 3 lines
Yes, and it would have to be moved outside of the #ifdef
CONFIG_KPROBESportion before it could be used by m68k, openrisc, cris or mn10300, which all lackHAVE_KPROBES.
Right, seems my manual cpp made a mistake here. It's indeed inside.
Quoted 2 lines
Or we could just leave the patch as it is, because thus far m68k has no need for any declaration except a sole call site in
macints.c.
Fine for me. Sorry for the noise.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 2/3 m68k/mac: Remove SHUTUP_SONIC interrupt hack
In reply to Finn ThainIn macints.c there is some startup code which disables the SONIC interrupt in an attempt to avoid an unhandled slot interrupt, which would be fatal. This only works on those machines where the SONIC device is on-board.
When the mac_sonic driver is built-in, there's little point in doing this, because the device will be initialized a few seconds later anyway. But when mac_sonic is a module, the window for an unhandled interrupt is longer.
Either way, we've already run the gauntlet for 5 or 10 seconds by the time we get around to disabling this particular device. It's only by sheer luck that we got this far.
Really, this is too little too late. The general problem of unhandled early interrupts also affects other devices on other models. There are better ways to resolve this problem.
1) When using the Penguin bootloader, boot Mac OS with extensions disabled (by holding down the shift key at startup or by use of the Extensions Manager control panel). The Penguin docs already contain this advice, as it is always effective.
2) Have the Penguin bootloader disable the device. It already attempts to disable slot interrupts. But since some hardware cannot mask slot interrupts, Penguin should probably close the relevant device drivers.
3) Use Emile instead of Penguin. AFAIK the boot ROM never enables network device interrupts and hence they don't need to be disabled.
Remove this hack. It requires maintenance and it doesn't solve the problem. It improves the odds for a few models, but so does setting CONFIG_MAC_SONIC=y.
--- arch/m68k/mac/macints.c | 12 ------------ 1 file changed, 12 deletions(-)
arch/m68k/mac/macints.c +0 -12
@@ -125,8 +125,6 @@#include <asm/hwtest.h> #include <asm/irq_regs.h> -#define SHUTUP_SONIC -extern void show_registers (struct pt_regs *);irqreturn_t mac_nmi_handler (int ,void *);
@@ -151,16 +149,6 @@ void __init mac_init_IRQ(void)#endif m68k_setup_irq_controller (&mac_irq_chip, handle_simple_irq,IRQ_USER ,NUM_MAC_SOURCES -IRQ_USER ); -/* Make sure the SONIC interrupt is cleared or things get ugly */ -#ifdef SHUTUP_SONIC -printk ("Killing onboard sonic... " ); -/* This address should hopefully be mapped already */ -if (hwreg_present ((void *)(0x50f0a000 ))) { - *(long *)(0x50f0a014 ) =0x7fffL ; - *(long *)(0x50f0a010 ) =0L ; - } -printk ("Done.\n" ); -#endif /* SHUTUP_SONIC */ /* * Now register the handlers for the master IRQ handlers
Signature · 1 line
2.10.2
PATCH 3/3 m68k/mac: Clean up interrupt debug macros and printk statements
In reply to Finn ThainMac interrupt code has been debugged. The Penguin deficiencies that still cause unhandled interrupts aren't fixable here. Besides, interrupts are fast and frequent and these printk statements were never really useful IMO. Remove them.
--- arch/m68k/include/asm/macints.h | 16 ---------------- arch/m68k/mac/baboon.c | 16 ---------------- arch/m68k/mac/macints.c | 8 -------- arch/m68k/mac/oss.c | 20 -------------------- arch/m68k/mac/psc.c | 11 ----------- arch/m68k/mac/via.c | 8 -------- 6 files changed, 79 deletions(-)
arch/m68k/include/asm/macints.h +0 -16
@@ -14,22 +14,6 @@#include <asm/irq.h> -/* Setting this prints debugging info for unclaimed interrupts */ - -#define DEBUG_SPURIOUS - -/* Setting this prints debugging info on each autovector interrupt */ - -/* #define DEBUG_IRQS */ - -/* Setting this prints debugging info on each Nubus interrupt */ - -/* #define DEBUG_NUBUS_INT */ - -/* Setting this prints debugging info on irqs as they enabled and disabled. */ - -/* #define DEBUG_IRQUSE */ -/* * Base IRQ number for all Mac68K interrupt sources. Each source * has eight indexes (base -> base+7).
arch/m68k/mac/baboon.c +0 -16
@@ -14,8 +14,6 @@#include <asm/macints.h> #include <asm/mac_baboon.h> -/* #define DEBUG_IRQS */ -int baboon_present;static volatile struct baboon *baboon;
@@ -50,12 +48,6 @@ static void baboon_irq(struct irq_desc *desc)int irq_bit, irq_num;unsigned char events; -#ifdef DEBUG_IRQS -printk ("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n" , - (uint ) baboon->mb_control, (uint ) baboon->mb_ifr, - (uint ) baboon->mb_status); -#endif - events = baboon->mb_ifr &0x07 ;if (!events)return ;
@@ -97,18 +89,10 @@ void __init baboon_register_interrupts(void)void baboon_irq_enable (int irq) { -#ifdef DEBUG_IRQUSE -printk ("baboon_irq_enable(%d)\n" , irq); -#endif -mac_irq_enable (irq_get_irq_data (IRQ_NUBUS_C )); }void baboon_irq_disable (int irq) { -#ifdef DEBUG_IRQUSE -printk ("baboon_irq_disable(%d)\n" , irq); -#endif -mac_irq_disable (irq_get_irq_data (IRQ_NUBUS_C )); }
arch/m68k/mac/macints.c +0 -8
@@ -129,8 +129,6 @@ extern void show_registers(struct pt_regs *);irqreturn_t mac_nmi_handler (int ,void *); -/* #define DEBUG_MACINTS */ -static unsigned int mac_irq_startup (struct irq_data *);static void mac_irq_shutdown (struct irq_data *);
@@ -144,9 +142,6 @@ static struct irq_chip mac_irq_chip = {void __init mac_init_IRQ (void ) { -#ifdef DEBUG_MACINTS -printk ("mac_init_IRQ(): Setting things up...\n" ); -#endif m68k_setup_irq_controller (&mac_irq_chip, handle_simple_irq,IRQ_USER ,NUM_MAC_SOURCES -IRQ_USER );
@@ -167,9 +162,6 @@ void __init mac_init_IRQ(void)if (request_irq (IRQ_AUTO_7 , mac_nmi_handler,0 ,"NMI" , mac_nmi_handler))pr_err ("Couldn't register NMI\n" ); -#ifdef DEBUG_MACINTS -printk ("mac_init_IRQ(): Done!\n" ); -#endif }/*
arch/m68k/mac/oss.c +0 -20
@@ -68,15 +68,6 @@ static void oss_irq(struct irq_desc *desc)int events = oss->irq_pending & (OSS_IP_IOPSCC |OSS_IP_SCSI |OSS_IP_IOPISM ); -#ifdef DEBUG_IRQS -if ((console_loglevel ==10 ) && !(events &OSS_IP_SCSI )) { -unsigned int irq =irq_desc_get_irq (desc); - -printk ("oss_irq: irq %u events = 0x%04X\n" , irq, - (int ) oss->irq_pending); - } -#endif -if (events &OSS_IP_IOPSCC ) { oss->irq_pending &= ~OSS_IP_IOPSCC ;generic_handle_irq (IRQ_MAC_SCC );
@@ -107,11 +98,6 @@ static void oss_nubus_irq(struct irq_desc *desc)if (!events)return ; -#ifdef DEBUG_NUBUS_INT -if (console_loglevel >7 ) { -printk ("oss_nubus_irq: events = 0x%04X\n" , events); - } -#endif /* There are only six slots on the OSS, not seven */ i =6 ;
@@ -163,9 +149,6 @@ void __init oss_register_interrupts(void)*/ void oss_irq_enable (int irq) { -#ifdef DEBUG_IRQUSE -printk ("oss_irq_enable(%d)\n" , irq); -#endif switch (irq) {case IRQ_MAC_SCC : oss->irq_level[OSS_IOPSCC ] =OSS_IRQLEV_IOPSCC ;
@@ -199,9 +182,6 @@ void oss_irq_enable(int irq) {*/ void oss_irq_disable (int irq) { -#ifdef DEBUG_IRQUSE -printk ("oss_irq_disable(%d)\n" , irq); -#endif switch (irq) {case IRQ_MAC_SCC : oss->irq_level[OSS_IOPSCC ] =0 ;
arch/m68k/mac/psc.c +0 -11
@@ -122,11 +122,6 @@ static void psc_irq(struct irq_desc *desc)int irq_num;unsigned char irq_bit, events; -#ifdef DEBUG_IRQS -printk ("psc_irq: irq %u pIFR = 0x%02X pIER = 0x%02X\n" , - irq, (int )psc_read_byte (pIFR), (int )psc_read_byte (pIER)); -#endif - events =psc_read_byte (pIFR) &psc_read_byte (pIER) &0xF ;if (!events)return ;
@@ -160,9 +155,6 @@ void psc_irq_enable(int irq) {int irq_idx =IRQ_IDX (irq);int pIER = pIERbase + (irq_src <<4 ); -#ifdef DEBUG_IRQUSE -printk ("psc_irq_enable(%d)\n" , irq); -#endif psc_write_byte (pIER, (1 << irq_idx) |0x80 ); }
@@ -171,8 +163,5 @@ void psc_irq_disable(int irq) {int irq_idx =IRQ_IDX (irq);int pIER = pIERbase + (irq_src <<4 ); -#ifdef DEBUG_IRQUSE -printk ("psc_irq_disable(%d)\n" , irq); -#endif psc_write_byte (pIER,1 << irq_idx); }
arch/m68k/mac/via.c +0 -8
@@ -550,10 +550,6 @@ void via_irq_enable(int irq) {int irq_src =IRQ_SRC (irq);int irq_idx =IRQ_IDX (irq); -#ifdef DEBUG_IRQUSE -printk (KERN_DEBUG "via_irq_enable(%d)\n" , irq); -#endif -if (irq_src ==1 ) { via1[vIER] =IER_SET_BIT (irq_idx); }else if (irq_src ==2 ) {
@@ -582,10 +578,6 @@ void via_irq_disable(int irq) {int irq_src =IRQ_SRC (irq);int irq_idx =IRQ_IDX (irq); -#ifdef DEBUG_IRQUSE -printk (KERN_DEBUG "via_irq_disable(%d)\n" , irq); -#endif -if (irq_src ==1 ) { via1[vIER] =IER_CLR_BIT (irq_idx); }else if (irq_src ==2 ) {
Signature · 1 line
2.10.2
Quoted 8 lines · Finn Thain
This patch series removes some interrupt debug code:
printk statements, associated macros, dead code, etc.Finn Thain (3):
m68k/mac: Improve NMI handler
m68k/mac: RemoveSHUTUP_SONICinterrupt hack m68k/mac: Clean up interrupt debug macros and printk statements
Thanks, applied and queued for v4.11.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds