2006-11-01 12:24:59

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH] swsusp: Use platform mode by default

It has been reported that on some systems the functionality after a resume
from disk is limited if the system is simply powered off during the suspend
instead of using the ACPI S4 suspend (aka platform mode).

Unfortunately the default is currently to power off the system during the
suspend so the users of these systems experience problems after the resume
if they don't switch to the platform mode explicitly. This patch makes swsusp
use the platform mode by default to avoid such situations.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
kernel/power/disk.c | 8 +++++---
kernel/power/main.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6.19-rc4-mm1/kernel/power/main.c
===================================================================
--- linux-2.6.19-rc4-mm1.orig/kernel/power/main.c
+++ linux-2.6.19-rc4-mm1/kernel/power/main.c
@@ -29,7 +29,7 @@
DECLARE_MUTEX(pm_sem);

struct pm_ops *pm_ops;
-suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
+suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM;

/**
* pm_set_ops - Set the global power method table.
Index: linux-2.6.19-rc4-mm1/kernel/power/disk.c
===================================================================
--- linux-2.6.19-rc4-mm1.orig/kernel/power/disk.c
+++ linux-2.6.19-rc4-mm1/kernel/power/disk.c
@@ -62,9 +62,11 @@ static void power_down(suspend_disk_meth

switch(mode) {
case PM_DISK_PLATFORM:
- kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
- error = pm_ops->enter(PM_SUSPEND_DISK);
- break;
+ if (pm_ops && pm_ops->enter) {
+ kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
+ error = pm_ops->enter(PM_SUSPEND_DISK);
+ break;
+ }
case PM_DISK_SHUTDOWN:
kernel_power_off();
break;


2006-11-01 12:45:26

by Stefan Seyfried

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Wed, Nov 01, 2006 at 01:23:14PM +0100, Rafael J. Wysocki wrote:
> It has been reported that on some systems the functionality after a resume
> from disk is limited if the system is simply powered off during the suspend
> instead of using the ACPI S4 suspend (aka platform mode).
>
> Unfortunately the default is currently to power off the system during the
> suspend so the users of these systems experience problems after the resume
> if they don't switch to the platform mode explicitly. This patch makes swsusp
> use the platform mode by default to avoid such situations.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---

Acked-by: Stefan Seyfried <[email protected]>

Some background: i have put this as a default (from userspace, via
echo "platform" > disk) since at least two years (SuSE 9.3, probably
earlier) and have received one single bugreport where using "shutdown"
mode fixed a problem. I had much more reports from users that upgraded
from 9.1 and did not get the new setting about problems with "shutdown"
which were solved by changing to "platform", so from my experience,
"platform" mode is actually working better than "shutdown" mode.

Note that shutdown mode will not lead to spectacular failures, but small
annoyances like incorrectly reported AC / battery state etc.

> Index: linux-2.6.19-rc4-mm1/kernel/power/disk.c
> ===================================================================
> --- linux-2.6.19-rc4-mm1.orig/kernel/power/disk.c
> +++ linux-2.6.19-rc4-mm1/kernel/power/disk.c
> @@ -62,9 +62,11 @@ static void power_down(suspend_disk_meth
>
> switch(mode) {
> case PM_DISK_PLATFORM:
> - kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> - error = pm_ops->enter(PM_SUSPEND_DISK);
> - break;
> + if (pm_ops && pm_ops->enter) {
> + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> + error = pm_ops->enter(PM_SUSPEND_DISK);
> + break;
> + }

I have never heard of a system that had problems with not-present
pm_ops->enter, but this extra safety net cannot hurt.
--
Stefan Seyfried
QA / R&D Team Mobile Devices | "Any ideas, John?"
SUSE LINUX Products GmbH, N?rnberg | "Well, surrounding them's out."

2006-11-01 13:21:28

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Wed 2006-11-01 13:23:14, Rafael J. Wysocki wrote:
> It has been reported that on some systems the functionality after a resume
> from disk is limited if the system is simply powered off during the suspend
> instead of using the ACPI S4 suspend (aka platform mode).
>
> Unfortunately the default is currently to power off the system during the
> suspend so the users of these systems experience problems after the resume
> if they don't switch to the platform mode explicitly. This patch makes swsusp
> use the platform mode by default to avoid such situations.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>

ACK.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2006-11-02 03:38:14

by Brown, Len

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

Applied.

thanks,
-Len

On Wednesday 01 November 2006 07:23, Rafael J. Wysocki wrote:
> It has been reported that on some systems the functionality after a resume
> from disk is limited if the system is simply powered off during the suspend
> instead of using the ACPI S4 suspend (aka platform mode).
>
> Unfortunately the default is currently to power off the system during the
> suspend so the users of these systems experience problems after the resume
> if they don't switch to the platform mode explicitly. This patch makes swsusp
> use the platform mode by default to avoid such situations.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
> kernel/power/disk.c | 8 +++++---
> kernel/power/main.c | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> Index: linux-2.6.19-rc4-mm1/kernel/power/main.c
> ===================================================================
> --- linux-2.6.19-rc4-mm1.orig/kernel/power/main.c
> +++ linux-2.6.19-rc4-mm1/kernel/power/main.c
> @@ -29,7 +29,7 @@
> DECLARE_MUTEX(pm_sem);
>
> struct pm_ops *pm_ops;
> -suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
> +suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM;
>
> /**
> * pm_set_ops - Set the global power method table.
> Index: linux-2.6.19-rc4-mm1/kernel/power/disk.c
> ===================================================================
> --- linux-2.6.19-rc4-mm1.orig/kernel/power/disk.c
> +++ linux-2.6.19-rc4-mm1/kernel/power/disk.c
> @@ -62,9 +62,11 @@ static void power_down(suspend_disk_meth
>
> switch(mode) {
> case PM_DISK_PLATFORM:
> - kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> - error = pm_ops->enter(PM_SUSPEND_DISK);
> - break;
> + if (pm_ops && pm_ops->enter) {
> + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> + error = pm_ops->enter(PM_SUSPEND_DISK);
> + break;
> + }
> case PM_DISK_SHUTDOWN:
> kernel_power_off();
> break;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2007-05-11 08:36:40

by Coywolf Qi Hunt

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

Hello,

(This patch is merged in 2.6.20 as commit
9185cfa92507d07ac787bc73d06c42222eec7239)

With this patch, my desktop no longer powers off after hibernate(8).
It just reboots.

This user land fix can restore the old behavior:
echo shutdown > /sys/power/disk

The commit causes user land breakage. Is this behavior on purpose?

thanks,
Qi

On 02/11/06, Len Brown <[email protected]> wrote:
> Applied.
>
> thanks,
> -Len
>
> On Wednesday 01 November 2006 07:23, Rafael J. Wysocki wrote:
> > It has been reported that on some systems the functionality after a resume
> > from disk is limited if the system is simply powered off during the suspend
> > instead of using the ACPI S4 suspend (aka platform mode).
> >
> > Unfortunately the default is currently to power off the system during the
> > suspend so the users of these systems experience problems after the resume
> > if they don't switch to the platform mode explicitly. This patch makes swsusp
> > use the platform mode by default to avoid such situations.
> >
> > Signed-off-by: Rafael J. Wysocki <[email protected]>
> > ---
> > kernel/power/disk.c | 8 +++++---
> > kernel/power/main.c | 2 +-
> > 2 files changed, 6 insertions(+), 4 deletions(-)
> >
> > Index: linux-2.6.19-rc4-mm1/kernel/power/main.c
> > ===================================================================
> > --- linux-2.6.19-rc4-mm1.orig/kernel/power/main.c
> > +++ linux-2.6.19-rc4-mm1/kernel/power/main.c
> > @@ -29,7 +29,7 @@
> > DECLARE_MUTEX(pm_sem);
> >
> > struct pm_ops *pm_ops;
> > -suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
> > +suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM;
> >
> > /**
> > * pm_set_ops - Set the global power method table.
> > Index: linux-2.6.19-rc4-mm1/kernel/power/disk.c
> > ===================================================================
> > --- linux-2.6.19-rc4-mm1.orig/kernel/power/disk.c
> > +++ linux-2.6.19-rc4-mm1/kernel/power/disk.c
> > @@ -62,9 +62,11 @@ static void power_down(suspend_disk_meth
> >
> > switch(mode) {
> > case PM_DISK_PLATFORM:
> > - kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > - error = pm_ops->enter(PM_SUSPEND_DISK);
> > - break;
> > + if (pm_ops && pm_ops->enter) {
> > + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > + error = pm_ops->enter(PM_SUSPEND_DISK);
> > + break;
> > + }
> > case PM_DISK_SHUTDOWN:
> > kernel_power_off();
> > break;
> > -
--
Qi Yong

2007-05-11 09:17:25

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Friday, 11 May 2007 10:36, Coywolf Qi Hunt wrote:
> Hello,
>
> (This patch is merged in 2.6.20 as commit
> 9185cfa92507d07ac787bc73d06c42222eec7239)
>
> With this patch, my desktop no longer powers off after hibernate(8).
> It just reboots.
>
> This user land fix can restore the old behavior:
> echo shutdown > /sys/power/disk
>
> The commit causes user land breakage. Is this behavior on purpose?

The change to using the 'platform' mode by default was made because some
notebooks didn't suspend and resume correctly in the 'shutdown' mode.

We're working on fixing the breakage, but currently it's difficult, because
none of my testboxes has problems with the 'platform' hibernation and I
cannot reproduce the reported issues.

BTW, which kernel have you tested?

Greetings,
Rafael


> On 02/11/06, Len Brown <[email protected]> wrote:
> > Applied.
> >
> > thanks,
> > -Len
> >
> > On Wednesday 01 November 2006 07:23, Rafael J. Wysocki wrote:
> > > It has been reported that on some systems the functionality after a resume
> > > from disk is limited if the system is simply powered off during the suspend
> > > instead of using the ACPI S4 suspend (aka platform mode).
> > >
> > > Unfortunately the default is currently to power off the system during the
> > > suspend so the users of these systems experience problems after the resume
> > > if they don't switch to the platform mode explicitly. This patch makes swsusp
> > > use the platform mode by default to avoid such situations.
> > >
> > > Signed-off-by: Rafael J. Wysocki <[email protected]>
> > > ---
> > > kernel/power/disk.c | 8 +++++---
> > > kernel/power/main.c | 2 +-
> > > 2 files changed, 6 insertions(+), 4 deletions(-)
> > >
> > > Index: linux-2.6.19-rc4-mm1/kernel/power/main.c
> > > ===================================================================
> > > --- linux-2.6.19-rc4-mm1.orig/kernel/power/main.c
> > > +++ linux-2.6.19-rc4-mm1/kernel/power/main.c
> > > @@ -29,7 +29,7 @@
> > > DECLARE_MUTEX(pm_sem);
> > >
> > > struct pm_ops *pm_ops;
> > > -suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
> > > +suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM;
> > >
> > > /**
> > > * pm_set_ops - Set the global power method table.
> > > Index: linux-2.6.19-rc4-mm1/kernel/power/disk.c
> > > ===================================================================
> > > --- linux-2.6.19-rc4-mm1.orig/kernel/power/disk.c
> > > +++ linux-2.6.19-rc4-mm1/kernel/power/disk.c
> > > @@ -62,9 +62,11 @@ static void power_down(suspend_disk_meth
> > >
> > > switch(mode) {
> > > case PM_DISK_PLATFORM:
> > > - kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > > - error = pm_ops->enter(PM_SUSPEND_DISK);
> > > - break;
> > > + if (pm_ops && pm_ops->enter) {
> > > + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > > + error = pm_ops->enter(PM_SUSPEND_DISK);
> > > + break;
> > > + }
> > > case PM_DISK_SHUTDOWN:
> > > kernel_power_off();
> > > break;
> > > -

--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King

2007-05-11 16:32:40

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default



On Fri, 11 May 2007, Rafael J. Wysocki wrote:
>
> We're working on fixing the breakage, but currently it's difficult, because
> none of my testboxes has problems with the 'platform' hibernation and I
> cannot reproduce the reported issues.

The rule for anything ACPI-related has been: no regressions.

It doesn't matter if something fixes 10 boxes, if it breaks a single one,
it's going to get reverted.

We had much too much of the "two steps forward, one step back" dance with
ACPI a few years ago, which is the reason that rule got installed (and
which is why it's ACPI-only: in some other subsystems we accept the fact
that sometimes we don't know how to fix some hardware issue, but the new
situation is at least better than the old one).

I agree that it can be aggravating to know that you can fix a problem for
some people, but then being limited by the fact that it breaks for others.
But beign able to *rely* on something that used to work is just too
important, and with ACPI, you can never make a good judgement of which way
works better (since it really just depends on some random firmware issues
that we have zero visibility into).

Also, quite often, it may *seem* like something fixes more boxes than it
breaks, but it's because people report *breakage* only, and then a few
months later it turns out that it's exactly the other way around: now it's
a hundred people who report breakage with the *new* code, and the reason
people thought it fixed more than it broke was that the people for whom
the old code worked fine obviously never reported it!

So this is why "a single regression is considered more important than ten
fixes" - because a single regressionr report tends to actually be just the
first indication of a lot of people who simply haven't tested the new code
yet! People for whom the old code is broken are more likely to test new
things.

So I'd just suggest changing the default back to PM_DISK_SHUTDOWN (but
leave the "pm_ops->enter" testing in place - ie not reverting the other
commits in the series).

The patch would look something like this. Coywolf, does this fix it for
you?

Linus

---
kernel/power/disk.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index b5f0543..f6aa06e 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -60,9 +60,9 @@ void hibernation_set_ops(struct hibernation_ops *ops)
}
mutex_lock(&pm_mutex);
hibernation_ops = ops;
- if (ops)
- hibernation_mode = HIBERNATION_PLATFORM;
- else if (hibernation_mode == HIBERNATION_PLATFORM)
+
+ /* Turn off HIBERNATION_PLATFORM if we no longer have any platform ops */
+ if (!ops && hibernation_mode == HIBERNATION_PLATFORM)
hibernation_mode = HIBERNATION_SHUTDOWN;

mutex_unlock(&pm_mutex);

2007-05-11 20:04:22

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Friday, 11 May 2007 18:30, Linus Torvalds wrote:
>
> On Fri, 11 May 2007, Rafael J. Wysocki wrote:
> >
> > We're working on fixing the breakage, but currently it's difficult, because
> > none of my testboxes has problems with the 'platform' hibernation and I
> > cannot reproduce the reported issues.
>
> The rule for anything ACPI-related has been: no regressions.
>
> It doesn't matter if something fixes 10 boxes, if it breaks a single one,
> it's going to get reverted.

[Well, I think I should stop explaining decisions that weren't mine. Yet, I
feel responsible for patches that I sign-off.]

Just to clarify, the change in question isn't new. It was introduced by the
commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
request and with Pavel's acceptance.

> We had much too much of the "two steps forward, one step back" dance with
> ACPI a few years ago, which is the reason that rule got installed (and
> which is why it's ACPI-only: in some other subsystems we accept the fact
> that sometimes we don't know how to fix some hardware issue, but the new
> situation is at least better than the old one).
>
> I agree that it can be aggravating to know that you can fix a problem for
> some people, but then being limited by the fact that it breaks for others.
> But beign able to *rely* on something that used to work is just too
> important, and with ACPI, you can never make a good judgement of which way
> works better (since it really just depends on some random firmware issues
> that we have zero visibility into).
>
> Also, quite often, it may *seem* like something fixes more boxes than it
> breaks, but it's because people report *breakage* only, and then a few
> months later it turns out that it's exactly the other way around: now it's
> a hundred people who report breakage with the *new* code, and the reason
> people thought it fixed more than it broke was that the people for whom
> the old code worked fine obviously never reported it!
>
> So this is why "a single regression is considered more important than ten
> fixes" - because a single regressionr report tends to actually be just the
> first indication of a lot of people who simply haven't tested the new code
> yet! People for whom the old code is broken are more likely to test new
> things.
>
> So I'd just suggest changing the default back to PM_DISK_SHUTDOWN (but
> leave the "pm_ops->enter" testing in place - ie not reverting the other
> commits in the series).

The series actually preserves the 2.6.20/21 behavior. By defaulting back to
PM_DISK_SHUTDOWN, we'll cause some users for whom 2.6.20 and 2.6.21 work to
report this change as a regression, so please let me avoid making this decision
(I'm not the maintainer of the hibernation code after all).

The problem is that we don't know about regressions until somebody reports them
and if that happens after two affected kernel releases, what should we do?

Rafael

2007-05-11 22:53:26

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default



On Fri, 11 May 2007, Rafael J. Wysocki wrote:
>
> Just to clarify, the change in question isn't new. It was introduced by the
> commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
> request and with Pavel's acceptance.

Ok, if it's that old, we migt as leave it in. Clearly there weren't many
regressions, and this isn't a case of other monsters lurking behind a lack
of testers.

Linus

2007-05-11 23:23:39

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

Hi!

> > Just to clarify, the change in question isn't new. It was introduced by the
> > commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
> > request and with Pavel's acceptance.
>
> Ok, if it's that old, we migt as leave it in. Clearly there weren't many
> regressions, and this isn't a case of other monsters lurking behind a lack
> of testers.

Ok, so what is the result?

"platform" is the correct default, because it is as the spec said.

Both were default in recent history, and neither is too horrible. So
I'd prefer "platform" to be default, as it is correct.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2007-05-12 03:52:36

by Len Brown

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

I agree that we should keep the "platform" default,
as it went in 2 releases ago (nearly 6 months) without
any reported failures until this one -- and it fixed
a longstanding issue documented on many machines.

We should debug Qi's failure like any other.
We are actually in better shape on this one than others
because we already know something that works around it.

Qi,
Please open a bug report here:

http://bugzilla.kernel.org/enter_bug.cgi?product=ACPI
in the Power-Off category. There are some other open
poweroff bugs and maybe we'll find a common thread.
Please attach the output from acpidump and
dmesg -s64000.

thanks,
-Len

2007-05-14 00:38:17

by Bill Davidsen

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

Rafael J. Wysocki wrote:
> On Friday, 11 May 2007 18:30, Linus Torvalds wrote:
>> On Fri, 11 May 2007, Rafael J. Wysocki wrote:
>>> We're working on fixing the breakage, but currently it's difficult, because
>>> none of my testboxes has problems with the 'platform' hibernation and I
>>> cannot reproduce the reported issues.
>> The rule for anything ACPI-related has been: no regressions.
>>
>> It doesn't matter if something fixes 10 boxes, if it breaks a single one,
>> it's going to get reverted.
>
> [Well, I think I should stop explaining decisions that weren't mine. Yet, I
> feel responsible for patches that I sign-off.]
>
> Just to clarify, the change in question isn't new. It was introduced by the
> commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
> request and with Pavel's acceptance.
>
>> We had much too much of the "two steps forward, one step back" dance with
>> ACPI a few years ago, which is the reason that rule got installed (and
>> which is why it's ACPI-only: in some other subsystems we accept the fact
>> that sometimes we don't know how to fix some hardware issue, but the new
>> situation is at least better than the old one).
>>
>> I agree that it can be aggravating to know that you can fix a problem for
>> some people, but then being limited by the fact that it breaks for others.
>> But beign able to *rely* on something that used to work is just too
>> important, and with ACPI, you can never make a good judgement of which way
>> works better (since it really just depends on some random firmware issues
>> that we have zero visibility into).
>>
>> Also, quite often, it may *seem* like something fixes more boxes than it
>> breaks, but it's because people report *breakage* only, and then a few
>> months later it turns out that it's exactly the other way around: now it's
>> a hundred people who report breakage with the *new* code, and the reason
>> people thought it fixed more than it broke was that the people for whom
>> the old code worked fine obviously never reported it!
>>
>> So this is why "a single regression is considered more important than ten
>> fixes" - because a single regressionr report tends to actually be just the
>> first indication of a lot of people who simply haven't tested the new code
>> yet! People for whom the old code is broken are more likely to test new
>> things.
>>
>> So I'd just suggest changing the default back to PM_DISK_SHUTDOWN (but
>> leave the "pm_ops->enter" testing in place - ie not reverting the other
>> commits in the series).
>
> The series actually preserves the 2.6.20/21 behavior. By defaulting back to
> PM_DISK_SHUTDOWN, we'll cause some users for whom 2.6.20 and 2.6.21 work to
> report this change as a regression, so please let me avoid making this decision
> (I'm not the maintainer of the hibernation code after all).
>
> The problem is that we don't know about regressions until somebody reports them
> and if that happens after two affected kernel releases, what should we do?
>
I think that one of the reasons people (guilty) don't report problems
with suspend and hibernate is that it's been a problem on and off and
when it breaks people don't bother to chase it, they just don't use it
unless it's critical, or they install suspend2.

I only suggest that if 'platform' is more correct use that, don't change
it again. Then fix platform.

--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

2007-05-14 07:52:16

by Stefan Seyfried

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Fri, May 11, 2007 at 03:51:38PM -0700, Linus Torvalds wrote:
>
>
> On Fri, 11 May 2007, Rafael J. Wysocki wrote:
> >
> > Just to clarify, the change in question isn't new. It was introduced by the
> > commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
> > request and with Pavel's acceptance.
>
> Ok, if it's that old, we migt as leave it in. Clearly there weren't many
> regressions, and this isn't a case of other monsters lurking behind a lack
> of testers.

I pushed for this since on ACPI machines, "platform" is the right thing to do,
and i still think it will only break on machines that have a broken ACPI BIOS.
(Are there machines with broken ACPI BIOS around? ;-)

Your additional "fall back to shutdown if !(ops)"-fix looks very sane,
however, and is definitely a good idea.
--
Stefan Seyfried
QA / R&D Team Mobile Devices | "Any ideas, John?"
SUSE LINUX Products GmbH, N?rnberg | "Well, surrounding them's out."

This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG N?rnberg)

2007-10-17 02:36:17

by Qi Yong

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On 14/05/2007, Stefan Seyfried <[email protected]> wrote:
> On Fri, May 11, 2007 at 03:51:38PM -0700, Linus Torvalds wrote:
> >
> >
> > On Fri, 11 May 2007, Rafael J. Wysocki wrote:
> > >
> > > Just to clarify, the change in question isn't new. It was introduced by the
> > > commit 9185cfa92507d07ac787bc73d06c42222eec7239 before 2.6.20, at Seife's
> > > request and with Pavel's acceptance.
> >
> > Ok, if it's that old, we migt as leave it in. Clearly there weren't many
> > regressions, and this isn't a case of other monsters lurking behind a lack
> > of testers.
>
> I pushed for this since on ACPI machines, "platform" is the right thing to do,
> and i still think it will only break on machines that have a broken ACPI BIOS.
> (Are there machines with broken ACPI BIOS around? ;-)
>
> Your additional "fall back to shutdown if !(ops)"-fix looks very sane,
> however, and is definitely a good idea.

The key point is "fall back to shutdown _only_ if !ops, otherwise
don't touch hibernation_mode". And that solves my problem.
--
Qi Yong

2007-10-17 02:46:25

by Qi Yong

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On 12/05/2007, Linus Torvalds <[email protected]> wrote:
>
>
> On Fri, 11 May 2007, Rafael J. Wysocki wrote:
> >
> > We're working on fixing the breakage, but currently it's difficult, because
> > none of my testboxes has problems with the 'platform' hibernation and I
> > cannot reproduce the reported issues.
>
> The rule for anything ACPI-related has been: no regressions.
>
> It doesn't matter if something fixes 10 boxes, if it breaks a single one,
> it's going to get reverted.
>
> We had much too much of the "two steps forward, one step back" dance with
> ACPI a few years ago, which is the reason that rule got installed (and
> which is why it's ACPI-only: in some other subsystems we accept the fact
> that sometimes we don't know how to fix some hardware issue, but the new
> situation is at least better than the old one).
>
> I agree that it can be aggravating to know that you can fix a problem for
> some people, but then being limited by the fact that it breaks for others.
> But beign able to *rely* on something that used to work is just too
> important, and with ACPI, you can never make a good judgement of which way
> works better (since it really just depends on some random firmware issues
> that we have zero visibility into).
>
> Also, quite often, it may *seem* like something fixes more boxes than it
> breaks, but it's because people report *breakage* only, and then a few
> months later it turns out that it's exactly the other way around: now it's
> a hundred people who report breakage with the *new* code, and the reason
> people thought it fixed more than it broke was that the people for whom
> the old code worked fine obviously never reported it!
>
> So this is why "a single regression is considered more important than ten
> fixes" - because a single regressionr report tends to actually be just the
> first indication of a lot of people who simply haven't tested the new code
> yet! People for whom the old code is broken are more likely to test new
> things.
>
> So I'd just suggest changing the default back to PM_DISK_SHUTDOWN (but
> leave the "pm_ops->enter" testing in place - ie not reverting the other
> commits in the series).
>
> The patch would look something like this. Coywolf, does this fix it for
> you?
>

Yes, it fixes my problem.

(Sorry for this long delayed report. I didn't get the chance to test
and reboot my box.)

This quick test explains me the problem that we should not set
hibernation_mode to HIBERNATION_PLATFORM if it is not !ops". I will
post a formal patch later.

diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index eb72255..8e52553 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -62,7 +62,7 @@ void hibernation_set_ops(struct hibernation_ops *ops)
mutex_lock(&pm_mutex);
hibernation_ops = ops;
if (ops)
- hibernation_mode = HIBERNATION_PLATFORM;
+ ;
else if (hibernation_mode == HIBERNATION_PLATFORM)
hibernation_mode = HIBERNATION_SHUTDOWN;

> Linus
>
> ---
> kernel/power/disk.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/power/disk.c b/kernel/power/disk.c
> index b5f0543..f6aa06e 100644
> --- a/kernel/power/disk.c
> +++ b/kernel/power/disk.c
> @@ -60,9 +60,9 @@ void hibernation_set_ops(struct hibernation_ops *ops)
> }
> mutex_lock(&pm_mutex);
> hibernation_ops = ops;
> - if (ops)
> - hibernation_mode = HIBERNATION_PLATFORM;
> - else if (hibernation_mode == HIBERNATION_PLATFORM)
> +
> + /* Turn off HIBERNATION_PLATFORM if we no longer have any platform ops */
> + if (!ops && hibernation_mode == HIBERNATION_PLATFORM)
> hibernation_mode = HIBERNATION_SHUTDOWN;
>
> mutex_unlock(&pm_mutex);
>


--
Qi Yong

2007-10-17 02:47:39

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default



On Wed, 17 Oct 2007, Qi Yong wrote:
>
> The key point is "fall back to shutdown _only_ if !ops, otherwise
> don't touch hibernation_mode". And that solves my problem.

Please, when resurrecting a five-month-old discussion, give more of the
old context.

I don't know about anybody else, but I get enough email that "five months"
might as well be "last century" when it comes to email discussions, and I
have long since forgotten the details of whatever caused the issue to
begin with ;)

Linus

2007-10-17 04:06:27

by Qi Yong

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Wed, Oct 17, 2007 at 10:46:12AM +0800, Qi Yong wrote:
> On 12/05/2007, Linus Torvalds <[email protected]> wrote:
> >
> >
> > On Fri, 11 May 2007, Rafael J. Wysocki wrote:
> > >
> > > We're working on fixing the breakage, but currently it's difficult, because
> > > none of my testboxes has problems with the 'platform' hibernation and I
> > > cannot reproduce the reported issues.
> >
> > The rule for anything ACPI-related has been: no regressions.
> >
> > It doesn't matter if something fixes 10 boxes, if it breaks a single one,
> > it's going to get reverted.
> >
> > We had much too much of the "two steps forward, one step back" dance with
> > ACPI a few years ago, which is the reason that rule got installed (and
> > which is why it's ACPI-only: in some other subsystems we accept the fact
> > that sometimes we don't know how to fix some hardware issue, but the new
> > situation is at least better than the old one).
> >
> > I agree that it can be aggravating to know that you can fix a problem for
> > some people, but then being limited by the fact that it breaks for others.
> > But beign able to *rely* on something that used to work is just too
> > important, and with ACPI, you can never make a good judgement of which way
> > works better (since it really just depends on some random firmware issues
> > that we have zero visibility into).
> >
> > Also, quite often, it may *seem* like something fixes more boxes than it
> > breaks, but it's because people report *breakage* only, and then a few
> > months later it turns out that it's exactly the other way around: now it's
> > a hundred people who report breakage with the *new* code, and the reason
> > people thought it fixed more than it broke was that the people for whom
> > the old code worked fine obviously never reported it!
> >
> > So this is why "a single regression is considered more important than ten
> > fixes" - because a single regressionr report tends to actually be just the
> > first indication of a lot of people who simply haven't tested the new code
> > yet! People for whom the old code is broken are more likely to test new
> > things.
> >
> > So I'd just suggest changing the default back to PM_DISK_SHUTDOWN (but
> > leave the "pm_ops->enter" testing in place - ie not reverting the other
> > commits in the series).
> >
> > The patch would look something like this. Coywolf, does this fix it for
> > you?
> >
>
> Yes, it fixes my problem.
>
> (Sorry for this long delayed report. I didn't get the chance to test
> and reboot my box.)
>
> This quick test explains me the problem that we should not set
> hibernation_mode to HIBERNATION_PLATFORM if it is not !ops". I will
> post a formal patch later.
>
> diff --git a/kernel/power/disk.c b/kernel/power/disk.c
> index eb72255..8e52553 100644
> --- a/kernel/power/disk.c
> +++ b/kernel/power/disk.c
> @@ -62,7 +62,7 @@ void hibernation_set_ops(struct hibernation_ops *ops)
> mutex_lock(&pm_mutex);
> hibernation_ops = ops;
> if (ops)
> - hibernation_mode = HIBERNATION_PLATFORM;
> + ;
> else if (hibernation_mode == HIBERNATION_PLATFORM)
> hibernation_mode = HIBERNATION_SHUTDOWN;

please apply.

Signed-off-by: Qi Yong <[email protected]>
---

diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index eb72255..95b66ee 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -61,9 +61,11 @@ void hibernation_set_ops(struct hibernation_ops *ops)
}
mutex_lock(&pm_mutex);
hibernation_ops = ops;
- if (ops)
- hibernation_mode = HIBERNATION_PLATFORM;
- else if (hibernation_mode == HIBERNATION_PLATFORM)
+
+ /*
+ * Turn off HIBERNATION_PLATFORM if we no longer have any platform ops.
+ */
+ if (!ops && hibernation_mode == HIBERNATION_PLATFORM)
hibernation_mode = HIBERNATION_SHUTDOWN;

mutex_unlock(&pm_mutex);


>
> > Linus
> >
> > ---
> > kernel/power/disk.c | 6 +++---
> > 1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/power/disk.c b/kernel/power/disk.c
> > index b5f0543..f6aa06e 100644
> > --- a/kernel/power/disk.c
> > +++ b/kernel/power/disk.c
> > @@ -60,9 +60,9 @@ void hibernation_set_ops(struct hibernation_ops *ops)
> > }
> > mutex_lock(&pm_mutex);
> > hibernation_ops = ops;
> > - if (ops)
> > - hibernation_mode = HIBERNATION_PLATFORM;
> > - else if (hibernation_mode == HIBERNATION_PLATFORM)
> > +
> > + /* Turn off HIBERNATION_PLATFORM if we no longer have any platform ops */
> > + if (!ops && hibernation_mode == HIBERNATION_PLATFORM)
> > hibernation_mode = HIBERNATION_SHUTDOWN;
> >
> > mutex_unlock(&pm_mutex);
> >
>
>
> --
> Qi Yong
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2007-10-17 17:16:41

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] swsusp: Use platform mode by default

On Wednesday, 17 October 2007 05:44, Qi Yong wrote:
> On Wed, Oct 17, 2007 at 10:46:12AM +0800, Qi Yong wrote:
> > On 12/05/2007, Linus Torvalds <[email protected]> wrote:
> > > On Fri, 11 May 2007, Rafael J. Wysocki wrote:
[--snip--]
>
> please apply.
>
> Signed-off-by: Qi Yong <[email protected]>
> ---

With your patch applied the default for ACPI systems changes from
HIBERNATION_PLATFORM to HIBERNATION_SHUTDOWN. However,
it has been HIBERNATION_PLATFORM since 2.6.20 and I'd really
prefer it to stay this way.

If HIBERNATION_PLATFORM doesn't work for you, please do
"echo shutdown > /sys/power/disk" before hibernation or, if you use the
userland suspend tools, change the s2disk's configuration file to use the
"shutdown" mode.

> diff --git a/kernel/power/disk.c b/kernel/power/disk.c
> index eb72255..95b66ee 100644
> --- a/kernel/power/disk.c
> +++ b/kernel/power/disk.c
> @@ -61,9 +61,11 @@ void hibernation_set_ops(struct hibernation_ops *ops)
> }
> mutex_lock(&pm_mutex);
> hibernation_ops = ops;
> - if (ops)
> - hibernation_mode = HIBERNATION_PLATFORM;
> - else if (hibernation_mode == HIBERNATION_PLATFORM)
> +
> + /*
> + * Turn off HIBERNATION_PLATFORM if we no longer have any platform ops.
> + */
> + if (!ops && hibernation_mode == HIBERNATION_PLATFORM)
> hibernation_mode = HIBERNATION_SHUTDOWN;
>
> mutex_unlock(&pm_mutex);

Greetings,
Rafael