Bug 48201 - PCIe root port runtime suspend does not keep proper track of VGA child
Summary: PCIe root port runtime suspend does not keep proper track of VGA child
Status: CLOSED CODE_FIX
Alias: None
Product: Power Management
Classification: Unclassified
Component: Run-Time-PM (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Rafael J. Wysocki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-02 17:59 UTC by Kristen
Modified: 2013-04-01 21:07 UTC (History)
4 users (show)

See Also:
Kernel Version: 3.6.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Debug suspend when children forbidden (517 bytes, text/plain)
2012-10-30 05:46 UTC, Huang Ying
Details
Keep runtime PM enabled for unbound PCI devices (5.07 KB, patch)
2012-11-19 06:20 UTC, Huang Ying
Details | Diff

Description Kristen 2012-10-02 17:59:44 UTC
I have the following root port and device on root port:

[root@otc-bromolow power]# lspci -v -s 00:1c.5
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
	Memory behind bridge: c0000000-c18fffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Intel Corporation Device 7270
	Capabilities: [a0] Power Management version 2
	Capabilities: [100] Advanced Error Reporting
	Kernel driver in use: pcieport

[root@otc-bromolow power]# lspci -v -s 03:00.0
03:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200e [Pilot] ServerEngines (SEP1) (rev 07) (prog-if 00 [VGA controller])
	Subsystem: Intel Corporation Device 0102
	Flags: bus master, fast devsel, latency 0, IRQ 11
	Memory at c0000000 (32-bit, non-prefetchable) [size=16M]
	Memory at c1810000 (32-bit, non-prefetchable) [size=16K]
	Memory at c1000000 (32-bit, non-prefetchable) [size=8M]
	Expansion ROM at c1800000 [disabled] [size=64K]
	Capabilities: [dc] Power Management version 2
	Capabilities: [e4] Express Legacy Endpoint, MSI 00
	Capabilities: [54] MSI: Enable- Count=1/1 Maskable- 64bit-

The VGA controller forbids runtime suspend, however, I can still runtime suspend the root port.  This causes the VGA controller to stop working.  If I then resume the root port (echo on > power/control), the VGA card starts working again.  I think the expected behavior should be that if the VGA card is still in use, we should not be able to runtime suspend the root port.
Comment 1 Rafael J. Wysocki 2012-10-29 08:40:01 UTC
What's in the VGA's power/control file?
Comment 2 Kristen 2012-10-29 17:44:36 UTC
on
Comment 3 Huang Ying 2012-10-30 05:46:59 UTC
Created attachment 85301 [details]
Debug suspend when children forbidden

Kristen, Could you try the patch?
Comment 4 Huang Ying 2012-11-19 06:20:21 UTC
Created attachment 86621 [details]
Keep runtime PM enabled for unbound PCI devices

Hi, Kristen,  Can you try the patch attached?
Comment 5 Rafael J. Wysocki 2012-11-28 22:36:51 UTC
Kristen, can you respond, please?
Comment 6 Kristen 2012-12-04 20:03:13 UTC
So, it kind of works.  Now when I switch the PCIe root port device control file to auto, the root port stays not suspended.  However, it appears that a side effect of this patch is that I can now go and enable runtime PM for the unbound VGA device, and it suspends right away, even while I am using it (i.e. displaying something).  I would expect it to stay active while it is being used.  I suspect the proper behavior is to mark VGA devices which are unbound as always active.
Comment 7 Rafael J. Wysocki 2012-12-04 21:23:36 UTC
We intentionally let user space control the PM of devices without drivers (in the kernel) and yes, it can do as you describe.  And no, we can't generally mark unbound VGA devices as always active, because (1) we don't distinguish between VGA and other devices and (2) users may actually want to power them down (think of a headless machine, for example).

So, do I understand correctly that the patch fixes the problem you originally reported?
Comment 8 Florian Mickler 2012-12-22 09:23:46 UTC
A patch referencing this bug report has been merged in Linux v3.8-rc1:

commit 967577b062417b4e4b8e27b711220f4124f5153a
Author: Huang Ying <ying.huang@intel.com>
Date:   Tue Nov 20 16:08:22 2012 +0800

    PCI/PM: Keep runtime PM enabled for unbound PCI devices

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