https://bugs.kde.org/show_bug.cgi?id=521240

            Bug ID: 521240
           Summary: gpu/gpu1/memoryFrequency sensor reports 0 MHz on AMD
                    RDNA4 (RX 9070 XT) under 3D load
    Classification: Frameworks and Libraries
           Product: ksystemstats
      Version First unspecified
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

The System Monitor Sensor widget (gpu/gpu1/memoryFrequency) always displays 0
MHz for the GPU memory frequency while a 3D workload (e.g. FurMark, games) is
running. At idle, the sensor reports the correct value.

== Root cause ==

LinuxAmdGpu.cpp reads the current memory clock via ppTableGetCurrent(), which
parses /sys/class/drm/card1/device/pp_dpm_mclk and looks for the line marked
with *:

  int ppTableGetCurrent(const QByteArray &table) {
      int current = 0;
      for (const auto &line : lines) {
          if (!line.contains("*")) continue;
          current = std::atoi(line.mid(line.indexOf(":") + 1));
      }
      return current;  // returns 0 if no "*" found
  }

On RDNA4 (Navi 48), the AMDGPU kernel driver does NOT set the * marker in
pp_dpm_mclk during active 3D rendering. The file content during 3D load:

  0: 96Mhz
  1: 456Mhz
  2: 772Mhz
  3: 875Mhz
  4: 1124Mhz
  5: 1258Mhz

No * on any line → ppTableGetCurrent() returns 0 → sensor reports 0 MHz.

At idle, * is present and the sensor works correctly:

  0: 96Mhz *

The hwmon interface reports the correct current frequency at all times
(including under 3D load):
  /sys/class/hwmon/hwmonN/freq2_input  (label: mclk, value in Hz)

This issue does NOT occur on RDNA2 (RX 6800 XT) — that driver always marks the
active state with *.

== Steps to reproduce ==

1. System with AMD RDNA4 GPU (e.g. RX 9070 XT, PCI ID 1002:7550)
2. Add a System Monitor Sensor widget configured to show
gpu/gpu1/memoryFrequency
3. Launch a 3D workload (FurMark, a game, etc.)
4. Observe the widget showing 0 MHz for the entire duration of the workload

== Expected behavior ==

Widget shows the actual GPU memory frequency (e.g. up to 1258 MHz per DPM
table)

== Actual behavior ==

Widget shows 0 MHz under any 3D load

== Suggested fix ==

Fall back to reading freq2_input from the hwmon sysfs interface when
ppTableGetCurrent() returns 0 (i.e. when no * marker is found). The hwmon path
for the AMDGPU memory clock is hwmon/hwmonN/freq2_input (value in Hz, label
"mclk"). Alternatively, prefer hwmon freq2_input over pp_dpm_mclk for current
frequency reporting on RDNA4+ hardware, as it is always up to date.

== System information ==

- GPU: AMD Radeon RX 9070 XT (Navi 48, 1002:7550 rev c0)
- Kernel: 7.0.11-1-cachyos (AMDGPU built-in)
- ksystemstats: 6.6.5-2.1
- KDE Plasma: 6.6.5
- OS: Arch Linux (CachyOS)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to