Repository navigation
Conversation
The charge limit rule wanted omamobile-charge-limit-apply.service on every power_supply event of max77759-charger. On 2026-11-25 the charger's CHGIN input bounced near the end of a charge from a desktop port and the unit started 6968 times in one boot, up to about 10 a second; the SoC went from 53-54 C to 57-59 C over the same 11 minutes (a timing match, not measured per process). The systemd tag stays on every event (with the whole rule on add only the unit did not start at boot on 2026-11-16, most likely from the lost tag), and SYSTEMD_WANTS is now set on add only. The unit drops StartLimitIntervalSec=0, so systemd's default start limit caps any future storm. test/all checks both lines of the rule and the unit. Not run on the phone yet: the check is one boot (the unit runs once) and a plug/unplug (it does not run).
|
Tested this on my 8 Pro tonight together with derekross/linux-omamobile#298, and it has a bug: with the add-only rule the unit never ran at boot. The saved limit is 90 % ( So the storm is gone (0 starts instead of 6 968), but only because the unit doesn't start at all. I haven't found why the add event doesn't pull it in yet. Keeping this a draft until I have a fix that applies once at boot and on replug, and that's tested on the phone. |
Wanting the unit on add only left it unstarted at boot on 2026-11-25: systemd drops a device's udev Wants= and rebuilds them from SYSTEMD_WANTS on every uevent (src/core/device.c, device_setup_unit and device_add_udev_wants), so after the charger's first change event Wants= was empty. The same code starts every wanted unit again on each event unless it is already active, which is what turned the old every-event rule into 6968 starts of a oneshot that went inactive after each run. So the rule is back to one line with SYSTEMD_WANTS on every event, and the unit gets RemainAfterExit=yes (stays active, change events skip it) and StopWhenUnneeded=yes (stops when the charger device goes away, so a real add runs it again). The default start limit stays on. test/all checks the rule and both settings; omamobile-settings' charge-backend test now checks RemainAfterExit instead of the dropped StartLimitIntervalSec=0. Not run on the phone yet: check one start after boot, the saved limit in charge_control_end_threshold, and no new start on plug/unplug. Signed-off-by: Lef <me@lefteros.com>
…limit Signed-off-by: Lef <me@lefteros.com>
|
Fixed in d9eaee2 + 2f4da3c. The add-only filter was the wrong idea: systemd rebuilds the device's Tested on my 8 Pro without a reboot: one change event started it (limit 90 applied), then 10 more I also changed one line in |
derekross
left a comment
There was a problem hiding this comment.
Thanks, Lef, and thanks for finding your own bug so fast. The head now leaves the rule as main has it and makes the unit stay active after one run, which is a cleaner fix than filtering the events, and I checked that the Settings page applies a changed limit through its helper directly, so RemainAfterExit can't hide a user's change. The package's test and the settings test pass on today's main.
Before it leaves draft: the boot run you mention, one start with the saved limit applied and nothing more on a replug or a change trigger; and please retitle it, since "on add only" is now the design you dropped. One question for that run: systemd's own manual says it acts on a device's Wants= only when the device first becomes active, while your phone started the unit on change events (the 6,968, and the trigger that applied 90 %). If the boot run's journal shows which event came before each start, we'll know which it is, and the unit's comment can say what a failed first run does next: with starts on change events it is retried, up to systemd's default limit of five in ten seconds, rather than staying failed until the next boot.
Draft, not run on the phone yet. Tests pass in a container only.
The charge limit rule wanted
omamobile-charge-limit-apply.serviceon everypower_supplyevent frommax77759-charger. On one boot the charger's CHGIN input kept bouncing near the end of a charge from a desktop port (26 061 CHGIN irqs). The unit started 6 968 times that boot, peaking around 10 a second. The SoC went from 53-54 C to 57-59 C over the same window. That's a timing match only, I didn't measure CPU per process.This keeps
TAG+="systemd"on every event and setsSYSTEMD_WANTSon add only. On 11-16 the unit didn't start at boot withACTION=="add"on the whole rule. I think losing the tag on change did it, but that's not proven, so the tag stays on every event. It also dropsStartLimitIntervalSec=0from the unit, so systemd's default start limit (5 in 10 s) caps any future storm. The flip side: if the charger were added more than 5 times in 10 s (a rebind loop), the unit would stay failed. I don't see a path that does that.test/allchecks both rule lines and the unit, and fails against main's rule. Version goes to 0.1.22. #997 and #1001 also claim 0.1.22, so whichever merges later gets renumbered.Should work from reading systemd (wants come from each event's properties, and boot replays add), but I haven't checked it. The check on the phone: after a boot
journalctl -b -u omamobile-charge-limit-applyshows the run succeeded (one start, or two if the coldplug add replays after the first has finished), and a plug/unplug doesn't start it again. With this there's no retry on change anymore, so if the first run at boot fails, it stays failed until the next boot.The kernel side, CHGIN reported at most once a second, is a separate draft on linux-omamobile: derekross/linux-omamobile#298