http://www.gossamer-threads.com/lists/linux/kernel/1037583?search_string=%26quot%3BRework%20disabling%20of%20interrupts%20during%20suspend-resume%26quot%3B;#1037583
|
|
 |
 |

rjw
at sisk
Feb 22, 2009, 9:37 AM
Post #1 of 8 (62 views)
Permalink
|
Hi,
The following two patches modify the way in which we handle disabling
interrupts
during
suspend and enabling them during
resume. Namely, currently
interrupts
are disabled on the boot CPU as soon as the nonboot CPUs have been
disabled, which doesn't allow device drivers' "late" suspend and
"early" resume
callbacks to sleep. Among other things this means they cannot execute
ACPI
AML routines, which leads to problems with suspend-resume
of PCI devices,
as recently discussed on this list.
1/2 is based on an earlier patch from Linus and it only splits up
sysdev_[suspend|resume] from the ["late suspend|"early" resume'] of
devices.
2/2 actually modifies the [suspend|hibernation] and resume code, as
well as the
other code using the device PM framework.
The patches have been initially tested and they don't appear to break
suspend
on my boxes, but this is the first approximation only. In particular,
I'm not sure
if I did the XEN, kexec and APM parts right, so people with experience
in these
areas are gently requested to have a look and tell me if there's
anything to
fix in there.
Moreover, the real purpose of these changes is to be able to execute
the
"late" suspend and "early" resume device callbacks with timer interrupts
enabled, so that they can use mutexes etc. However, x86 currently
doesn't set
the IRQF_TIMER flag and I need to make it do so before going further in
this
direction and changing the PCI PM framework to take advantage of the
$subject
changes, for example. So, I need to know how to modify x86 timer code
so that
the IRQF_TIMER flag is set by it.
Comments welcome.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

torvalds
at linux-foundation
Feb 22, 2009, 10:13 AM
Post #2 of 8 (61 views)
Permalink
|
On Sun, 22 Feb 2009, Rafael J. Wysocki wrote:
>
> However, x86 currently doesn't set the IRQF_TIMER flag and I need
to
> make it do so before going further in this direction and changing
the
> PCI PM framework to take advantage of the $subject changes, for
example.
Actually, you don't.
The modern form of timer interrupt on x86 is the local apic timer, and
it
doesn't go through the io-apic at all, and is not even visible to the
irq
subsystem. So it stays enabled through this all.
But for old-style timer interrupts,
something like the appended should
do it.
Untested, of course, but it looks obvious enough.
Linus
---
arch/x86/kernel/time_64.c | 2 +-
arch/x86/kernel/vmiclock_32.c | 3 ++-
arch/x86/mach-default/setup.c | 2 +-
arch/x86/mach-voyager/setup.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index e6e695a..241ec39 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -115,7 +115,7 @@ unsigned long __init calibrate_cpu(void)
static struct irqaction irq0 = {
.handler = timer_interrupt,
- .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING,
+ .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING |
IRQF_TIMER,
.mask = CPU_MASK_NONE,
.name = "timer"
};
diff --git a/arch/x86/kernel/vmiclock_32.c
b/arch/x86/kernel/vmiclock_32.c
index bde106c..7a29d5c 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -1,3 +1,4 @@
+
/*
* VMI paravirtual timer support routines.
*
@@ -202,7 +203,7 @@ static irqreturn_t vmi_timer_interrupt(int irq,
void *dev_id)
static struct irqaction vmi_clock_action = {
.name = "vmi-timer",
.handler = vmi_timer_interrupt,
- .flags = IRQF_DISABLED | IRQF_NOBALANCING,
+ .flags = IRQF_DISABLED | IRQF_NOBALANCING, IRQF_TIMER,
.mask = CPU_MASK_ALL,
};
diff --git a/arch/x86/mach-default/setup.c
b/arch/x86/mach-default/setup.c
index a265a7c..d737542 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -96,7 +96,7 @@ void __init trap_init_hook(void)
static struct irqaction irq0 = {
.handler = timer_interrupt,
- .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
+ .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, IRQF_TIMER,
.mask = CPU_MASK_NONE,
.name = "timer"
};
diff --git a/arch/x86/mach-voyager/setup.c
b/arch/x86/mach-voyager/setup.c
index d914a79..4de9e08 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -56,7 +56,7 @@ void __init trap_init_hook(void)
static struct irqaction irq0 = {
.handler = timer_interrupt,
- .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
+ .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, IRQF_TIMER,
.mask = CPU_MASK_NONE,
.name = "timer"
};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

mingo
at elte
Feb 22, 2009, 10:18 AM
Post #3 of 8 (63 views)
Permalink
|
> + .flags = IRQF_DISABLED |
IRQF_NOBALANCING, IRQF_TIMER,
> + .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
IRQF_TIMER,
> + .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
IRQF_TIMER,
s/, IRQF_TIMER/ | IRQF_TIMER
i guess.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

torvalds
at linux-foundation
Feb 22, 2009, 10:25 AM
Post #4 of 8 (61 views)
Permalink
|
On Sun, 22 Feb 2009, Ingo Molnar wrote:
>
> > + .flags =
IRQF_DISABLED | IRQF_NOBALANCING, IRQF_TIMER,
> > + .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
IRQF_TIMER,
> > + .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
IRQF_TIMER,
>
> s/, IRQF_TIMER/ | IRQF_TIMER
>
> i guess.
Oops yes. I got one of them right. I guess that's the same one I
happened
to compile in my config. Duh.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

torvalds
at linux-foundation
Feb 22, 2009, 10:35 AM
Post #5 of 8 (60 views)
Permalink
|
On Sun, 22 Feb 2009, Linus Torvalds wrote:
>
> Oops yes. I got one of them right. I guess that's the same one I
happened
> to compile in my config. Duh.
I committed the trivially fixed version.
I also committed Rafael's patch 1/2 (the one that doesn't actually
change
anything). Even if we don't do this in 2.6.29, I want to make it easy
to
test, and get the infrastructure unified.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

ebiederm
at xmission
Feb 22, 2009, 2:37 PM
Post #6 of 8 (50 views)
Permalink
|
"Rafael J. Wysocki" <rjw[at]sisk.pl> writes:
> Moreover, the real purpose
of these changes is to be able to execute the
> "late" suspend and "early" resume device callbacks with timer interrupts
> enabled, so that they can use mutexes etc. However, x86 currently
doesn't set
> the IRQF_TIMER flag and I need to make it do so before going
further in this
> direction and changing the PCI PM framework to take advantage of
the $subject
> changes, for example. So, I need to know how to modify x86 timer
code so that
> the IRQF_TIMER flag is set by it.
How does this sync with the ACPI requirement that the it's late suspend
MUST
happen with irqs disabled?
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

benh
at kernel
Feb 22, 2009, 2:56 PM
Post #7 of 8 (50 views)
Permalink
|
On Sun, 2009-02-22 at 14:37 -0800, Eric W. Biederman wrote:
> "Rafael J. Wysocki"
<rjw[at]sisk.pl> writes:
>
> > Moreover, the
real purpose of these changes is to be able to execute the
> > "late" suspend and "early" resume device callbacks with timer
interrupts
> > enabled, so that they can use mutexes etc. However, x86
currently doesn't set
> > the IRQF_TIMER flag and I need to make it do so before going
further in this
> > direction and changing the PCI PM framework to take advantage
of the $subject
> > changes, for example. So, I need to know how to modify x86
timer code so that
> > the IRQF_TIMER flag is set by it.
>
> How does this sync with the ACPI requirement that the it's late
suspend MUST
> happen with irqs disabled?
If I understand properly what the intention here is, the sysdev suspend
and later still happens with hard irqs off.
This is purely the layer between suspend and suspend_late at the driver
level that uses the above instead of hard IRQs off in order to be able
to properly order the ACPI calls vs. the driver calls.
Ben.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
|
|
|
 |
 |

torvalds
at linux-foundation
Feb 22, 2009, 3:02 PM
Post #8 of 8 (50 views)
Permalink
|
On Sun, 22 Feb 2009, Eric W. Biederman wrote:
>
> How does this sync with the ACPI requirement that the it's late
suspend MUST
> happen with irqs disabled?
All the system device suspend and the actual CPU power-off still
happens
with CPU interrupts
disabled.
It's just that the regular two-phase device suspend code now runs first
with interrupts
enabled (the regular "->suspend()" callback), and then the
second phase runs with the CPU still having interrupts
on (and taking
timer interrupts),
but with the actual device interrupts
disabled.
Linus |
|
|
|