Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Re: [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts.
       [not found] <S20032632AbXKOURg/20071115201736Z+24020@ftp.linux-mips.org>
@ 2007-11-22 15:41 ` Atsushi Nemoto
  2007-11-22 16:19   ` Ralf Baechle
  2007-11-22 18:43   ` Ralf Baechle
  0 siblings, 2 replies; 4+ messages in thread
From: Atsushi Nemoto @ 2007-11-22 15:41 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

On Thu, 15 Nov 2007 20:17:31 +0000, linux-mips@linux-mips.org wrote:
> Subject: [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts.
> Author: Ralf Baechle <ralf@linux-mips.org> Thu Nov 15 19:37:15 2007 +0000
> Commit: eebc88e5d2cffc07b969c8f426552a44e5ce51f8
> Gitweb: http://www.linux-mips.org/g/linux/eebc88e5
> Branch: master

This might broke probe_irq_on()/probe_irq_off(), since
handle_percpu_irq() does not check IRQ_WAITING bit.

This is a quick fix.  But I'm not sure where is the right place to fix...

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 0ee2567..9d97d4b 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -114,7 +114,9 @@ void __init mips_cpu_irq_init(void)
 		for (i = irq_base; i < irq_base + 2; i++)
 			set_irq_chip(i, &mips_mt_cpu_irq_controller);
 
-	for (i = irq_base + 2; i < irq_base + 8; i++)
+	for (i = irq_base + 2; i < irq_base + 8; i++) {
 		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
 					 handle_percpu_irq);
+		irq_desc[i].status |= IRQ_NOPROBE;
+	}
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts.
  2007-11-22 15:41 ` [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts Atsushi Nemoto
@ 2007-11-22 16:19   ` Ralf Baechle
  2007-11-22 17:23     ` Ralf Baechle
  2007-11-22 18:43   ` Ralf Baechle
  1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2007-11-22 16:19 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Fri, Nov 23, 2007 at 12:41:32AM +0900, Atsushi Nemoto wrote:

> This might broke probe_irq_on()/probe_irq_off(), since
> handle_percpu_irq() does not check IRQ_WAITING bit.

Ok - but does that matter at all?  IRQ probing is only used with ISA
drivers and for those there will be another interrupt controller such as
a i8259 PIC daisy chained to one of the CPU interrupt pins.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts.
  2007-11-22 16:19   ` Ralf Baechle
@ 2007-11-22 17:23     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2007-11-22 17:23 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Thu, Nov 22, 2007 at 04:19:35PM +0000, Ralf Baechle wrote:

> > This might broke probe_irq_on()/probe_irq_off(), since
> > handle_percpu_irq() does not check IRQ_WAITING bit.
> 
> Ok - but does that matter at all?  IRQ probing is only used with ISA
> drivers and for those there will be another interrupt controller such as
> a i8259 PIC daisy chained to one of the CPU interrupt pins.

Ah, I think I now understand the problem.

Seems like no interrupt should ever use IRQ_NOPROBE except ISA interrupts
but unfortunately that flag is not everywhere where it should.  Maybe the
logic should even be negated and the flag become IRQ_PROBE ...

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts.
  2007-11-22 15:41 ` [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts Atsushi Nemoto
  2007-11-22 16:19   ` Ralf Baechle
@ 2007-11-22 18:43   ` Ralf Baechle
  1 sibling, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2007-11-22 18:43 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Fri, Nov 23, 2007 at 12:41:32AM +0900, Atsushi Nemoto wrote:

> This might broke probe_irq_on()/probe_irq_off(), since
> handle_percpu_irq() does not check IRQ_WAITING bit.
> 
> This is a quick fix.  But I'm not sure where is the right place to fix...

Here's a cleaner version.  I guess I should scatter a few more
set_irq_noprobe calls over arch/mips - just not into i8259.c.

  Ralf

diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 971adf6..a92f2d0 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -42,7 +42,9 @@ void __init rm7k_cpu_irq_init(void)
 
 	clear_c0_intcontrol(0x00000f00);		/* Mask all */
 
-	for (i = base; i < base + 4; i++)
+	for (i = base; i < base + 4; i++) {
 		set_irq_chip_and_handler(i, &rm7k_irq_controller,
 					 handle_percpu_irq);
+		set_irq_noprobe(i);
+	}
 }
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 7b04583..3f21538 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -105,4 +105,5 @@ void __init rm9k_cpu_irq_init(void)
 	rm9000_perfcount_irq = base + 1;
 	set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
 				 handle_percpu_irq);
+	set_irq_noprobe(rm9000_perfcount_irq);
 }
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index d06e9c9..c2e3279 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -130,6 +130,24 @@ asmlinkage void spurious_interrupt(void)
 	atomic_inc(&irq_err_count);
 }
 
+void set_irq_noprobe(unsigned int irq)
+{
+	unsigned long flags;
+	struct irq_desc *desc;
+
+	if (irq >= NR_IRQS) {
+		printk(KERN_ERR
+		       "Trying to install type control for IRQ%d\n", irq);
+		return;
+	}
+
+	desc = irq_desc + irq;
+
+	spin_lock_irqsave(&desc->lock, flags);
+	desc->status |= IRQ_NOPROBE;
+	spin_unlock_irqrestore(&desc->lock, flags);
+}
+
 #ifdef CONFIG_KGDB
 extern void breakpoint(void);
 extern void set_debug_traps(void);
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 0ee2567..810f65d 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -114,7 +114,9 @@ void __init mips_cpu_irq_init(void)
 		for (i = irq_base; i < irq_base + 2; i++)
 			set_irq_chip(i, &mips_mt_cpu_irq_controller);
 
-	for (i = irq_base + 2; i < irq_base + 8; i++)
+	for (i = irq_base + 2; i < irq_base + 8; i++) {
 		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
 					 handle_percpu_irq);
+		set_irq_noprobe(i);
+	}
 }
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index a58f0ee..6b60d2a 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -160,4 +160,6 @@ extern void free_irqno(unsigned int irq);
 extern int cp0_compare_irq;
 extern int cp0_perfcount_irq;
 
+extern void set_irq_noprobe(unsigned int irq);
+
 #endif /* _ASM_IRQ_H */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-22 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <S20032632AbXKOURg/20071115201736Z+24020@ftp.linux-mips.org>
2007-11-22 15:41 ` [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts Atsushi Nemoto
2007-11-22 16:19   ` Ralf Baechle
2007-11-22 17:23     ` Ralf Baechle
2007-11-22 18:43   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox