Regression with PM / wakeup: Show wakeup sources stats in sysfs"
Hi,
Commit c8377adfa78103be5380200eb9dab764d7ca890e ("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because /sys/class/net/*/device/power/wakeup_count is now 0, despite /sys/kernel/debug/wakeup_sources clearly indicating that the Ethernet device was responsible for system wake-up.
What's more in looking at /sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, but wakeup_count is desperately 0, why is that?
This is seen on 5.4.43, but it is reproducible on Linus' master as well.
The Ethernet driver being used is under drivers/net/ethernet/broadcom/genet/ and the relevant part is in the function bcmgenet_set_wol().
BTW, I think you want to backport e976eb4b91e906f20ec25b20c152d53c472fc3fd ("PM: wakeup: Show statistics for deleted wakeup sources again") into 5.4 and 4.19 at least.
Thank you!
--
Florian
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?
I need to look at that commit in detail to find out what is going on.
Quoted 9 lines
This is seen on 5.4.43, but it is reproducible on Linus' master as well.
The Ethernet driver being used is under
drivers/net/ethernet/broadcom/genet/and the relevant part is in the functionbcmgenet_set_wol().BTW, I think you want to backport
e976eb4b91e906f20ec25b20c152d53c472fc3fd("PM: wakeup: Show statistics for deleted wakeup sources again") into 5.4 and 4.19 at least.
Well, please feel free to send a request to do that to [email protected].
Thanks!
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.
Quoted 5 lines
Quoted 3 lines
What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of /sys/kernel/debug/wakeup_sources, /sys/class/net/*/device/power/*, and /sys/class/wakekup/* corresponding to the device in question. The values in these files are queried from the same struct wakeup_source. So it's odd if wakeup_count diverges.
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?
Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.
Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN. /sys/class/wakeup/wakeup2 maps to the Ethernet device.
The Ethernet device calls pm_wakeup_event() against the struct device that is embedded in the platform_device that it was probed with. I will try to debug this myself over the weekend, time permitting.
# ethtool -s eth0 wol g
# cat /sys/kernel/debug/wakeup_sources
name active_count event_count wakeup_count
expire_count active_since total_time max_time last_changep
revent_suspend_time
47d580000.ethernet 0 0 0
0 0 0 0 0 0
alarmtimer 0 0 0 0
0 0 0 0 0
47c408400.waketimer 2 2 0
0 0 0 0 6144
1 0
# pml -w20
[ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs
attributes, consider using 'rtcwake'
Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow)
l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds
wakeup_time=20
[ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds)
done.
[ 3449.974087] OOM killer disabled.
[ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006
seconds) done.
[ 3449.991114] printk: Suspending console(s) (use no_console_suspend to
debug)
AMS: System is entering S2...
[ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down
[ 3450.048340] Disabling non-boot CPUs ...
[ 3450.049344] CPU1: shutdown
[ 3450.050393] psci: CPU1 killed (polled 1 ms)
[ 3450.051332] Enabling non-boot CPUs ...
[ 3450.051712] Detected PIPT I-cache on CPU1
[ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083]
[ 3450.052435] CPU1 is up
[ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full
- flow control rx/tx
[ 3450.729677] OOM killer enabled.
[ 3450.732908] Restarting tasks ... done.
[ 3450.738539] PM: suspend exit
------------------------------
[ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs
attributes, consider using 'rtcwake'
# cat /sys/kernel/debug/wakeup_sources
name active_count event_count wakeup_count
expire_count active_since total_time max_time last_changep
revent_suspend_time
47d580000.ethernet 1 1 0
0 0 0 0 3450
054 0
alarmtimer 0 0 0 0
0 0 0 0 0
47c408400.waketimer 2 2 0
0 0 0 0 6144
1 0
# cat /sys/class/net/*/device/power/*
cat: read error: Input/output error
auto
0
unsupported
0
enabled
0
0
1
0
0
3450054
0
0
# ls -l /sys/class/net/eth0/device/
driver/ net/ subsystem/ wakeup/
driver_override of_node/ uevent
modalias power/ unimac-mdio.0/
# ls -l /sys/class/net/eth0/device/power/wakeup
wakeup wakeup_active_count wakeup_last_time_ms
wakeup_abort_count wakeup_count wakeup_max_time_ms
wakeup_active wakeup_expire_count wakeup_total_time_ms
# ls -l /sys/class/net/eth0/device/power/wakeup^C
# ls -l /sys/class/wakeup/wakeup
wakeup0/ wakeup1/ wakeup2/
# ls -l /sys/class/wakeup/wakeup2/
total 0
-r--r--r-- 1 root root 4096 Jan 1 00:59 active_count
-r--r--r-- 1 root root 4096 Jan 1 00:59 active_time_ms
lrwxrwxrwx 1 root root 0 Jan 1 00:59 device ->
../../../47d580000.ethernet
-r--r--r-- 1 root root 4096 Jan 1 00:59 event_count
-r--r--r-- 1 root root 4096 Jan 1 00:59 expire_count
-r--r--r-- 1 root root 4096 Jan 1 00:59 last_change_ms
-r--r--r-- 1 root root 4096 Jan 1 00:59 max_time_ms
-r--r--r-- 1 root root 4096 Jan 1 00:59 name
-r--r--r-- 1 root root 4096 Jan 1 00:59
prevent_suspend_time_ms
lrwxrwxrwx 1 root root 0 Jan 1 00:59 subsystem ->
../../../../../../class/wakeup
-r--r--r-- 1 root root 4096 Jan 1 00:59 total_time_ms
-rw-r--r-- 1 root root 4096 Jan 1 00:59 uevent
-r--r--r-- 1 root root 4096 Jan 1 00:59 wakeup_count
# cat /sys/class/wakeup/wakeup2/*
1
0
cat: read error: Is a directory
1
0
3450054
0
47d580000.ethernet
0
cat: read error: Is a directory
0
0
#Signature · 1 line
Florian
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabled
Quoted 8 lines
0 0 1 0 0 3450054 0 0
UUIC, 47d580000.ethernet is the device of interest here. It's wakeup_count was 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that's wakeup_count.
Quoted 46 lines
# ls -l /sys/class/net/eth0/device/ driver/ net/ subsystem/ wakeup/ driver_override of_node/ uevent modalias power/ unimac-mdio.0/ # ls -l /sys/class/net/eth0/device/power/wakeup wakeup wakeup_active_count wakeup_last_time_ms wakeup_abort_count wakeup_count wakeup_max_time_ms wakeup_active wakeup_expire_count wakeup_total_time_ms # ls -l /sys/class/net/eth0/device/power/wakeup^C # ls -l /sys/class/wakeup/wakeup wakeup0/ wakeup1/ wakeup2/ # ls -l /sys/class/wakeup/wakeup2/ total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jan 1 00:59 active_count -r--r--r-- 1 root root 4096 Jan 1 00:59 active_time_mslrwxrwxrwx 1 root root 0 Jan 1 00:59 device ->
../../../47d580000.ethernet(quoted diff) +0
-6-r--r--r-- 1 root root 4096 Jan 1 00:59 event_count -r--r--r-- 1 root root 4096 Jan 1 00:59 expire_count -r--r--r-- 1 root root 4096 Jan 1 00:59 last_change_ms -r--r--r-- 1 root root 4096 Jan 1 00:59 max_time_ms -r--r--r-- 1 root root 4096 Jan 1 00:59 name -r--r--r-- 1 root root 4096 Jan 1 00:59
prevent_suspend_time_ms
lrwxrwxrwx 1 root root 0 Jan 1 00:59 subsystem ->
../../../../../../class/wakeup(quoted diff) +0
-3-r--r--r-- 1 root root 4096 Jan 1 00:59 total_time_ms -rw-r--r-- 1 root root 4096 Jan 1 00:59 uevent -r--r--r-- 1 root root 4096 Jan 1 00:59 wakeup_count# cat /sys/class/wakeup/wakeup2/* 1 0 cat: read error: Is a directory 1 0 3450054 0 47d580000.ethernet 0 cat: read error: Is a directory 0 0 #--
Florian
Quoted 106 lines · Tri Vo
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabledQuoted 8 lines
0 0 1 0 0 3450054 0 0
Quoted 5 lines
UUIC, 47d580000.ethernet is the device of interest here. It's
wakeup_countwas 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that'swakeup_count.
That file is actually event_count which is not what is expected:
# sh print.sh /sys/class/wakeup/wakeup2/uevent: /sys/class/wakeup/wakeup2/event_count: 1 /sys/class/wakeup/wakeup2/max_time_ms: 0 /sys/class/wakeup/wakeup2/wakeup_count: 0 /sys/class/wakeup/wakeup2/total_time_ms: 0 /sys/class/wakeup/wakeup2/expire_count: 0 /sys/class/wakeup/wakeup2/active_count: 1 /sys/class/wakeup/wakeup2/last_change_ms: 3450054 /sys/class/wakeup/wakeup2/prevent_suspend_time_ms: 0 /sys/class/wakeup/wakeup2/name: 47d580000.ethernet /sys/class/wakeup/wakeup2/active_time_ms: 0
Signature · 1 line
Florian
Quoted 118 lines · Florian Fainelli
Quoted 106 lines · Tri Vo
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabledQuoted 8 lines
0 0 1 0 0 3450054 0 0Quoted 5 lines
UUIC, 47d580000.ethernet is the device of interest here. It's
wakeup_countwas 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that'swakeup_count.That file is actually
event_countwhich is not what is expected:
Quoted 12 lines
# sh print.sh /sys/class/wakeup/wakeup2/uevent: /sys/class/wakeup/wakeup2/event_count: 1 /sys/class/wakeup/wakeup2/max_time_ms: 0 /sys/class/wakeup/wakeup2/wakeup_count: 0 /sys/class/wakeup/wakeup2/total_time_ms: 0 /sys/class/wakeup/wakeup2/expire_count: 0 /sys/class/wakeup/wakeup2/active_count: 1 /sys/class/wakeup/wakeup2/last_change_ms: 3450054 /sys/class/wakeup/wakeup2/prevent_suspend_time_ms: 0 /sys/class/wakeup/wakeup2/name: 47d580000.ethernet /sys/class/wakeup/wakeup2/active_time_ms: 0
Thanks! Although 0 is not the expected wakeup_count, both /sys/kernel/debug/wakeup_sources and /sys/class/wakeup/* are reporting the same thing. So it's probably not an issue with how these values are reported. The underlying struct wakeup_source has 0 wakeup_count recorded.
How sure are you that commit c8377adfa78103be5380200eb9dab764d7ca890e introduces the regression? (That commit adds sysfs attributes to display wakeup source information, so it seems unlikely that actual wakeup event accounting is affected by it.)
Quoted 138 lines · Tri Vo
Quoted 118 lines · Florian Fainelli
Quoted 106 lines · Tri Vo
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabledQuoted 8 lines
0 0 1 0 0 3450054 0 0Quoted 5 lines
UUIC, 47d580000.ethernet is the device of interest here. It's
wakeup_countwas 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that'swakeup_count.That file is actually
event_countwhich is not what is expected:Quoted 12 lines
# sh print.sh /sys/class/wakeup/wakeup2/uevent: /sys/class/wakeup/wakeup2/event_count: 1 /sys/class/wakeup/wakeup2/max_time_ms: 0 /sys/class/wakeup/wakeup2/wakeup_count: 0 /sys/class/wakeup/wakeup2/total_time_ms: 0 /sys/class/wakeup/wakeup2/expire_count: 0 /sys/class/wakeup/wakeup2/active_count: 1 /sys/class/wakeup/wakeup2/last_change_ms: 3450054 /sys/class/wakeup/wakeup2/prevent_suspend_time_ms: 0 /sys/class/wakeup/wakeup2/name: 47d580000.ethernet /sys/class/wakeup/wakeup2/active_time_ms: 0Thanks! Although 0 is not the expected
wakeup_count, both/sys/kernel/debug/wakeup_sourcesand/sys/class/wakeup/*are reporting the same thing. So it's probably not an issue with how these values are reported. The underlying structwakeup_sourcehas 0wakeup_countrecorded.
Quoted 4 lines
How sure are you that commit
c8377adfa78103be5380200eb9dab764d7ca890eintroduces the regression? (That commit adds sysfs attributes to display wakeup source information, so it seems unlikely that actual wakeup event accounting is affected by it.)
Not anymore, it looks like my automated bisection was flawed, I will restart it now and find out the offending commit when this started to break. Thanks for reviewing the logs!
Signature · 1 line
Florian
Quoted 141 lines · Florian Fainelli
Quoted 138 lines · Tri Vo
Quoted 118 lines · Florian Fainelli
Quoted 106 lines · Tri Vo
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabledQuoted 8 lines
0 0 1 0 0 3450054 0 0Quoted 5 lines
UUIC, 47d580000.ethernet is the device of interest here. It's
wakeup_countwas 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that'swakeup_count.That file is actually
event_countwhich is not what is expected:Quoted 12 lines
# sh print.sh /sys/class/wakeup/wakeup2/uevent: /sys/class/wakeup/wakeup2/event_count: 1 /sys/class/wakeup/wakeup2/max_time_ms: 0 /sys/class/wakeup/wakeup2/wakeup_count: 0 /sys/class/wakeup/wakeup2/total_time_ms: 0 /sys/class/wakeup/wakeup2/expire_count: 0 /sys/class/wakeup/wakeup2/active_count: 1 /sys/class/wakeup/wakeup2/last_change_ms: 3450054 /sys/class/wakeup/wakeup2/prevent_suspend_time_ms: 0 /sys/class/wakeup/wakeup2/name: 47d580000.ethernet /sys/class/wakeup/wakeup2/active_time_ms: 0Thanks! Although 0 is not the expected
wakeup_count, both/sys/kernel/debug/wakeup_sourcesand/sys/class/wakeup/*are reporting the same thing. So it's probably not an issue with how these values are reported. The underlying structwakeup_sourcehas 0wakeup_countrecorded.
Quoted 8 lines
Quoted 4 lines
How sure are you that commit
c8377adfa78103be5380200eb9dab764d7ca890eintroduces the regression? (That commit adds sysfs attributes to display wakeup source information, so it seems unlikely that actual wakeup event accounting is affected by it.)Not anymore, it looks like my automated bisection was flawed, I will restart it now and find out the offending commit when this started to break. Thanks for reviewing the logs!
It was more obvious than I thought, this commit:
2d5ed61ce9820a1fe7b076cc45c169524d767746 ("PM / wakeup: Export wakeup_count instead of event_count via sysfs") did change the structure member being displayed by the wakeup_count sysfs attribute.
The commit message and rationale does make sense, however it sounds like there should still be a proper differentiation between pm_wakeup_event() calls done from resume cycle versus non-resume cycles. The sysfs description under Documentation/ABI/testing/sysfs-devices-power may also need clarification.
One example that I can think of is the gpio_keys.c driver which calls pm_wakeup_event() every time a GPIO button is pressed, provided that the device is marked as wakeup enabled. Granted, applications can read the count before and after suspend and determine if the count is different to identify whether gpio_keys.c is responsible for wake-up, but it would be much
Signature · 1 line
Florian
Quoted 154 lines · CEST Florian Fainelli
Quoted 141 lines · Florian Fainelli
Quoted 138 lines · Tri Vo
Quoted 118 lines · Florian Fainelli
Quoted 106 lines · Tri Vo
Quoted 96 lines · Florian Fainelli
Quoted 16 lines · Tri Vo
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Florian Fainelli
Hi,
Commit
c8377adfa78103be5380200eb9dab764d7ca890e("PM / wakeup: Show wakeup sources stats in sysfs") is causing some of our tests to fail because/sys/class/net/*/device/power/wakeup_countis now 0, despite/sys/kernel/debug/wakeup_sourcesclearly indicating that the Ethernet device was responsible for system wake-up.What's more in looking at
/sys/class/wakekup/wakeup2/event_count, we have the number of Wake-on-LAN wakeups recorded properly, butwakeup_countis desperately 0, why is that?Quoted 7 lines
Quoted 1 line
I need to look at that commit in detail to find out what is going on.
It would be helpful to see the contents of
/sys/kernel/debug/wakeup_sources,/sys/class/net/*/device/power/*, and/sys/class/wakekup/*corresponding to the device in question. The values in these files are queried from the same structwakeup_source. So it's odd ifwakeup_countdiverges.Most certainly, below is the information you want, the two cat /s/k/d/wakeup_sources were done before Wake-on-LAN and after waking-up from LAN.
/sys/class/wakeup/wakeup2maps to the Ethernet device.The Ethernet device calls
pm_wakeup_event()against the struct device that is embedded in theplatform_devicethat it was probed with. I will try to debug this myself over the weekend, time permitting.# ethtool -s eth0 wol g # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 0 0 0 0 0 0 0 0 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # pml -w20 [ 3449.937142] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' Pass 1 out of 1, mode=none, tp_al[ 3449.952654] PM: suspend entry (shallow) l=1, cycle_tp=, sleep=, [ 3449.959004] Filesystems sync: 0.000 seconds wakeup_time=20 [ 3449.965984] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 3449.974087] OOM killer disabled. [ 3449.977316] Freezing remaining freezable tasks ... (elapsed 0.006 seconds) done. [ 3449.991114] printk: Suspending console(s) (use no_console_suspend to debug) AMS: System is entering S2... [ 3450.022381] bcmgenet 47d580000.ethernet eth0: Link is Down [ 3450.048340] Disabling non-boot CPUs ... [ 3450.049344] CPU1: shutdown [ 3450.050393] psci: CPU1 killed (polled 1 ms) [ 3450.051332] Enabling non-boot CPUs ... [ 3450.051712] Detected PIPT I-cache on CPU1 [ 3450.051812] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 3450.052435] CPU1 is up [ 3450.683588] bcmgenet 47d580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 3450.729677] OOM killer enabled. [ 3450.732908] Restarting tasks ... done. [ 3450.738539] PM: suspend exit ------------------------------ [ 3450.744239] brcm-waketimer 47c408400.waketimer: Using sysfs attributes, consider using 'rtcwake' # cat /sys/kernel/debug/wakeup_sources name active_count event_count wakeup_count expire_count active_since total_time max_time last_changep revent_suspend_time 47d580000.ethernet 1 1 0 0 0 0 0 3450 054 0 alarmtimer 0 0 0 0 0 0 0 0 0 47c408400.waketimer 2 2 0 0 0 0 0 6144 1 0 # cat /sys/class/net/*/device/power/* cat: read error: Input/output error auto 0 unsupported 0 enabledQuoted 8 lines
0 0 1 0 0 3450054 0 0Quoted 5 lines
UUIC, 47d580000.ethernet is the device of interest here. It's
wakeup_countwas 0 before wake up, and we expect it to be 1 after wake up. One of the files you cat'ed here has a 1 in it. I can't tell which value corresponds to which file though, but I suspect that'swakeup_count.That file is actually
event_countwhich is not what is expected:Quoted 12 lines
# sh print.sh /sys/class/wakeup/wakeup2/uevent: /sys/class/wakeup/wakeup2/event_count: 1 /sys/class/wakeup/wakeup2/max_time_ms: 0 /sys/class/wakeup/wakeup2/wakeup_count: 0 /sys/class/wakeup/wakeup2/total_time_ms: 0 /sys/class/wakeup/wakeup2/expire_count: 0 /sys/class/wakeup/wakeup2/active_count: 1 /sys/class/wakeup/wakeup2/last_change_ms: 3450054 /sys/class/wakeup/wakeup2/prevent_suspend_time_ms: 0 /sys/class/wakeup/wakeup2/name: 47d580000.ethernet /sys/class/wakeup/wakeup2/active_time_ms: 0Thanks! Although 0 is not the expected
wakeup_count, both/sys/kernel/debug/wakeup_sourcesand/sys/class/wakeup/*are reporting the same thing. So it's probably not an issue with how these values are reported. The underlying structwakeup_sourcehas 0wakeup_countrecorded.Quoted 8 lines
Quoted 4 lines
How sure are you that commit
c8377adfa78103be5380200eb9dab764d7ca890eintroduces the regression? (That commit adds sysfs attributes to display wakeup source information, so it seems unlikely that actual wakeup event accounting is affected by it.)Not anymore, it looks like my automated bisection was flawed, I will restart it now and find out the offending commit when this started to break. Thanks for reviewing the logs!
It was more obvious than I thought, this commit:
Quoted 7 lines
2d5ed61ce9820a1fe7b076cc45c169524d767746("PM / wakeup: Exportwakeup_countinstead ofevent_countvia sysfs") did change the structure member being displayed by thewakeup_countsysfs attribute.The commit message and rationale does make sense, however it sounds like there should still be a proper differentiation between
pm_wakeup_event()calls done from resume cycle versus non-resume cycles.
It is unfortunate that you relied on the behavior that's changed, sorry about that.
Reverting the above commit is still an option, so please let me know if you want me to do that.
Quoted 2 lines
The sysfs description under
Documentation/ABI/testing/sysfs-devices-powermay also need clarification.
Well, feel free to propose specific changes in there.
Quoted 6 lines
One example that I can think of is the
gpio_keys.cdriver which callspm_wakeup_event()every time a GPIO button is pressed, provided that the device is marked as wakeup enabled. Granted, applications can read the count before and after suspend and determine if the count is different to identify whethergpio_keys.cis responsible for wake-up, but it would be much
This way one can only say whether or not a key has been pressed during the period between two consecutive wakeup_count reads. That may not even be related to waking up the system from sleep, though.
Thanks!