Bug 8637

Summary: skge doesn't wakeonlan (wol) whilst hibernated
Product: Drivers Reporter: David Greaves (david)
Component: NetworkAssignee: Stephen Hemminger (stephen)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: bunk, david, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.22-rc4 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216    
Attachments: Patch intended to fix the mysqld suspend problem
Patch to test
Patch to test (the correct one)
results of lspci and /proc/acpi/wakeup contents
Clean boot from init 6.
resume bootlog

Description David Greaves 2007-06-16 00:53:39 UTC
Most recent kernel where this bug did not occur: ?
Distribution: Debian - mainline kernel
Hardware Environment:
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8377 [KT400/KT600 AGP] Host Bridge (rev 80)
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge
0000:00:09.0 Ethernet controller: 3Com Corporation 3c940 10/100/1000Base-T [Marvell] (rev 12)
0000:00:0a.0 VGA compatible controller: ATI Technologies Inc 3D Rage II+ 215GTB [Mach64 GTB] (rev 9a)
0000:00:0d.0 Unknown mass storage controller: Promise Technology, Inc. PDC20318 (SATA150 TX4) (rev 02)
0000:00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
0000:00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [K8T800 South]
0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
0000:00:11.6 Communication controller: VIA Technologies, Inc. Intel 537 [AC97 Modem] (rev 80)

Software Environment: skge
Problem Description: skge doesn't wakeonlan (wol) whilst hibernated

Steps to reproduce:
If I cause the system to save state to disk then whilst off it no longer
responds to g-wol.
# wakeonlan cu
Sending magic packet to 255.255.255.255:9 with 00:0C:6E:F6:47:EE

It works when I use init 0.

I applied the patches here:
http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.22-rc3/patches/
but that didn't help.
Comment 1 Stephen Hemminger 2007-07-02 19:09:37 UTC
Does your distribution unload modules on hibernate?
Some distributions (like Ubuntu) unload the module.
WOL is only activated on shutdown or suspend.
Comment 2 David Greaves 2007-07-03 00:48:54 UTC
I am using Debian but I'm not using any distro features.
This is a mainline kernel.

skge is actually builtin.

The 'hibernate' script is:

ethtool -s eth0 wol g
sync
echo platform > /sys/power/disk
echo disk > /sys/power/state
sleep 5
ethtool -s eth0 wol g
Comment 3 Rafael J. Wysocki 2007-09-23 05:29:36 UTC
Can you test the 2.6.23-rc7 kernel with the patches from

http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.23-rc7/patches/

applied?
Comment 4 Rafael J. Wysocki 2007-10-06 08:33:14 UTC
Update: Can you test 2.6.23-rc9 w/ the patches from:

http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.23-rc9/patches/

applied?
Comment 5 David Greaves 2007-10-09 05:12:45 UTC
Been busy :)

I just applied ...hibernation_and_suspend/2.6.23-rc9/patches/*
This stopped hibernate working...

I reverted to 2.6.23-rc9 and hibernate worked (but no WOL)
I then bisected your patch list and found that with 01-10 applied, hibernate worked but WOL didn't.


When I applied 11-freezer-do-not-send-signals-to-kernel-threads.patch the kernel gave output like this when I did the echo:
echo: write error: Device or resource busy

and dmesg said: (edited highlights)
Freezing user space processes ...
Freezing of tasks failed after 20.19 seconds (1 tasks refusing to freeze):
runnable tasks:

            task   PID        tree-key         delta       waiting  switches  prio        sum-exec        sum-wait
 sum-sleep    wait-overrun   wait-underrun
------------------------------------------------------------------------------------------------------------------------
------------------------------------------
        events/0     5     33157216488    -280805469      20000000       409   115               0               0
         0               0               0
         pdflush   174     33301536444    -136485513      20000000        56   120               0               0
         0               0               0
       md0_raid5   867     33156228136    -281793821      20000000        97   115               0               0
         0               0               0
         xfsbufd   869     33181457999    -256563958      20000000        55   115               0               0
         0               0               0
         xfsbufd  2239     33185795995    -252225962      20000000        46   115               0               0
         0               0               0
         xfsbufd  2241     33211268666    -226753291      20000000        46   115               0               0
         0               0               0
R      hibernate  3922     33458021957      20000000     -20000000       128   120               0               0
         0               0               0

 mysqld
Comment 6 Rafael J. Wysocki 2007-10-09 13:39:39 UTC
Thanks for testing.

Well, we had problems with freezing mysqld in the past.

Can you please retest with my series of patches applied, but without mysqld running?
Comment 7 David Greaves 2007-10-10 03:10:10 UTC
OK, all patches applied:

hibernate now succeeds if I stop mysql :)

WOL still doesn't work :(
Comment 8 Rafael J. Wysocki 2007-10-12 12:42:29 UTC
(In reply to comment #7)
> OK, all patches applied:
> 
> hibernate now succeeds if I stop mysql :)

OK, I'll try to figure out a fix for that.

> WOL still doesn't work :(

Well, from the "core" code POV all of the necessary bits are there ...
Comment 9 Rafael J. Wysocki 2007-10-14 15:25:48 UTC
Created attachment 13157 [details]
Patch intended to fix the mysqld suspend problem

The attached patch hopefully fixes the mysqld suspend problem from Comment #5.  Please test.
Comment 10 Rafael J. Wysocki 2008-01-08 13:25:10 UTC
Please check 2.6.24 when it's out, thanks.
Comment 11 David Greaves 2008-09-23 15:14:37 UTC
I'd forgotten about this and missed your last request.

The machine isn't used much anymore but I upgraded the kernel to mainline 2.6.26 and just tried 2.6.27-rc7 and it still doesn't work.

The machine responds to wakeonlan when I do init 0 but not when I do echo disk > /sys/power/state

hibernate/resume works fine. (Though mysql is not running on it anymore)
Comment 12 Rafael J. Wysocki 2008-09-24 12:22:46 UTC
Created attachment 18012 [details]
Patch to test

Please check if WOL works for you with this patch applied on top of 2.6.27-rc7.
Comment 13 Rafael J. Wysocki 2008-09-24 12:25:20 UTC
Created attachment 18013 [details]
Patch to test (the correct one)

Sorry, I've attached a wrong patch.  Please try this one on top of 2.6.27-rc7.
Comment 14 David Greaves 2008-09-24 13:03:29 UTC
:(
Comment 15 Rafael J. Wysocki 2008-09-24 13:27:47 UTC
Please attach the output of 'lspci' from your system and the contents of /proc/acpi/wakeup before and after you've run 'ethtool -s eth0 wol g' (as text files).
Comment 16 David Greaves 2008-09-24 13:49:27 UTC
Created attachment 18016 [details]
results of lspci and /proc/acpi/wakeup contents

Done
I powered up (via wol) and did the lspci, then cat /proc/acpi/wakeup
then ethtool -s eth0 wol g
then cat /proc/acpi/wakeup again

They're the same before and after the ethtool command

I checked my init scripts (well, grep -R ethtool /etc) and it doesn't appear to be run automatically.

I also did a hibernate/manual resume and the contents were the same.
Comment 17 Rafael J. Wysocki 2008-09-24 13:56:36 UTC
Well, apparently your BIOS doesn't support wake-on-LAN from any sleep states using this network adapter.  Is it an add-on card or on-board?
Comment 18 Rafael J. Wysocki 2008-09-24 13:58:59 UTC
Can you please also attach a boot log for your system?
Comment 19 David Greaves 2008-09-24 14:23:55 UTC
Created attachment 18017 [details]
Clean boot from init 6.

It's onboard.

I didn't realise that it was entering a sleep-state. I thought hibernate actually did a power-off to the same 'state' as init 0.
Comment 20 David Greaves 2008-09-24 14:25:30 UTC
Created attachment 18018 [details]
resume bootlog

Here's a log from a resume in case it helps
Comment 21 Rafael J. Wysocki 2008-09-24 14:56:44 UTC
(In reply to comment #19)
> Created an attachment (id=18017) [details]
> Clean boot from init 6.
> 
> It's onboard.
> 
> I didn't realise that it was entering a sleep-state. I thought hibernate
> actually did a power-off to the same 'state' as init 0.

You can make it do that by echoing 'shutdown' into /sys/power/disk before hibernation.
Comment 22 Rafael J. Wysocki 2008-09-24 14:58:39 UTC
(In reply to comment #20)
> Created an attachment (id=18018) [details]
> resume bootlog
> 
> Here's a log from a resume in case it helps

Thanks, it does a bit.

Clearly, the PME# signal is enabled for the device, but the ACPI part is missing.  Is there any switch in the machine's setup enabling wake-on-LAN or something similar?
Comment 23 David Greaves 2008-09-24 15:31:29 UTC
ah, yes, I didn't explore /sys/power/disk because S2D was mainly working.

OK, well this does work:
cu:~# ethtool -s eth0 wol g
cu:~# echo shutdown > /sys/power/disk
cu:~# echo disk > /sys/power/state

wol succeeds :)

There is a BIOS setting for PCI/WoL which is set. And of course it works most of the time from powered down etc.

I had a dig around the BIOS settings when you mentioned them earlier. It all looks rational. There's a suspend to RAM setting that is disabled as I'm not using it... and fiddling with it and things like wake-on-keyboard etc didn't help.

If you think this is a BIOS/hardware bug then I'm happy with the 
  echo shutdown > /sys/power/disk
approach.

OTOH if you think I can help find a hibernate/ACPI problem then I'll keep trying patches and reporting for you.


 
Comment 24 Rafael J. Wysocki 2008-09-24 15:54:14 UTC
Well, I don't think it's strictly a bug.  The BIOS just doesn't seem to support wake-up by the NIC from the ACPI S3 and S4 sleep states and there's not much we can do about that at the moment.

I think it's better to mark the bug as resolved, because the patch from Comment  #13 generally works on the systems that provide BIOS support for WOL from S3/S4.
Comment 25 David Greaves 2008-09-25 01:48:07 UTC
Fine.

Thanks a lot for your help :)