Skip to contentSkip to conversation

2.6.30: hibernation/swsusp lockup due to acpi-cpufreq

DISCUSSION Michael Witten 3 participants 5 messages Jul 4, 2009 – Jul 6, 2009 9 messages not in the archive ACPI

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

On Tue, 16 Jun 2009 23:39:59 +0200, Rafael J. Wysocki wrote
(http://www.spinics.net/lists/linux-acpi/msg22661.html):

Quoted 5 lines

In fact, we need to do this entire thing differently.

The basic problem is that cpufreq_suspend() is a sysdev thing, so it will always be called with iterrupts off and *only* for CPU0. So, it looks like the majority of things we do there is just unnecessary (at least).

What's the status? This bug is driving me nuts.

Thanks,
Michael Witten

PS

See http://groups.google.com/group/linux.kernel/browse_thread/thread/bb3f4e0fc32273c4/e83178dfc9374669

#2 lore raw
Quoted 10 lines · Michael Witten

On Tue, 16 Jun 2009 23:39:59 +0200, Rafael J. Wysocki wrote
(http://www.spinics.net/lists/linux-acpi/msg22661.html):

Quoted 5 lines

In fact, we need to do this entire thing differently.

The basic problem is that cpufreq_suspend() is a sysdev thing, so it will always be called with iterrupts off and *only* for CPU0. So, it looks like the majority of things we do there is just unnecessary (at least).

What's the status? This bug is driving me nuts.

Unfortunately, still unresolved.

Rafael

#3 lore raw
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Michael Witten

On Tue, 16 Jun 2009 23:39:59 +0200, Rafael J. Wysocki wrote
(http://www.spinics.net/lists/linux-acpi/msg22661.html):

Quoted 2 lines

In fact, we need to do this entire thing differently.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

The basic problem is that cpufreq_suspend() is a sysdev thing, so it will always be called with iterrupts off and *only* for CPU0. So, it looks like the majority of things we do there is just unnecessary (at least).

What's the status? This bug is driving me nuts.

Unfortunately, still unresolved.

Looked at this a bit more from acpi cpufreq angle.

But, I feel the patch that Johannes had here
http://lkml.indiana.edu/hypermail/linux/kernel/0906.2/00335.html
is the right fix as we do the same saving and restoring of flags on SMP when cpu==this_cpu. This change will make code in UP same as that in SMP with 1 CPU active.

We can avoid the driver->get call from cpufreq_suspend for the drivers that do not do any freq changes in their suspend methods. But, then we will hit this same problem in cpufreq_resume() path and there we do want to check for adjust_jiffies for all drivers as long as CONSTANT_LOOPS is not set.

Thanks,
Venki

#4 lore raw
Quoted 11 lines · Venkatesh
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Michael Witten

On Tue, 16 Jun 2009 23:39:59 +0200, Rafael J. Wysocki wrote
(http://www.spinics.net/lists/linux-acpi/msg22661.html):

Quoted 5 lines

In fact, we need to do this entire thing differently.

The basic problem is that cpufreq_suspend() is a sysdev thing, so it will always be called with iterrupts off and *only* for CPU0. So, it looks like the majority of things we do there is just unnecessary (at least).

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

What's the status? This bug is driving me nuts.

Unfortunately, still unresolved.

Looked at this a bit more from acpi cpufreq angle.

Thanks!

Quoted 5 lines

But, I feel the patch that Johannes had here
http://lkml.indiana.edu/hypermail/linux/kernel/0906.2/00335.html
is the right fix as we do the same saving and restoring of flags on SMP when cpu==this_cpu. This change will make code in UP same as that in SMP with 1 CPU active.

Andrew didn't like this patch IIRC.

Quoted 5 lines

We can avoid the driver->get call from cpufreq_suspend for the drivers that do not do any freq changes in their suspend methods. But, then we will hit this same problem in cpufreq_resume() path and there we do want to check for adjust_jiffies for all drivers as long as CONSTANT_LOOPS is not set.

Why do we need to call that driver->get from cpufreq_suspend() in the first place? We know we are on CPU0, there are no any other CPUs active and interrupts are disabled, so why do we need to care for any races?

Rafael

#5 lore raw
Quoted 34 lines · Rafael J. Wysocki
Quoted 11 lines · Venkatesh
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Michael Witten

On Tue, 16 Jun 2009 23:39:59 +0200, Rafael J. Wysocki wrote
(http://www.spinics.net/lists/linux-acpi/msg22661.html):

Quoted 5 lines

In fact, we need to do this entire thing differently.

The basic problem is that cpufreq_suspend() is a sysdev thing, so it will always be called with iterrupts off and *only* for CPU0. So, it looks like the majority of things we do there is just unnecessary (at least).

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

What's the status? This bug is driving me nuts.

Unfortunately, still unresolved.

Looked at this a bit more from acpi cpufreq angle.

Thanks!

Quoted 5 lines

But, I feel the patch that Johannes had here
http://lkml.indiana.edu/hypermail/linux/kernel/0906.2/00335.html
is the right fix as we do the same saving and restoring of flags on SMP when cpu==this_cpu. This change will make code in UP same as that in SMP with 1 CPU active.

Andrew didn't like this patch IIRC.

Quoted 5 lines

We can avoid the driver->get call from cpufreq_suspend for the drivers that do not do any freq changes in their suspend methods. But, then we will hit this same problem in cpufreq_resume() path and there we do want to check for adjust_jiffies for all drivers as long as CONSTANT_LOOPS is not set.

Quoted 4 lines

Why do we need to call that driver->get from cpufreq_suspend() in the first place? We know we are on CPU0, there are no any other CPUs active and interrupts are disabled, so why do we need to care for any races?

cpufreq core is trying to get the current frequency on the CPU and call adjust_jiffies(). Both in suspend and resume. Looks like it is needed only for some systems on suspend path, as the driver suspend routine may change freq. But, it is probably needed for most of the systems on resume time as CPU may come up with different freq.
It doesn't care about races. Problem is that ->get method used here is same as the one used in normal system working state. In system working state, ->get has to get the frequency from proper CPU using smp_call_function and int enabled.

I thought Andrew was worried about SMP case. But, we already do this in SMP case
kernel/smp.c:smp_call_function_single()

        if (cpu == this_cpu) {
                local_irq_save(flags);
                func(info);
                local_irq_restore(flags);
        } else {

That patch changes
kernel/up.c:smp_call_function_single()

        local_irq_disable();
        (func)(info);
        local_irq_enable();

to add save and restore flags.

Thanks,
Venki