Skip to content

Reading pcie_bw file on amd GPU blocks for 1 second

Description

In the process of investigating stuttering graph updates, I discovered read()s on one sysfs file for my AMD RX-580, pcie_bw, block for 1 second to do a synchronous measurement. Although this is very bad no good API design on the kernel side, I can't find pcie bandwidth presented in the UI anywhere, and so Mission Center should not be reading it. (Or anything else not actively displayed, given how costly collecting resource usage info sometimes is; see the tragedy of smaps_rollup the unwise.)

Relevant Logs/Screenshots

Effect on read-publish cycle:

(missioncenter:2): MissionCenter::Perf-DEBUG: 05:10:42.141: Full read-publish cycle took 1.415787783s
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:10:42.642: Full read-publish cycle took 500.798547ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:10:44.091: Full read-publish cycle took 1.448880698s
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:10:44.592: Full read-publish cycle took 500.923747ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:10:46.206: Full read-publish cycle took 1.613998195s

After working around with mount -o bind /dev/zero /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/pcie_bw:

(missioncenter:2): MissionCenter::Perf-DEBUG: 05:12:44.117: Full read-publish cycle took 500.722682ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:12:44.618: Full read-publish cycle took 500.804917ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:12:45.119: Full read-publish cycle took 501.135802ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:12:45.620: Full read-publish cycle took 500.762324ms
(missioncenter:2): MissionCenter::Perf-DEBUG: 05:12:46.121: Full read-publish cycle took 500.752477ms

Other Info

OS: Fedora Installation Type: Flatpak Kernel: 6.11.10

CPU: Intel i5-4670K GPU: AMD RX-580 4 GiB

bpftrace script used to identify this problem: https://github.com/yump/bpftrace-tricks/blob/master/slow-io/slow-file-read-2.bt