#1073294 plasma-settings uses excessive CPU time when doing nothing

Package:
plasma-settings
Source:
plasma-settings
Description:
Settings application for Plasma Mobile
Submitter:
Russell Coker
Date:
2024-12-21 15:12:01 UTC
Severity:
normal
#1073294#5
Date:
2024-06-16 11:22:24 UTC
From:
To:
             19.6 ms/s      39.2        Process        [PID 36735] /usr/bin/plasma-settings -m kcm_mobile_wifi

Powertop givesthe above output for plasma-settings, 39.2 events per second.

Strace shows the following as most of the system calls it performs.  Could it
have a delay longer than 15ms?

ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=15000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=15000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=15000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=15000000}, NULL, 0) = 0 (Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=11, events=POLLIN}], 2, {tv_sec=0, tv_nsec=14000000}, NULL, 0) = 0 (Timeout)


Below are 2 of the other lines from powertop.  This might be a more general
plasma-mobile bug.  But with the screen locked it's more obvious that
plasma-settings shouldn't take much CPU time than it is for the screenlocker.

             28.0 ms/s      50.7        Process        [PID 1887] /usr/bin/plasmashell --no-respawn
             23.6 ms/s      13.1        Process        [PID 49789] /lib/aarch64-linux-gnu/libexec/kscreenlocker_greet --immediateLock --graceTime 5000 --ksldfd 114

#1073294#10
Date:
2024-06-16 14:47:20 UTC
From:
To:
Hi,

thank you for taking a look into plasma-settings and spending the time
to analyse the situation so deeply.

As for all issues related to Qt5/KF5/Plasma5, we are unlikely to get any
support by upstream developers, as their workforce is limited and
focused on Plasma6.

On Debian side, the Debian Qt/KDE team has been working a lot in last
months to package the stack needed to get Plasma6 into the archive. As
far as I see, up-to-date situation has Qt6.6 in sid, hopefully
transitioning soon to trixie, while KF6 is being prepared in
experimental. After KF6 is uploaded to sid, it should be possible to
package new version of plasma-settings.

As you pointed out, the root of this issue could be either in
plasma-settings, either in plasma-mobile. For the latter to be packaged
in its 6.x version, it will also take plasma-workspace and similar
packages to be prepared by the Qt/KDE team. Hopefully a matter of few
months...

To summarize, I suggest to get back to this analysis when we have both
plasma-settings and plasma-mobile in their up-to-date releases in
Debian. It's likely that the issue is not there anymore in new releases,
as Plasma6 was a major rewrite and they addressed a lot of issues in the
meanwhile...

Kind regards

Marco

#1073294#15
Date:
2024-06-16 23:23:25 UTC
From:
To:
Fair enough.

Please let me know when those newer versions are in experimental or in a
private apt repository so I can test them.

#1073294#20
Date:
2024-07-10 11:39:59 UTC
From:
To:
I have just done some more tests, I ran the settings again from the Wifi
widget on the drop-down panel and found it doing sleeps of between 330ms and
980ms instead of 14ms.  That's an improvement of between 23* and 70*, a
significant improvement but still not ideal.  However the /lib/aarch64-linux-
gnu/libexec/kscreenlocker_greet process was doing 14ms sleeps.

Of the packages listed as dependencies the following ones changed versions.

libc6 from 2.38-13 to 2.38-14
libglib2.0-0t64 from 2.80.3-1 to 2.80.4-1
libstdc++6 from 14.1.0-1 to 14.1.0-3

I'm not sure that anything has actually changed, it might be that both then
and now it's a random KDE process that does the 14ms sleeps.

#1073294#25
Date:
2024-12-08 21:03:08 UTC
From:
To:
Hi Russell,

latest upstream plasma-settings version (24.02.0) is now in trixie/sid:
can you please check whether this bug report is still valid on last version?
Thank you, kind regards
Marco

#1073294#30
Date:
2024-12-17 04:24:43 UTC
From:
To:
Currently KDE is not yet in a suitably usable state to do tests.  On laptops
it is barely usable and on phones (the primary target of this bug report) it
didn't seem usable at all last time I tested.  I'll test this as soon as
things basically work.

#1073294#35
Date:
2024-12-20 02:31:04 UTC
From:
To:
Running Debian/Unstable updated this morning I have the KDE screen locker
doing 14ms sleeps on the PinePhonePro:

ppoll([{fd=4, events=POLLIN}, {fd=18, events=POLLIN}, {fd=26, events=POLLIN},
{fd=27, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN},
{fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN},
{fd=141, events=POLLIN}], 10, {tv_sec=0, tv_nsec=14000000}, NULL, 8) = 0
(Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=18, events=POLLIN}, {fd=26, events=POLLIN},
{fd=27, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN},
{fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN},
{fd=141, events=POLLIN}], 10, {tv_sec=0, tv_nsec=14000000}, NULL, 8) = 0
(Timeout)
ppoll([{fd=4, events=POLLIN}, {fd=18, events=POLLIN}, {fd=26, events=POLLIN},
{fd=27, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN},
{fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN},
{fd=141, events=POLLIN}], 10, {tv_sec=0, tv_nsec=15000000}, NULL, 8^Cstrace:
Process 4714 detached
 <detached ...>

root@pine:~# strace -p 4714^C
root@pine:~# ps aux|grep 4714
mobian      4714  4.2  6.1 1760592 243248 ?      Sl   13:14   0:09 /lib/
aarch64-linux-gnu/libexec/kscreenlocker_greet --immediateLock --graceTime 5000
--ksldfd 141
root        4842  0.0  0.0   6240  1844 pts/0    S+   13:18   0:00 grep 4714
root@pine:~# dpkg -l libkscreenlocker6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version      Architecture Description
+++-=======================-============-============-
=================================
ii  libkscreenlocker6:arm64 6.2.4-1      arm64        Secure lock screen
architecture


I also have plasmashell doing 8ms sleeps but also lots of 8 byte read and
writes, strace output scrolling rapidly:

ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=8000000}, NULL, 8) = 0 (Timeout)
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=15000000}, NULL, 8) = 0 (Timeout)
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=15000000}, NULL, 8) = 1 ([{fd=61, revents=POLLIN}], left {tv_sec=0,
tv_nsec=9802384})
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
recvmsg(61, {msg_name=NULL, msg_namelen=0,
msg_iov=[{iov_base="\0\0\0\4\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=20}],
msg_iovlen=1, msg_control=[{cmsg_len=28, cmsg_level=SOL_SOCKET,
cmsg_type=SCM_CREDENTIALS, cmsg_data={pid=1359, uid=1000, gid=1000}}],
msg_controllen=32, msg_flags=0}, 0) = 20
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=6000000}, NULL, 8) = 2 ([{fd=5, revents=POLLIN}, {fd=61,
revents=POLLIN}], left {tv_sec=0, tv_nsec=5965876})
read(5, "\2\0\0\0\0\0\0\0", 8)          = 8
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
recvmsg(61, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\326\0\322>",
iov_len=4}], msg_iovlen=1, msg_control=[{cmsg_len=28, cmsg_level=SOL_SOCKET,
cmsg_type=SCM_CREDENTIALS, cmsg_data={pid=1359, uid=1000, gid=1000}}],
msg_controllen=32, msg_flags=0}, 0) = 4
getpid()                                = 1646
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=8000000}, NULL, 8) = 0 (Timeout)
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=15000000}, NULL, 8) = 0 (Timeout)
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=15000000}, NULL, 8) = 1 ([{fd=61, revents=POLLIN}], left {tv_sec=0,
tv_nsec=9802384})
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
recvmsg(61, {msg_name=NULL, msg_namelen=0,
msg_iov=[{iov_base="\0\0\0\4\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=20}],
msg_iovlen=1, msg_control=[{cmsg_len=28, cmsg_level=SOL_SOCKET,
cmsg_type=SCM_CREDENTIALS, cmsg_data={pid=1359, uid=1000, gid=1000}}],
msg_controllen=32, msg_flags=0}, 0) = 20
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
ppoll([{fd=5, events=POLLIN}, {fd=13, events=POLLIN}, {fd=18, events=POLLIN},
{fd=53, events=POLLIN}, {fd=55, events=POLLIN}, {fd=61, events=POLLIN},
{fd=62, events=POLLIN}, {fd=63, events=POLLIN}], 8, {tv_sec=0,
tv_nsec=6000000}, NULL, 8) = 2 ([{fd=5, revents=POLLIN}, {fd=61,
revents=POLLIN}], left {tv_sec=0, tv_nsec=5965876})
read(5, "\2\0\0\0\0\0\0\0", 8)          = 8
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
recvmsg(61, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\326\0\322>",
iov_len=4}], msg_iovlen=1, msg_control=[{cmsg_len=28, cmsg_level=SOL_SOCKET,
cmsg_type=SCM_CREDENTIALS, cmsg_data={pid=1359, uid=1000, gid=1000}}],
msg_controllen=32, msg_flags=0}, 0) = 4
getpid()                                = 1646
root@pine:~# ps aux|grep 1646
mobian      1646  5.6 11.1 4224460 442712 ?      Ssl  07:18  20:43 /usr/bin/
plasmashell --no-respawn
root@pine:~# dpkg -l plasma-workspace
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version      Architecture Description
+++-================-============-============-
===============================================================>
ii  plasma-workspace 4:6.2.4-1    arm64        base for Plasma Desktop,
Mobile, and Bigscreen graphical enviro


But the "plasma-settings -m kcm_mobile_wifi" command isn't too bad now.  Seems
that the same bug is still there in libraries but being triggered by different
apps.  Should we reassign it to plasma-workspace or libkscreenlocker6?

#1073294#40
Date:
2024-12-21 15:08:56 UTC
From:
To:
Hi Russell,
I have no clear idea what is causing the beahviour you're seeing.

Let me add, I have the feeling that this is better reported upstream rather than to another Debian maintainer.
I'd go with an issue targeting the plasma-mobile team [1], hopefully they'll know how to proceed with this.

But of course, feel free to reassign this to another Debian package.
Kind regards
Marco

[1]https://invent.kde.org/teams/plasma-mobile/issues/-/issues