2010-07-28 10:54:10

by Ian Campbell

[permalink] [raw]
Subject: [GIT/PATCH 0/4] Do not use IRQF_TIMER for non timer interrupts

Hi Thomas,

A small number of users of IRQF_TIMER are using it for the implied no
suspend behaviour on interrupts which are not timer interrupts.

Therefore the following series renames the IRQF_TIMER flag to
IRQF_NO_SUSPEND and updates the users which are not timer interrupts to
use the new name. IRQF_TIMER is retained as an alias for
IRQF_NO_SUSPEND.

The final patch in the series adds a new user the flag which disables
suspend of Xen IPI IRQs.

Ian.

The following changes since commit fc0f5ac8fe693d1b05f5a928cc48135d1c8b7f2e:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../ericvh/v9fs

are available in the git repository at:

git://xenbits.xensource.com/people/ianc/linux-2.6.git for-irq/irqf-no-suspend

Ian Campbell (4):
irq: rename IRQF_TIMER to IRQF_NO_SUSPEND
ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt
powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts
xen: do not suspend IPI IRQs.

arch/powerpc/platforms/powermac/low_i2c.c | 4 ++--
drivers/input/misc/ixp4xx-beeper.c | 2 +-
drivers/macintosh/via-pmu.c | 4 ++--
drivers/xen/events.c | 1 +
include/linux/interrupt.h | 8 ++++++--
kernel/irq/manage.c | 2 +-
6 files changed, 13 insertions(+), 8 deletions(-)


2010-07-28 10:54:37

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 1/4] irq: rename IRQF_TIMER to IRQF_NO_SUSPEND

Continue to provide IRQF_TIMER as an alias to IRQF_NO_SUSPEND since I
think it is worth preserving the nice self-documenting name (where it
is used appropriately). It also avoid needing to patch all the many
users who are using the flag for an actual timer interrupt.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
include/linux/interrupt.h | 8 ++++++--
kernel/irq/manage.c | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c233113..b9bedd5 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -44,7 +44,7 @@
* IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
* IRQF_SHARED - allow sharing the irq among several devices
* IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
- * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
+ * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
* IRQF_PERCPU - Interrupt is per cpu
* IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
* IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
@@ -53,17 +53,21 @@
* IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
* Used by threaded interrupts which need to keep the
* irq line disabled until the threaded handler has been run.
+ *
+ * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
*/
#define IRQF_DISABLED 0x00000020
#define IRQF_SAMPLE_RANDOM 0x00000040
#define IRQF_SHARED 0x00000080
#define IRQF_PROBE_SHARED 0x00000100
-#define IRQF_TIMER 0x00000200
+#define IRQF_NO_SUSPEND 0x00000200
#define IRQF_PERCPU 0x00000400
#define IRQF_NOBALANCING 0x00000800
#define IRQF_IRQPOLL 0x00001000
#define IRQF_ONESHOT 0x00002000

+#define IRQF_TIMER (IRQF_NO_SUSPEND)
+
/*
* Bits used by threaded handlers:
* IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e149748..c3003e9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -216,7 +216,7 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
{
if (suspend) {
- if (!desc->action || (desc->action->flags & IRQF_TIMER))
+ if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))
return;
desc->status |= IRQ_SUSPENDED;
}
--
1.5.6.5

2010-07-28 10:54:42

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 3/4] powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts

kw_i2c_irq and via_pmu_interrupt are not timer interrupts and
therefore should not use IRQF_TIMER. Use the recently introduced
IRQF_NO_SUSPEND instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/powerpc/platforms/powermac/low_i2c.c | 4 ++--
drivers/macintosh/via-pmu.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 06a137c..1554d29 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -542,11 +542,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
/* Make sure IRQ is disabled */
kw_write_reg(reg_ier, 0);

- /* Request chip interrupt. We set IRQF_TIMER because we don't
+ /* Request chip interrupt. We set IRQF_NO_SUSPEND because we don't
* want that interrupt disabled between the 2 passes of driver
* suspend or we'll have issues running the pfuncs
*/
- if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
+ if (request_irq(host->irq, kw_i2c_irq, IRQF_NO_SUSPEND, "keywest i2c", host))
host->irq = NO_IRQ;

printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 3d4fc0f..5c6b5be 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -400,11 +400,11 @@ static int __init via_pmu_start(void)
printk(KERN_ERR "via-pmu: can't map interrupt\n");
return -ENODEV;
}
- /* We set IRQF_TIMER because we don't want the interrupt to be disabled
+ /* We set IRQF_NO_SUSPEND because we don't want the interrupt to be disabled
* between the 2 passes of driver suspend, we control our own disabling
* for that one
*/
- if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
+ if (request_irq(irq, via_pmu_interrupt, IRQF_NO_SUSPEND, "VIA-PMU", (void *)0)) {
printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
return -ENODEV;
}
--
1.5.6.5

2010-07-28 10:54:53

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 4/4] xen: do not suspend IPI IRQs.

In general the semantics of IPIs are that they are are expected to
continue functioning after dpm_suspend_noirq().

Specifically I have seen a deadlock between the callfunc IPI and the
stop machine used by xen's do_suspend() routine. If one CPU has already
called dpm_suspend_noirq() then there is a window where it can be sent
a callfunc IPI before all the other CPUs have entered stop_cpu().

If this happens then the first CPU ends up spinning in stop_cpu()
waiting for the other to rendezvous in state STOPMACHINE_PREPARE while
the other is spinning in csd_lock_wait().

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: [email protected]
Cc: <[email protected]> # .32.x+: 517d6934: irq: rename IRQF_TIMER to IRQF_NO_SUSPEND
Cc: <[email protected]> # .32.x+
---
drivers/xen/events.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index db8f506..28f133a 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -536,6 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
if (irq < 0)
return irq;

+ irqflags |= IRQF_NO_SUSPEND;
retval = request_irq(irq, handler, irqflags, devname, dev_id);
if (retval != 0) {
unbind_from_irq(irq);
--
1.5.6.5

2010-07-28 10:55:27

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 2/4] ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt

ixp4xx_spkr_interrupt is not a timer interrupt and therefore should
not use IRQF_TIMER. Use the recently introduced IRQF_NO_SUSPEND
instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: [email protected]
---
drivers/input/misc/ixp4xx-beeper.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 9946d73..5c5ea77 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -115,7 +115,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
input_dev->event = ixp4xx_spkr_event;

err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
- IRQF_DISABLED | IRQF_TIMER, "ixp4xx-beeper", (void *) dev->id);
+ IRQF_DISABLED | IRQF_NO_SUSPEND, "ixp4xx-beeper", (void *) dev->id);
if (err)
goto err_free_device;

--
1.5.6.5

2010-07-29 08:49:55

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH 1/4] irq: rename IRQF_TIMER to IRQF_NO_SUSPEND

On Wed, 28 Jul 2010, Ian Campbell wrote:

> Continue to provide IRQF_TIMER as an alias to IRQF_NO_SUSPEND since I
> think it is worth preserving the nice self-documenting name (where it
> is used appropriately). It also avoid needing to patch all the many
> users who are using the flag for an actual timer interrupt.

I'm not happy about the alias. What about:

#define __IRQF_TIMER 0x00000200
#define IRQF_NO_SUSPEND 0x00000400

#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)

Thanks,

tglx

2010-07-29 09:03:40

by Ian Campbell

[permalink] [raw]
Subject: Re: [PATCH 1/4] irq: rename IRQF_TIMER to IRQF_NO_SUSPEND

On Thu, 2010-07-29 at 09:49 +0100, Thomas Gleixner wrote:
> On Wed, 28 Jul 2010, Ian Campbell wrote:
>
> > Continue to provide IRQF_TIMER as an alias to IRQF_NO_SUSPEND since I
> > think it is worth preserving the nice self-documenting name (where it
> > is used appropriately). It also avoid needing to patch all the many
> > users who are using the flag for an actual timer interrupt.
>
> I'm not happy about the alias. What about:
>
> #define __IRQF_TIMER 0x00000200
> #define IRQF_NO_SUSPEND 0x00000400
>
> #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)

Sure, I'll rework along those lines.

Ian.


2010-07-29 10:16:39

by Ian Campbell

[permalink] [raw]
Subject: [GIT/PATCH 0/4] Do not use IRQF_TIMER for non timer interrupts

On Thu, 2010-07-29 at 09:49 +0100, Thomas Gleixner wrote:
> On Wed, 28 Jul 2010, Ian Campbell wrote:
>
> > Continue to provide IRQF_TIMER as an alias to IRQF_NO_SUSPEND since I
> > think it is worth preserving the nice self-documenting name (where it
> > is used appropriately). It also avoid needing to patch all the many
> > users who are using the flag for an actual timer interrupt.
>
> I'm not happy about the alias. What about:
>
> #define __IRQF_TIMER 0x00000200
> #define IRQF_NO_SUSPEND 0x00000400
>
> #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)

Resending with this change. Plus I ran checkpatch on the whole lot (I
previously managed to run it only on the first patch) and fixed the
complaints.

Ian.

The following changes since commit fc0f5ac8fe693d1b05f5a928cc48135d1c8b7f2e:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../ericvh/v9fs

are available in the git repository at:

git://xenbits.xensource.com/people/ianc/linux-2.6.git for-irq/irqf-no-suspend

Ian Campbell (4):
irq: Add new IRQ flag IRQF_NO_SUSPEND
ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt
powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts
xen: do not suspend IPI IRQs.

arch/powerpc/platforms/powermac/low_i2c.c | 5 +++--
drivers/input/misc/ixp4xx-beeper.c | 3 ++-
drivers/macintosh/via-pmu.c | 9 +++++----
drivers/xen/events.c | 1 +
include/linux/interrupt.h | 7 ++++++-
kernel/irq/manage.c | 2 +-
6 files changed, 18 insertions(+), 9 deletions(-)

2010-07-29 10:16:58

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 3/4] powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts

kw_i2c_irq and via_pmu_interrupt are not timer interrupts and
therefore should not use IRQF_TIMER. Use the recently introduced
IRQF_NO_SUSPEND instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/powerpc/platforms/powermac/low_i2c.c | 5 +++--
drivers/macintosh/via-pmu.c | 9 +++++----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 06a137c..480567e 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -542,11 +542,12 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
/* Make sure IRQ is disabled */
kw_write_reg(reg_ier, 0);

- /* Request chip interrupt. We set IRQF_TIMER because we don't
+ /* Request chip interrupt. We set IRQF_NO_SUSPEND because we don't
* want that interrupt disabled between the 2 passes of driver
* suspend or we'll have issues running the pfuncs
*/
- if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
+ if (request_irq(host->irq, kw_i2c_irq, IRQF_NO_SUSPEND,
+ "keywest i2c", host))
host->irq = NO_IRQ;

printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 3d4fc0f..35bc273 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -400,11 +400,12 @@ static int __init via_pmu_start(void)
printk(KERN_ERR "via-pmu: can't map interrupt\n");
return -ENODEV;
}
- /* We set IRQF_TIMER because we don't want the interrupt to be disabled
- * between the 2 passes of driver suspend, we control our own disabling
- * for that one
+ /* We set IRQF_NO_SUSPEND because we don't want the interrupt
+ * to be disabled between the 2 passes of driver suspend, we
+ * control our own disabling for that one
*/
- if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
+ if (request_irq(irq, via_pmu_interrupt, IRQF_NO_SUSPEND,
+ "VIA-PMU", (void *)0)) {
printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
return -ENODEV;
}
--
1.5.6.5

2010-07-29 10:17:01

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 4/4] xen: do not suspend IPI IRQs.

In general the semantics of IPIs are that they are are expected to
continue functioning after dpm_suspend_noirq().

Specifically I have seen a deadlock between the callfunc IPI and the
stop machine used by xen's do_suspend() routine. If one CPU has already
called dpm_suspend_noirq() then there is a window where it can be sent
a callfunc IPI before all the other CPUs have entered stop_cpu().

If this happens then the first CPU ends up spinning in stop_cpu()
waiting for the other to rendezvous in state STOPMACHINE_PREPARE while
the other is spinning in csd_lock_wait().

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: [email protected]
Cc: <[email protected]> # .32.x+: ab68ca3d: irq: Add new IRQ flag IRQF_NO_SUSPEND
Cc: <[email protected]> # .32.x+
---
drivers/xen/events.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index db8f506..28f133a 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -536,6 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
if (irq < 0)
return irq;

+ irqflags |= IRQF_NO_SUSPEND;
retval = request_irq(irq, handler, irqflags, devname, dev_id);
if (retval != 0) {
unbind_from_irq(irq);
--
1.5.6.5

2010-07-29 10:16:55

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 1/4] irq: Add new IRQ flag IRQF_NO_SUSPEND

A small number of users of IRQF_TIMER are using it for the implied no
suspend behaviour on interrupts which are not timer interrupts.

Therefore add a new IRQF_NO_SUSPEND flag, rename IRQF_TIMER to
__IRQF_TIMER and redefine IRQF_TIMER in terms of these new flags.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
include/linux/interrupt.h | 7 ++++++-
kernel/irq/manage.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c233113..a0384a4 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -53,16 +53,21 @@
* IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
* Used by threaded interrupts which need to keep the
* irq line disabled until the threaded handler has been run.
+ * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
+ *
*/
#define IRQF_DISABLED 0x00000020
#define IRQF_SAMPLE_RANDOM 0x00000040
#define IRQF_SHARED 0x00000080
#define IRQF_PROBE_SHARED 0x00000100
-#define IRQF_TIMER 0x00000200
+#define __IRQF_TIMER 0x00000200
#define IRQF_PERCPU 0x00000400
#define IRQF_NOBALANCING 0x00000800
#define IRQF_IRQPOLL 0x00001000
#define IRQF_ONESHOT 0x00002000
+#define IRQF_NO_SUSPEND 0x00004000
+
+#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)

/*
* Bits used by threaded handlers:
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e149748..c3003e9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -216,7 +216,7 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
{
if (suspend) {
- if (!desc->action || (desc->action->flags & IRQF_TIMER))
+ if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))
return;
desc->status |= IRQ_SUSPENDED;
}
--
1.5.6.5

2010-07-29 10:16:57

by Ian Campbell

[permalink] [raw]
Subject: [PATCH 2/4] ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt

ixp4xx_spkr_interrupt is not a timer interrupt and therefore should
not use IRQF_TIMER. Use the recently introduced IRQF_NO_SUSPEND
instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: [email protected]
---
drivers/input/misc/ixp4xx-beeper.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 9946d73..9dfd6e5 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -115,7 +115,8 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
input_dev->event = ixp4xx_spkr_event;

err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
- IRQF_DISABLED | IRQF_TIMER, "ixp4xx-beeper", (void *) dev->id);
+ IRQF_DISABLED | IRQF_NO_SUSPEND, "ixp4xx-beeper",
+ (void *) dev->id);
if (err)
goto err_free_device;

--
1.5.6.5

2010-07-29 11:31:12

by Ian Campbell

[permalink] [raw]
Subject: [tip:irq/core] irq: Add new IRQ flag IRQF_NO_SUSPEND

Commit-ID: 685fd0b4ea3f0f1d5385610b0d5b57775a8d5842
Gitweb: http://git.kernel.org/tip/685fd0b4ea3f0f1d5385610b0d5b57775a8d5842
Author: Ian Campbell <[email protected]>
AuthorDate: Thu, 29 Jul 2010 11:16:32 +0100
Committer: Thomas Gleixner <[email protected]>
CommitDate: Thu, 29 Jul 2010 13:24:57 +0200

irq: Add new IRQ flag IRQF_NO_SUSPEND

A small number of users of IRQF_TIMER are using it for the implied no
suspend behaviour on interrupts which are not timer interrupts.

Therefore add a new IRQF_NO_SUSPEND flag, rename IRQF_TIMER to
__IRQF_TIMER and redefine IRQF_TIMER in terms of these new flags.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
include/linux/interrupt.h | 7 ++++++-
kernel/irq/manage.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c233113..a0384a4 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -53,16 +53,21 @@
* IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
* Used by threaded interrupts which need to keep the
* irq line disabled until the threaded handler has been run.
+ * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
+ *
*/
#define IRQF_DISABLED 0x00000020
#define IRQF_SAMPLE_RANDOM 0x00000040
#define IRQF_SHARED 0x00000080
#define IRQF_PROBE_SHARED 0x00000100
-#define IRQF_TIMER 0x00000200
+#define __IRQF_TIMER 0x00000200
#define IRQF_PERCPU 0x00000400
#define IRQF_NOBALANCING 0x00000800
#define IRQF_IRQPOLL 0x00001000
#define IRQF_ONESHOT 0x00002000
+#define IRQF_NO_SUSPEND 0x00004000
+
+#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)

/*
* Bits used by threaded handlers:
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e149748..c3003e9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -216,7 +216,7 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
{
if (suspend) {
- if (!desc->action || (desc->action->flags & IRQF_TIMER))
+ if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))
return;
desc->status |= IRQ_SUSPENDED;
}

2010-07-29 11:31:25

by Ian Campbell

[permalink] [raw]
Subject: [tip:irq/core] ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt

Commit-ID: 2dd9320305416c171087d5347a6c908ae22c6be1
Gitweb: http://git.kernel.org/tip/2dd9320305416c171087d5347a6c908ae22c6be1
Author: Ian Campbell <[email protected]>
AuthorDate: Thu, 29 Jul 2010 11:16:33 +0100
Committer: Thomas Gleixner <[email protected]>
CommitDate: Thu, 29 Jul 2010 13:24:57 +0200

ixp4xx-beeper: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupt

ixp4xx_spkr_interrupt is not a timer interrupt and therefore should
not use IRQF_TIMER. Use the recently introduced IRQF_NO_SUSPEND
instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
drivers/input/misc/ixp4xx-beeper.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 9946d73..9dfd6e5 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -115,7 +115,8 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
input_dev->event = ixp4xx_spkr_event;

err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
- IRQF_DISABLED | IRQF_TIMER, "ixp4xx-beeper", (void *) dev->id);
+ IRQF_DISABLED | IRQF_NO_SUSPEND, "ixp4xx-beeper",
+ (void *) dev->id);
if (err)
goto err_free_device;

2010-07-29 11:32:01

by Ian Campbell

[permalink] [raw]
Subject: [tip:irq/core] xen: Do not suspend IPI IRQs.

Commit-ID: 4877c737283813bdb4bebfa3168c1585f6e3a8ca
Gitweb: http://git.kernel.org/tip/4877c737283813bdb4bebfa3168c1585f6e3a8ca
Author: Ian Campbell <[email protected]>
AuthorDate: Thu, 29 Jul 2010 11:16:35 +0100
Committer: Thomas Gleixner <[email protected]>
CommitDate: Thu, 29 Jul 2010 13:24:58 +0200

xen: Do not suspend IPI IRQs.

In general the semantics of IPIs are that they are are expected to
continue functioning after dpm_suspend_noirq().

Specifically I have seen a deadlock between the callfunc IPI and the
stop machine used by xen's do_suspend() routine. If one CPU has already
called dpm_suspend_noirq() then there is a window where it can be sent
a callfunc IPI before all the other CPUs have entered stop_cpu().

If this happens then the first CPU ends up spinning in stop_cpu()
waiting for the other to rendezvous in state STOPMACHINE_PREPARE while
the other is spinning in csd_lock_wait().

Signed-off-by: Ian Campbell <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
drivers/xen/events.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index db8f506..28f133a 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -536,6 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
if (irq < 0)
return irq;

+ irqflags |= IRQF_NO_SUSPEND;
retval = request_irq(irq, handler, irqflags, devname, dev_id);
if (retval != 0) {
unbind_from_irq(irq);

2010-07-29 11:33:43

by Ian Campbell

[permalink] [raw]
Subject: [tip:irq/core] powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts

Commit-ID: ba461f094bab2dc09487816b9dfce845796b259d
Gitweb: http://git.kernel.org/tip/ba461f094bab2dc09487816b9dfce845796b259d
Author: Ian Campbell <[email protected]>
AuthorDate: Thu, 29 Jul 2010 11:16:34 +0100
Committer: Thomas Gleixner <[email protected]>
CommitDate: Thu, 29 Jul 2010 13:24:57 +0200

powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts

kw_i2c_irq and via_pmu_interrupt are not timer interrupts and
therefore should not use IRQF_TIMER. Use the recently introduced
IRQF_NO_SUSPEND instead since that is the actual desired behaviour.

Signed-off-by: Ian Campbell <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/powerpc/platforms/powermac/low_i2c.c | 5 +++--
drivers/macintosh/via-pmu.c | 9 +++++----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 06a137c..480567e 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -542,11 +542,12 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
/* Make sure IRQ is disabled */
kw_write_reg(reg_ier, 0);

- /* Request chip interrupt. We set IRQF_TIMER because we don't
+ /* Request chip interrupt. We set IRQF_NO_SUSPEND because we don't
* want that interrupt disabled between the 2 passes of driver
* suspend or we'll have issues running the pfuncs
*/
- if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
+ if (request_irq(host->irq, kw_i2c_irq, IRQF_NO_SUSPEND,
+ "keywest i2c", host))
host->irq = NO_IRQ;

printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 3d4fc0f..35bc273 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -400,11 +400,12 @@ static int __init via_pmu_start(void)
printk(KERN_ERR "via-pmu: can't map interrupt\n");
return -ENODEV;
}
- /* We set IRQF_TIMER because we don't want the interrupt to be disabled
- * between the 2 passes of driver suspend, we control our own disabling
- * for that one
+ /* We set IRQF_NO_SUSPEND because we don't want the interrupt
+ * to be disabled between the 2 passes of driver suspend, we
+ * control our own disabling for that one
*/
- if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
+ if (request_irq(irq, via_pmu_interrupt, IRQF_NO_SUSPEND,
+ "VIA-PMU", (void *)0)) {
printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
return -ENODEV;
}

2010-07-30 10:30:27

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 1/4] irq: Add new IRQ flag IRQF_NO_SUSPEND

On Thu, 2010-07-29 at 11:16 +0100, Ian Campbell wrote:
> A small number of users of IRQF_TIMER are using it for the implied no
> suspend behaviour on interrupts which are not timer interrupts.
>
> Therefore add a new IRQF_NO_SUSPEND flag, rename IRQF_TIMER to
> __IRQF_TIMER and redefine IRQF_TIMER in terms of these new flags.
>
> Signed-off-by: Ian Campbell <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Jeremy Fitzhardinge <[email protected]>
> Cc: Dmitry Torokhov <[email protected]>

Acked-by: Benjamin Herrenschmidt <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> include/linux/interrupt.h | 7 ++++++-
> kernel/irq/manage.c | 2 +-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index c233113..a0384a4 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -53,16 +53,21 @@
> * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
> * Used by threaded interrupts which need to keep the
> * irq line disabled until the threaded handler has been run.
> + * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
> + *
> */
> #define IRQF_DISABLED 0x00000020
> #define IRQF_SAMPLE_RANDOM 0x00000040
> #define IRQF_SHARED 0x00000080
> #define IRQF_PROBE_SHARED 0x00000100
> -#define IRQF_TIMER 0x00000200
> +#define __IRQF_TIMER 0x00000200
> #define IRQF_PERCPU 0x00000400
> #define IRQF_NOBALANCING 0x00000800
> #define IRQF_IRQPOLL 0x00001000
> #define IRQF_ONESHOT 0x00002000
> +#define IRQF_NO_SUSPEND 0x00004000
> +
> +#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
>
> /*
> * Bits used by threaded handlers:
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index e149748..c3003e9 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -216,7 +216,7 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
> void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
> {
> if (suspend) {
> - if (!desc->action || (desc->action->flags & IRQF_TIMER))
> + if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))
> return;
> desc->status |= IRQ_SUSPENDED;
> }

2010-07-30 10:30:58

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 3/4] powerpc: Use IRQF_NO_SUSPEND not IRQF_TIMER for non-timer interrupts

On Thu, 2010-07-29 at 11:16 +0100, Ian Campbell wrote:
> kw_i2c_irq and via_pmu_interrupt are not timer interrupts and
> therefore should not use IRQF_TIMER. Use the recently introduced
> IRQF_NO_SUSPEND instead since that is the actual desired behaviour.
>
> Signed-off-by: Ian Campbell <[email protected]>
> Cc: Thomas Gleixner <[email protected]>

Acked-by: Benjamin Herrenschmidt <[email protected]>

> Cc: Paul Mackerras <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/powerpc/platforms/powermac/low_i2c.c | 5 +++--
> drivers/macintosh/via-pmu.c | 9 +++++----
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
> index 06a137c..480567e 100644
> --- a/arch/powerpc/platforms/powermac/low_i2c.c
> +++ b/arch/powerpc/platforms/powermac/low_i2c.c
> @@ -542,11 +542,12 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
> /* Make sure IRQ is disabled */
> kw_write_reg(reg_ier, 0);
>
> - /* Request chip interrupt. We set IRQF_TIMER because we don't
> + /* Request chip interrupt. We set IRQF_NO_SUSPEND because we don't
> * want that interrupt disabled between the 2 passes of driver
> * suspend or we'll have issues running the pfuncs
> */
> - if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
> + if (request_irq(host->irq, kw_i2c_irq, IRQF_NO_SUSPEND,
> + "keywest i2c", host))
> host->irq = NO_IRQ;
>
> printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
> diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
> index 3d4fc0f..35bc273 100644
> --- a/drivers/macintosh/via-pmu.c
> +++ b/drivers/macintosh/via-pmu.c
> @@ -400,11 +400,12 @@ static int __init via_pmu_start(void)
> printk(KERN_ERR "via-pmu: can't map interrupt\n");
> return -ENODEV;
> }
> - /* We set IRQF_TIMER because we don't want the interrupt to be disabled
> - * between the 2 passes of driver suspend, we control our own disabling
> - * for that one
> + /* We set IRQF_NO_SUSPEND because we don't want the interrupt
> + * to be disabled between the 2 passes of driver suspend, we
> + * control our own disabling for that one
> */
> - if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
> + if (request_irq(irq, via_pmu_interrupt, IRQF_NO_SUSPEND,
> + "VIA-PMU", (void *)0)) {
> printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
> return -ENODEV;
> }