2011-04-14 22:32:12

by Tino Keitel

[permalink] [raw]
Subject: /proc/acpi/wakeup regression in 2.6.39-rc3

Hi,

with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
this way:

echo USB2 > /proc/acpi/wakeup

This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
"enabled" after the echo command.

Is this intended? If yes, what is the new way to enable keyboard
wakeup?

Regards,
Tino


2011-04-14 22:53:10

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: /proc/acpi/wakeup regression in 2.6.39-rc3

On Friday, April 15, 2011, Tino Keitel wrote:
> Hi,
>
> with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
> this way:
>
> echo USB2 > /proc/acpi/wakeup
>
> This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
> won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
> "enabled" after the echo command.
>
> Is this intended? If yes, what is the new way to enable keyboard
> wakeup?

No, it's supposed to work IIRC. I'll have a look at that code tomorrow.

Thanks,
Rafael

2011-04-15 14:38:51

by Alan Stern

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Fri, 15 Apr 2011, Rafael J. Wysocki wrote:

> On Friday, April 15, 2011, Tino Keitel wrote:
> > Hi,
> >
> > with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
> > this way:
> >
> > echo USB2 > /proc/acpi/wakeup
> >
> > This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
> > won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
> > "enabled" after the echo command.
> >
> > Is this intended? If yes, what is the new way to enable keyboard
> > wakeup?
>
> No, it's supposed to work IIRC. I'll have a look at that code tomorrow.

Tino, can you check the contents of the power/wakeup files in the
appropriate sysfs directories? That would be the directory for the
keyboard device itself and the directory for the USB host controller
for the bus the keyboard is on.

By default, power/wakeup should be "enabled" for the keyboard device
and "disabled" for the host controller. If you write "enabled" into
the host controller's file by hand, does that fix the problem?

Alan Stern

2011-04-15 15:02:11

by Tino Keitel

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Fri, Apr 15, 2011 at 10:38:47 -0400, Alan Stern wrote:
> On Fri, 15 Apr 2011, Rafael J. Wysocki wrote:
>
> > On Friday, April 15, 2011, Tino Keitel wrote:
> > > Hi,
> > >
> > > with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
> > > this way:
> > >
> > > echo USB2 > /proc/acpi/wakeup
> > >
> > > This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
> > > won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
> > > "enabled" after the echo command.
> > >
> > > Is this intended? If yes, what is the new way to enable keyboard
> > > wakeup?
> >
> > No, it's supposed to work IIRC. I'll have a look at that code tomorrow.
>
> Tino, can you check the contents of the power/wakeup files in the
> appropriate sysfs directories? That would be the directory for the
> keyboard device itself and the directory for the USB host controller
> for the bus the keyboard is on.
>
> By default, power/wakeup should be "enabled" for the keyboard device
> and "disabled" for the host controller. If you write "enabled" into
> the host controller's file by hand, does that fix the problem?

I already tried to write "enable" into all USB related wakeup files
yesterday, not change.

I'll check again how these files look like in 2.6.38, what sysfs
wakeup files change when writing into /proc/acpi/wakeup, and what
differences to 2.6.39-rc can be seen.

Regards,
Tino

2011-04-17 18:27:26

by Maciej Rutecki

[permalink] [raw]
Subject: Re: /proc/acpi/wakeup regression in 2.6.39-rc3

I created a Bugzilla entry at
https://bugzilla.kernel.org/show_bug.cgi?id=33472
for your bug report, please add your address to the CC list in there, thanks!

On piÄ…tek, 15 kwietnia 2011 o 00:25:25 Tino Keitel wrote:
> Hi,
>
> with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
> this way:
>
> echo USB2 > /proc/acpi/wakeup
>
> This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
> won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
> "enabled" after the echo command.
>
> Is this intended? If yes, what is the new way to enable keyboard
> wakeup?
>
> Regards,
> Tino
> --
> 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/

--
Maciej Rutecki
http://www.maciek.unixy.pl

2011-04-19 20:21:53

by Tino Keitel

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

Hi,

I reverted some wakeup and ACPI related commits. When I reverted commit
7fa69baf29de8c77a6b32c054df2abb8f11f8aa4, wakeup using the keyboard
worked again and /proc/acpi/wakeup behaved as expected.

So check this, I reverted the following commits to avoid conflicts and
build failures:

c19f9a84ec807da57fd75bbd9a3f2b8269611f79
5190726765b40774c069e187a958e10ccd970e65
2a5d24286e8bdafdc272b37ec5bdd9e977b3767c
f2b56bc808addb908a5bf435d9b942c02af9a7c4
7fa69baf29de8c77a6b32c054df2abb8f11f8aa4

Regards,
Tino

2011-04-19 21:28:27

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Tuesday, April 19, 2011, Tino Keitel wrote:
> Hi,
>
> I reverted some wakeup and ACPI related commits. When I reverted commit
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4, wakeup using the keyboard
> worked again and /proc/acpi/wakeup behaved as expected.

Oh, I doubt that this particular one is the problem.

> So check this, I reverted the following commits to avoid conflicts and
> build failures:
>
> c19f9a84ec807da57fd75bbd9a3f2b8269611f79
> 5190726765b40774c069e187a958e10ccd970e65
> 2a5d24286e8bdafdc272b37ec5bdd9e977b3767c
> f2b56bc808addb908a5bf435d9b942c02af9a7c4
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4

OK, thanks for narrowing this down, I'll have a look at it shortly.

Rafael

2011-04-20 20:33:46

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Tuesday, April 19, 2011, Rafael J. Wysocki wrote:
> On Tuesday, April 19, 2011, Tino Keitel wrote:
> > Hi,
> >
> > I reverted some wakeup and ACPI related commits. When I reverted commit
> > 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4, wakeup using the keyboard
> > worked again and /proc/acpi/wakeup behaved as expected.
>
> Oh, I doubt that this particular one is the problem.
>
> > So check this, I reverted the following commits to avoid conflicts and
> > build failures:
> >
> > c19f9a84ec807da57fd75bbd9a3f2b8269611f79
> > 5190726765b40774c069e187a958e10ccd970e65
> > 2a5d24286e8bdafdc272b37ec5bdd9e977b3767c
> > f2b56bc808addb908a5bf435d9b942c02af9a7c4
> > 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4
>
> OK, thanks for narrowing this down, I'll have a look at it shortly.

I can reproduce the problem, but it seems to affect USB controllers only
and, interestingly enough, it doesn't affect the EHCI controller on my test
system. So, it seems to be specific to USB at least to some extent.

Thanks,
Rafael

2011-04-20 20:57:10

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Friday, April 15, 2011, Tino Keitel wrote:
> On Fri, Apr 15, 2011 at 10:38:47 -0400, Alan Stern wrote:
> > On Fri, 15 Apr 2011, Rafael J. Wysocki wrote:
> >
> > > On Friday, April 15, 2011, Tino Keitel wrote:
> > > > Hi,
> > > >
> > > > with 2.6.38, I enabled wakeup from suspend to RAM with the USB keyboard
> > > > this way:
> > > >
> > > > echo USB2 > /proc/acpi/wakeup
> > > >
> > > > This does not work anymore with 2.6.39-rc3. Wakeup using the keyboard
> > > > won't work, and the USB2 line in /proc/acpi/wakeup doesn't change to
> > > > "enabled" after the echo command.
> > > >
> > > > Is this intended? If yes, what is the new way to enable keyboard
> > > > wakeup?
> > >
> > > No, it's supposed to work IIRC. I'll have a look at that code tomorrow.
> >
> > Tino, can you check the contents of the power/wakeup files in the
> > appropriate sysfs directories? That would be the directory for the
> > keyboard device itself and the directory for the USB host controller
> > for the bus the keyboard is on.
> >
> > By default, power/wakeup should be "enabled" for the keyboard device
> > and "disabled" for the host controller. If you write "enabled" into
> > the host controller's file by hand, does that fix the problem?
>
> I already tried to write "enable" into all USB related wakeup files
> yesterday, not change.
>
> I'll check again how these files look like in 2.6.38, what sysfs
> wakeup files change when writing into /proc/acpi/wakeup, and what
> differences to 2.6.39-rc can be seen.

Please post the contents of /proc/acpi/wakeup (without reverting the commits
you have identified as "bad").

Thanks,
Rafael

2011-04-20 23:50:27

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

On Tuesday, April 19, 2011, Tino Keitel wrote:
> Hi,
>
> I reverted some wakeup and ACPI related commits. When I reverted commit
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4, wakeup using the keyboard
> worked again and /proc/acpi/wakeup behaved as expected.
>
> So check this, I reverted the following commits to avoid conflicts and
> build failures:
>
> c19f9a84ec807da57fd75bbd9a3f2b8269611f79
> 5190726765b40774c069e187a958e10ccd970e65
> 2a5d24286e8bdafdc272b37ec5bdd9e977b3767c
> f2b56bc808addb908a5bf435d9b942c02af9a7c4
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4

In fact, the problem is somewhere else.

It turns out that device_is_registered() may return true before
the device's "power" directory in sysfs is created, which causes
device_set_wakeup_capable() not to set dev->power.can_wakeup and
that's why the /proc/acpi/wakeup interface doesn't work for
some devices.

Please try the patch below, it should help.

Thanks,
Rafael

---
drivers/base/power/main.c | 1 +
drivers/base/power/wakeup.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/base/power/main.c
===================================================================
--- linux-2.6.orig/drivers/base/power/main.c
+++ linux-2.6/drivers/base/power/main.c
@@ -63,6 +63,7 @@ void device_pm_init(struct device *dev)
dev->power.wakeup = NULL;
spin_lock_init(&dev->power.lock);
pm_runtime_init(dev);
+ INIT_LIST_HEAD(&dev->power.entry);
}

/**
Index: linux-2.6/drivers/base/power/wakeup.c
===================================================================
--- linux-2.6.orig/drivers/base/power/wakeup.c
+++ linux-2.6/drivers/base/power/wakeup.c
@@ -258,7 +258,7 @@ void device_set_wakeup_capable(struct de
if (!!dev->power.can_wakeup == !!capable)
return;

- if (device_is_registered(dev)) {
+ if (device_is_registered(dev) && !list_empty(&dev->power.entry)) {
if (capable) {
if (wakeup_sysfs_add(dev))
return;