Bug 194721 - Reading /sys/bus/pci/devices/0000:01:00.0/config wakes up Radeon dGPU
Summary: Reading /sys/bus/pci/devices/0000:01:00.0/config wakes up Radeon dGPU
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_video-dri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-27 09:04 UTC by Eugene Shalygin
Modified: 2017-05-05 18:22 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.8 and newer
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
dmesg (103.72 KB, text/plain)
2017-02-27 09:04 UTC, Eugene Shalygin
Details

Description Eugene Shalygin 2017-02-27 09:04:12 UTC
Created attachment 254957 [details]
dmesg

In ArchLinux with kernel 4.8 and newer accessing file /sys/bus/pci/devices/0000:01:00.0/config wakes up dGPU (like DRI_PRIME=1 glxinfo would do). Since many program read that file at startup, this is highly annoying. 

$ lspci 
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
00:1c.1 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #2 (rev d5)
00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d5)
00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 (rev d5)
00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM87 Express LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Neptune XT [Radeon HD 8970M]
03:00.0 PCI bridge: Texas Instruments XIO2213A/B/XIO2221 PCI Express to PCI Bridge [Cheetah Express] (rev 01)
04:00.0 FireWire (IEEE 1394): Texas Instruments XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express] (rev 01)
05:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411 PCI Express Card Reader (rev 01)
05:00.2 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0a)
06:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)

At the same time on the almost identical machine running Gentoo:
$ diff -U 1 lspci.txt lspci.txt.gentoo 
--- lspci.txt   2017-02-27 09:55:03.885457274 +0100
+++ lspci.txt.gentoo    2017-02-27 09:55:21.978499749 +0100
@@ -16,3 +16,3 @@
 00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
-01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Neptune XT [Radeon HD 8970M]
+01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Neptune XT [Radeon HD 8970M] (rev ff)
 03:00.0 PCI bridge: Texas Instruments XIO2213A/B/XIO2221 PCI Express to PCI Bridge [Cheetah Express] (rev 01)
@@ -21,2 +21,2 @@
 05:00.2 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0a)
-06:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
+06:00.0 Network controller: Intel Corporation Wireless 7260 (rev 73)

this does not happen. Rebuilding kernel with copied from the Gentoo machine config changed nothing. The attached dmesg output contains several such events at the end of the file.

When the dGPU is disabled using acpi_call and its example turn_off_gpu.sh script, accessing the /sys/bus/pci/devices/0000:01:00.0/config hangs a process (it does not react to SIGKILL).
Comment 1 Michel Dänzer 2017-02-28 01:15:17 UTC
This is https://bugs.freedesktop.org/show_bug.cgi?id=98502 .

I suspect reading the config file always powered up the GPU, but Mesa only recently started reading the file.
Comment 2 Eugene Shalygin 2017-02-28 01:39:40 UTC
Excuse me, but as it is written in the bug report, this was never the case before, and does not happen on my second (almost identical) laptop which runs Gentoo and kernel 4.10.0 right now.
Comment 3 Michel Dänzer 2017-02-28 01:41:55 UTC
Are both laptops using the same version of Mesa?
Comment 4 Eugene Shalygin 2017-02-28 01:44:23 UTC
Yes, 17.0.0. But does it matter? The problem manifests itself when I do
$ cat /sys/bus/pci/devices/0000:01:00.0/config

or lspci does read this file.
Comment 5 Eugene Shalygin 2017-02-28 01:48:55 UTC
And the second problem is even worse: if the dGPU was disabled using acpi_call, any read from that file hangs the reading process somewhere in the kernel. This also was neither the case before nor happen on the Gentoo machine or in Arch Linux with kernel version < 4.8.
Comment 6 mathieu.westphal 2017-05-05 18:22:34 UTC
I reproduce this bug as well.

lspci hangs and freeze the system.

Note You need to log in before you can comment on or make changes to this bug.