* [PATCH] Add SA_PERCPU_IRQ flag support
@ 2006-03-17 0:31 Dimitri Sivanich
2006-03-17 2:09 ` Christoph Hellwig
2006-03-17 23:26 ` Andrew Morton
0 siblings, 2 replies; 12+ messages in thread
From: Dimitri Sivanich @ 2006-03-17 0:31 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-ia64, linux-kernel, Christoph Hellwig, Christoph Lameter,
Jes Sorensen
The generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
Not sure why it was left out, but this patch adds that support.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Index: linux/kernel/irq/manage.c
===================================================================
--- linux.orig/kernel/irq/manage.c 2006-03-16 14:05:27.957927445 -0600
+++ linux/kernel/irq/manage.c 2006-03-16 14:06:02.283661867 -0600
@@ -201,6 +201,9 @@ int setup_irq(unsigned int irq, struct i
* The following block of code has to be executed atomically
*/
spin_lock_irqsave(&desc->lock,flags);
+ if (new->flags & SA_PERCPU_IRQ) {
+ desc->status |= IRQ_PER_CPU;
+ }
p = &desc->action;
if ((old = *p) != NULL) {
/* Can't share interrupts unless both agree to */
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-17 0:31 Dimitri Sivanich
@ 2006-03-17 2:09 ` Christoph Hellwig
2006-03-17 23:26 ` Andrew Morton
1 sibling, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2006-03-17 2:09 UTC (permalink / raw)
To: Dimitri Sivanich
Cc: Linus Torvalds, linux-ia64, linux-kernel, Christoph Hellwig,
Christoph Lameter, Jes Sorensen
On Thu, Mar 16, 2006 at 06:31:14PM -0600, Dimitri Sivanich wrote:
> The generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
>
> Not sure why it was left out, but this patch adds that support.
>
> Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
>
> Index: linux/kernel/irq/manage.c
> ===================================================================
> --- linux.orig/kernel/irq/manage.c 2006-03-16 14:05:27.957927445 -0600
> +++ linux/kernel/irq/manage.c 2006-03-16 14:06:02.283661867 -0600
> @@ -201,6 +201,9 @@ int setup_irq(unsigned int irq, struct i
> * The following block of code has to be executed atomically
> */
> spin_lock_irqsave(&desc->lock,flags);
> + if (new->flags & SA_PERCPU_IRQ) {
> + desc->status |= IRQ_PER_CPU;
> + }
looks good, although the braces aren't really needed for single-line
conditionals.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-17 0:31 Dimitri Sivanich
2006-03-17 2:09 ` Christoph Hellwig
@ 2006-03-17 23:26 ` Andrew Morton
2006-03-18 9:49 ` Andrew Morton
1 sibling, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2006-03-17 23:26 UTC (permalink / raw)
To: Dimitri Sivanich; +Cc: torvalds, linux-ia64, linux-kernel, hch, clameter, jes
Dimitri Sivanich <sivanich@sgi.com> wrote:
>
> he generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
>
> Not sure why it was left out, but this patch adds that support.
>
> Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
>
> Index: linux/kernel/irq/manage.c
> ===================================================================
> --- linux.orig/kernel/irq/manage.c 2006-03-16 14:05:27.957927445 -0600
> +++ linux/kernel/irq/manage.c 2006-03-16 14:06:02.283661867 -0600
> @@ -201,6 +201,9 @@ int setup_irq(unsigned int irq, struct i
> * The following block of code has to be executed atomically
> */
> spin_lock_irqsave(&desc->lock,flags);
> + if (new->flags & SA_PERCPU_IRQ) {
> + desc->status |= IRQ_PER_CPU;
> + }
> p = &desc->action;
> if ((old = *p) != NULL) {
> /* Can't share interrupts unless both agree to */
Yes, we're presently going in and needlessly taking desc->lock on every
cpu-local interrupt. However it only appears to affect mmtimer.c at
present.
Shouldn't we also have a check in there, to make sure that all the other
handlers off this IRQ agree about the per-cpuness of this interrupt?
Your patch broke the x86 build, btw..
From: Dimitri Sivanich <sivanich@sgi.com>
The generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
Also, check that all handlers agree to do per-cpu IRQs.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
kernel/irq/manage.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff -puN kernel/irq/manage.c~generic-irq-add-sa_percpu_irq-flag-support kernel/irq/manage.c
--- 25/kernel/irq/manage.c~generic-irq-add-sa_percpu_irq-flag-support Fri Mar 17 15:06:44 2006
+++ 25-akpm/kernel/irq/manage.c Fri Mar 17 15:23:02 2006
@@ -204,10 +204,14 @@ int setup_irq(unsigned int irq, struct i
p = &desc->action;
if ((old = *p) != NULL) {
/* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
+ if (!(old->flags & new->flags & SA_SHIRQ))
+ goto mismatch;
+
+#ifdef ARCH_HAS_IRQ_PER_CPU
+ /* All handlers must agree on per-cpuness */
+ if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU))
+ goto mismatch;
+#endif
/* add new interrupt at end of irq queue */
do {
@@ -219,6 +223,11 @@ int setup_irq(unsigned int irq, struct i
*p = new;
+#ifdef ARCH_HAS_IRQ_PER_CPU
+ if (new->flags & SA_PERCPU_IRQ)
+ desc->status |= IRQ_PER_CPU;
+#endif
+
if (!shared) {
desc->depth = 0;
desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT |
@@ -236,6 +245,12 @@ int setup_irq(unsigned int irq, struct i
register_handler_proc(irq, new);
return 0;
+
+mismatch:
+ spin_unlock_irqrestore(&desc->lock, flags);
+ printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__);
+ dump_stack();
+ return -EBUSY;
}
#ifdef CONFIG_DEBUG_SHIRQ
_
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-17 23:26 ` Andrew Morton
@ 2006-03-18 9:49 ` Andrew Morton
2006-03-20 14:17 ` Dimitri Sivanich
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2006-03-18 9:49 UTC (permalink / raw)
To: sivanich, torvalds, linux-ia64, linux-kernel, hch, clameter, jes
Andrew Morton <akpm@osdl.org> wrote:
>
> +#ifdef ARCH_HAS_IRQ_PER_CPU
> + if (new->flags & SA_PERCPU_IRQ)
> + desc->status |= IRQ_PER_CPU;
> +#endif
OK, five architectures define ARCH_HAS_IRQ_PER_CPU but only one of them
defines SA_PERCPU_IRQ. Giving up.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-18 9:49 ` Andrew Morton
@ 2006-03-20 14:17 ` Dimitri Sivanich
2006-03-20 14:22 ` Matthew Wilcox
0 siblings, 1 reply; 12+ messages in thread
From: Dimitri Sivanich @ 2006-03-20 14:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: torvalds, linux-ia64, linux-kernel, hch, clameter, jes
On Sat, Mar 18, 2006 at 01:49:00AM -0800, Andrew Morton wrote:
> Andrew Morton <akpm@osdl.org> wrote:
> >
> > +#ifdef ARCH_HAS_IRQ_PER_CPU
> > + if (new->flags & SA_PERCPU_IRQ)
> > + desc->status |= IRQ_PER_CPU;
> > +#endif
>
> OK, five architectures define ARCH_HAS_IRQ_PER_CPU but only one of them
> defines SA_PERCPU_IRQ. Giving up.
Could we do the following (at least for now)?:
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ if (new->flags & SA_PERCPU_IRQ)
+ desc->status |= IRQ_PER_CPU;
+#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-20 14:17 ` Dimitri Sivanich
@ 2006-03-20 14:22 ` Matthew Wilcox
2006-03-20 14:25 ` Dimitri Sivanich
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Wilcox @ 2006-03-20 14:22 UTC (permalink / raw)
To: Dimitri Sivanich
Cc: Andrew Morton, torvalds, linux-ia64, linux-kernel, hch, clameter,
jes
On Mon, Mar 20, 2006 at 08:17:47AM -0600, Dimitri Sivanich wrote:
> On Sat, Mar 18, 2006 at 01:49:00AM -0800, Andrew Morton wrote:
> > Andrew Morton <akpm@osdl.org> wrote:
> > >
> > > +#ifdef ARCH_HAS_IRQ_PER_CPU
> > > + if (new->flags & SA_PERCPU_IRQ)
> > > + desc->status |= IRQ_PER_CPU;
> > > +#endif
> >
> > OK, five architectures define ARCH_HAS_IRQ_PER_CPU but only one of them
> > defines SA_PERCPU_IRQ. Giving up.
>
> Could we do the following (at least for now)?:
>
> +#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
> + if (new->flags & SA_PERCPU_IRQ)
> + desc->status |= IRQ_PER_CPU;
> +#endif
Why not just
#ifdef SA_PERCPU_IRQ
if (new->flags & SA_PERCPU_IRQ)
desc->status |= IRQ_PER_CPU;
#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-20 14:22 ` Matthew Wilcox
@ 2006-03-20 14:25 ` Dimitri Sivanich
0 siblings, 0 replies; 12+ messages in thread
From: Dimitri Sivanich @ 2006-03-20 14:25 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Andrew Morton, torvalds, linux-ia64, linux-kernel, hch, clameter,
jes
On Mon, Mar 20, 2006 at 07:22:07AM -0700, Matthew Wilcox wrote:
> On Mon, Mar 20, 2006 at 08:17:47AM -0600, Dimitri Sivanich wrote:
> > On Sat, Mar 18, 2006 at 01:49:00AM -0800, Andrew Morton wrote:
> > > Andrew Morton <akpm@osdl.org> wrote:
> > > >
> > > > +#ifdef ARCH_HAS_IRQ_PER_CPU
> > > > + if (new->flags & SA_PERCPU_IRQ)
> > > > + desc->status |= IRQ_PER_CPU;
> > > > +#endif
> > >
> > > OK, five architectures define ARCH_HAS_IRQ_PER_CPU but only one of them
> > > defines SA_PERCPU_IRQ. Giving up.
> >
> > Could we do the following (at least for now)?:
> >
> > +#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
> > + if (new->flags & SA_PERCPU_IRQ)
> > + desc->status |= IRQ_PER_CPU;
> > +#endif
>
> Why not just
>
> #ifdef SA_PERCPU_IRQ
> if (new->flags & SA_PERCPU_IRQ)
> desc->status |= IRQ_PER_CPU;
> #endif
Fine with me. I was simply maintaining the ARCH_HAS_IRQ_PER_CPU convention.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Add SA_PERCPU_IRQ flag support
@ 2006-03-21 21:38 Dimitri Sivanich
2006-03-21 23:37 ` Andrew Morton
0 siblings, 1 reply; 12+ messages in thread
From: Dimitri Sivanich @ 2006-03-21 21:38 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, hch, clameter, jes
The generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
This patch was posted previously, but this one should build on all arch's.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Index: linux-2.6.15/kernel/irq/manage.c
===================================================================
--- linux-2.6.15.orig/kernel/irq/manage.c 2006-03-20 13:11:01.766522017 -0600
+++ linux-2.6.15/kernel/irq/manage.c 2006-03-21 15:26:12.305876769 -0600
@@ -206,6 +206,10 @@ int setup_irq(unsigned int irq, struct i
* The following block of code has to be executed atomically
*/
spin_lock_irqsave(&desc->lock,flags);
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ if (new->flags & SA_PERCPU_IRQ)
+ desc->status |= IRQ_PER_CPU;
+#endif
p = &desc->action;
if ((old = *p) != NULL) {
/* Can't share interrupts unless both agree to */
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-21 21:38 [PATCH] Add SA_PERCPU_IRQ flag support Dimitri Sivanich
@ 2006-03-21 23:37 ` Andrew Morton
2006-03-21 23:45 ` Christoph Lameter
2006-03-22 0:52 ` Dimitri Sivanich
0 siblings, 2 replies; 12+ messages in thread
From: Andrew Morton @ 2006-03-21 23:37 UTC (permalink / raw)
To: Dimitri Sivanich; +Cc: linux-kernel, hch, clameter, jes
Dimitri Sivanich <sivanich@sgi.com> wrote:
>
> The generic request_irq/setup_irq code should support the SA_PERCPU_IRQ flag.
>
> This patch was posted previously, but this one should build on all arch's.
>
> Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
>
> Index: linux-2.6.15/kernel/irq/manage.c
> ===================================================================
> --- linux-2.6.15.orig/kernel/irq/manage.c 2006-03-20 13:11:01.766522017 -0600
> +++ linux-2.6.15/kernel/irq/manage.c 2006-03-21 15:26:12.305876769 -0600
> @@ -206,6 +206,10 @@ int setup_irq(unsigned int irq, struct i
> * The following block of code has to be executed atomically
> */
> spin_lock_irqsave(&desc->lock,flags);
> +#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
> + if (new->flags & SA_PERCPU_IRQ)
> + desc->status |= IRQ_PER_CPU;
> +#endif
> p = &desc->action;
> if ((old = *p) != NULL) {
> /* Can't share interrupts unless both agree to */
hm. Last time around I pointed out that we should be checking that all
handlers for this IRQ agree about the percpuness. What happened to
that?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-21 23:37 ` Andrew Morton
@ 2006-03-21 23:45 ` Christoph Lameter
2006-03-22 2:00 ` Benjamin Herrenschmidt
2006-03-22 0:52 ` Dimitri Sivanich
1 sibling, 1 reply; 12+ messages in thread
From: Christoph Lameter @ 2006-03-21 23:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dimitri Sivanich, linux-kernel, hch, jes
On Tue, 21 Mar 2006, Andrew Morton wrote:
> hm. Last time around I pointed out that we should be checking that all
> handlers for this IRQ agree about the percpuness. What happened to
> that?
Maybe simply add this patch on top?
Index: linux-2.6.16-rc6-mm2/kernel/irq/manage.c
===================================================================
--- linux-2.6.16-rc6-mm2.orig/kernel/irq/manage.c 2006-03-21 15:41:26.000000000 -0800
+++ linux-2.6.16-rc6-mm2/kernel/irq/manage.c 2006-03-21 15:43:15.000000000 -0800
@@ -204,6 +204,8 @@ int setup_irq(unsigned int irq, struct i
#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
if (new->flags & SA_PERCPU_IRQ)
desc->status |= IRQ_PER_CPU;
+ else
+ BUG_ON(desc->status & IRQ_PER_CPU);
#endif
p = &desc->action;
if ((old = *p) != NULL) {
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-21 23:37 ` Andrew Morton
2006-03-21 23:45 ` Christoph Lameter
@ 2006-03-22 0:52 ` Dimitri Sivanich
1 sibling, 0 replies; 12+ messages in thread
From: Dimitri Sivanich @ 2006-03-22 0:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, hch, clameter, jes
On Tue, Mar 21, 2006 at 03:37:47PM -0800, Andrew Morton wrote:
> hm. Last time around I pointed out that we should be checking that all
> handlers for this IRQ agree about the percpuness. What happened to
> that?
I believe this version has what you are looking for.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Index: linux-2.6.15/kernel/irq/manage.c
===================================================================
--- linux-2.6.15.orig/kernel/irq/manage.c 2006-03-20 13:11:01.766522017 -0600
+++ linux-2.6.15/kernel/irq/manage.c 2006-03-21 18:44:52.297990979 -0600
@@ -209,10 +209,14 @@ int setup_irq(unsigned int irq, struct i
p = &desc->action;
if ((old = *p) != NULL) {
/* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
+ if (!(old->flags & new->flags & SA_SHIRQ))
+ goto mismatch;
+
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ /* All handlers must agree on per-cpuness */
+ if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU))
+ goto mismatch;
+#endif
/* add new interrupt at end of irq queue */
do {
@@ -223,7 +227,10 @@ int setup_irq(unsigned int irq, struct i
}
*p = new;
-
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ if (new->flags & SA_PERCPU_IRQ)
+ desc->status |= IRQ_PER_CPU;
+#endif
if (!shared) {
desc->depth = 0;
desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT |
@@ -241,6 +248,12 @@ int setup_irq(unsigned int irq, struct i
register_handler_proc(irq, new);
return 0;
+
+mismatch:
+ spin_unlock_irqrestore(&desc->lock, flags);
+ printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__);
+ dump_stack();
+ return -EBUSY;
}
/*
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add SA_PERCPU_IRQ flag support
2006-03-21 23:45 ` Christoph Lameter
@ 2006-03-22 2:00 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2006-03-22 2:00 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Andrew Morton, Dimitri Sivanich, linux-kernel, hch, jes
> + else
> + BUG_ON(desc->status & IRQ_PER_CPU);
I see that you are a member of the school of brutalism ! :)
Ben.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-03-22 2:02 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21 21:38 [PATCH] Add SA_PERCPU_IRQ flag support Dimitri Sivanich
2006-03-21 23:37 ` Andrew Morton
2006-03-21 23:45 ` Christoph Lameter
2006-03-22 2:00 ` Benjamin Herrenschmidt
2006-03-22 0:52 ` Dimitri Sivanich
-- strict thread matches above, loose matches on Subject: below --
2006-03-17 0:31 Dimitri Sivanich
2006-03-17 2:09 ` Christoph Hellwig
2006-03-17 23:26 ` Andrew Morton
2006-03-18 9:49 ` Andrew Morton
2006-03-20 14:17 ` Dimitri Sivanich
2006-03-20 14:22 ` Matthew Wilcox
2006-03-20 14:25 ` Dimitri Sivanich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox