Systemd uses CPU after wakeup due to power_supply BAT0 (battery) continued polling

Bug #1944409 reported by Jean
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OEM Priority Project
Fix Committed
Critical
Unassigned
systemd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

My setup:
 - Dell Latitude 7520
 - Dell WD15 USB C docking station
 - Ubuntu 20.04.3
 - systemd 245.4-4ubuntu3.13
 - uname -a:
Linux CLIFMI085 5.13.0-1012-oem #16-Ubuntu SMP Tue Sep 7 09:23:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I leave my laptop docked and, after waking it up from sleep, the fans start blowing. After a quick inspection with top/htop, I always see /usr/lib/systemd/systemd-udev consuming 50+% of my CPU.

After a quick search, I discover that I can use `udevadm monitor` to check what device is making all this fuss, and this is the output:

UDEV [92591.827159] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92591.873819] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92591.920022] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92591.967005] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.018200] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.068351] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.115100] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.166201] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.213318] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.261046] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.308824] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.356577] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.403766] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92592.451164] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)

As you can see, the battery status is being polled every 0.05s. To fix this, I just need to restart the service with:

sudo systemctl restart systemd-udevd systemd-udevd-kernel.socket systemd-udevd-control.socket

Afterwards, this is the output of `udevadm monitor`:

KERNEL[92739.612371] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92739.646888] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[92741.076823] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92741.099370] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[92742.539438] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [92742.573812] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)

As you can see, the battery is now being polled every ~1.5s, which is fine.

Alex Tu (alextu)
tags: added: fossa-squirtle
Rex Tsai (chihchun)
tags: added: oem-priority
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Viktor Pal (deere) wrote :

I experience the same issue on a Dell Latitude 3520.
It is Manjaro and systemd version is 249 but the issue/solution is exactly the same.
Did you find any permanent solution to the problem?

Revision history for this message
Jean (alessandro-lai85) wrote :

No, no workaround. I still have to do the restart at every reboot with the docking station attached.

My system is fully updated up to yesterday:

$ uname -a
Linux CLIFMI085 5.13.0-1021-oem #25-Ubuntu SMP Thu Dec 2 18:03:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Alex Tu (alextu)
Changed in oem-priority:
importance: Undecided → Critical
Revision history for this message
Yao Wei (medicalwei) wrote (last edit ):

Could you try updating the BIOS firmware, and see whether this issue is still reproducible?

I cannot observe the issue with BIOS firmware version 1.13.0 with docking station DA310.

Revision history for this message
Jean (alessandro-lai85) wrote :

I don't have any BIOS update available; as I said, my laptop (Dell Latitude 7520) is fully updated.

$ sudo dmidecode -s bios-version
1.6.1

$ fwupdmgr get-updates | grep "Current version" -B2
Devices with no available firmware updates:
 • UEFI Device Firmware
 • UEFI Device Firmware
 • UEFI dbx
 • VMM3332 inside Dell WD15/TB16/TB18 wired Dock
│ │ Device ID: 71b677ca0f1bc2c5b804fa1d59e52064ce589293
│ │ Summary: NVM Express Solid State Drive
│ │ Current version: 21112012
--
└─System Firmware:
  │ Device ID: 5ecfc78eb81da0c1a2ab9baa1510f0c269ea1b9b
  │ Current version: 1.6.1

Revision history for this message
Viktor Pal (deere) wrote :

The difference between your and my setup is that I do not use a docking station.
Maybe worth a try if this also happens without it.

Upstream bug has been reported here: https://github.com/systemd/systemd/issues/21751
Also, I have a BIOS update that just came out so will install it right now and let you know if that helped.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

reply #5

Can you try $ fwupdmgr get-updates to see if you can see the latest firmware in LVFS? or attach your output here.

Also, you can always get latest BIOS here https://www.dell.com/support/home/en-in/product-support/product/latitude-15-7520-laptop/drivers, sometimes it is newer than BIOS in LVFS.

Revision history for this message
Jean (alessandro-lai85) wrote :

#7 output was already attached there, just grepped for brevity. The first lines where confusing me though, I've now upgraded the system BIOS from 1.6.1 to 1.12.2. 1.13 seems available on the official site, I'll report back ASAP on the results of the upgrade.

Revision history for this message
Jean (alessandro-lai85) wrote :

After first reboot with BIOS 1.12.2 all seems fine, the update seems even to have made the process of hooking up the docking station and activating the external monitors faster.

After first sleep and wakeup, no battery pinging that I can see with udevadm monitor, not even at a slow pace (but the battery is more than full).

Should I retry during battery recharge?

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

The issue is first found on other platform during enablement, and the fix is landed in BIOS. Latitude 7520 has no problem with the BIOS version we certified, however, the regression should be caused by BIOS upgrade. Therefore, I assume the latest BIOS should contain fix for it. As I know, the issue should be observed whenever adapter is attached, if you can't see it, the issue should be fixed in the latest BIOS.

You can still monitor few days or do whatever experiment you'd like to do, until you think the issue is indeed fixed.

Again, thanks for reporting the issue.

Revision history for this message
xiaoliang (liang-xiao1) wrote :

For Latitude 7520, BIOS 1.7.1 should fix this issue.

Revision history for this message
Jean (alessandro-lai85) wrote :

Good. I woke up the laptop after leaving it hooked to the docking and in sleep the whole night, no issues.

I consider it resolved. Thanks.

Changed in oem-priority:
status: New → Fix Committed
Revision history for this message
Viktor Pal (deere) wrote :

Upgrading to BIOS 1.13.3 on Latitude 3520 seems to have solved the issue.
Thanks for the help.

Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.