Bug 461389 - GPU sensors missing after update
Summary: GPU sensors missing after update
Status: RESOLVED DUPLICATE of bug 462512
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (show other bugs)
Version: 5.26.2
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-11-03 22:59 UTC by Oleksii Zolotarevskyi
Modified: 2023-01-04 18:38 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
GPU sensors missing in the System Monitor after Plasma update (172.58 KB, image/png)
2022-11-03 22:59 UTC, Oleksii Zolotarevskyi
Details
GPU sensors show zero values after fixing the GPU name manually (124.72 KB, image/png)
2022-12-04 00:57 UTC, Oleksii Zolotarevskyi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksii Zolotarevskyi 2022-11-03 22:59:26 UTC
Created attachment 153446 [details]
GPU sensors missing in the System Monitor after Plasma update

SUMMARY
After Plasma update on the laptop with hybrid Nvidia+Intel graphics, the name of the Nvidia GPU has changed from gpu0 to gpu1. Because of this, the System Monitor can not find the sensors added for gpu0 (see the attachment).
I think it happened because I added the sensor to the System monitor while Nvidia was set as primary GPU, and then I switched to Intel GPU before updating the Plasma.

I think it would make sense to somehow prevent the change of the GPU names during update, or to track if the GPU name has changed and adjust the sensors location.

STEPS TO REPRODUCE
1. Switch to Nvidia GPU
2. Add a GPU sensor in the System Monitor
3. Switch to Intel GPU
4. Update Plasma

OBSERVED RESULT
Previously added GPU sensor in the System Monitor is missing

EXPECTED RESULT
Previously added GPU sensor in the System Monitor is not missing

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro Linux
(available in About System)
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
In my case the Plasma was updated from 5.25.5 to 5.26.2
Comment 1 Nate Graham 2022-11-04 18:27:41 UTC
*** Bug 461361 has been marked as a duplicate of this bug. ***
Comment 2 Oleksii Zolotarevskyi 2022-12-04 00:52:48 UTC
I've tried changing the sensor paths in the widgets and in System Monitor to gpu1, and got zero values for all GPU sensors (0% usage, 0Hz frequency etc.).
So even with the corrected GPU name, the sensors are still missing.
Not sure if can be considered as a separate bug.
Comment 3 Oleksii Zolotarevskyi 2022-12-04 00:57:44 UTC
Created attachment 154292 [details]
GPU sensors show zero values after fixing the GPU name manually
Comment 4 ZAN DoYe 2022-12-08 01:51:25 UTC
This could be the nvidia-smi problem. I'm a debian user subscribing the official nvidia repository. After the latest nvidia udpate(nvidia driver 525) All the hardware monitor values related to nvidia card are zero.

As a debian stable user working with plasma 5.20, the code monitoring nvidia card is in https://invent.kde.org/plasma/ksysguard.git/
And below is my patch to fix this issue(the new version of nvidia-smi now displays value with both prefix and suffix spaces and set the value of mtemp to '-' which will cause an error when tying to convert to int number):

The line number in the patch may differ with yours because I also tweaked other parts of the code to make it suitable for my need.

@@ -129,11 +179,13 @@ NvidiaPlugin::NvidiaPlugin(QObject *parent, const QVariantList &args)
 
     connect(m_process, &QProcess::readyReadStandardOutput, this, [=]() {
         while (m_process->canReadLine()) {
-            const QString line = m_process->readLine();
+            QString line = m_process->readLine();
             if (line.startsWith(QLatin1Char('#'))) {
                 continue;
             }
-            const QVector<QStringRef> parts = line.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
+            line.replace('-', '0');
+            line= line.trimmed();
+            const QVector<QStringRef> parts = line.splitRef(QRegExp(" +"), Qt::SkipEmptyParts);
 
             // format at time of writing is
             // # gpu   pwr gtemp mtemp    sm   mem   enc   dec  mclk  pclk
Comment 5 ZAN DoYe 2022-12-08 02:09:59 UTC
As for later versions of plasma.

IIRC, The monitor code was moved
from https://invent.kde.org/plasma/ksysguard.git/
to https://invent.kde.org/plasma/ksystemstats/-/blob/master/plugins/gpu/NvidiaSmiProcess.cpp

function void NvidiaSmiProcess::readStatisticsData()

The logic is the same, so we can fix it in the same way.
Comment 6 Riccardo Robecchi 2022-12-08 10:14:30 UTC
*** Bug 462541 has been marked as a duplicate of this bug. ***
Comment 7 David Edmundson 2023-01-04 17:54:26 UTC

*** This bug has been marked as a duplicate of bug 462512 ***
Comment 8 David Edmundson 2023-01-04 17:54:40 UTC
*** Bug 463033 has been marked as a duplicate of this bug. ***