]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI / hotplug / PCI: Avoid parent bus rescans on spurious device checks
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 7 Sep 2013 22:07:28 +0000 (00:07 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 9 Sep 2013 19:41:07 +0000 (21:41 +0200)
commit588e1a669ee378fde62af21a0cce94bbe333ae09
tree8c715da8750ff4479082270c7d4578e2027af972
parentc408641f0b346af2784f2760f5531f0405c787bd
ACPI / hotplug / PCI: Avoid parent bus rescans on spurious device checks

In the current ACPIPHP notify handler we always go directly for a
rescan of the parent bus if we get a device check notification for
a device that is not a bridge.  However, this obviously is
overzealous if nothing really changes, because this way we may rescan
the whole PCI hierarchy pretty much in vain.

That happens on Alex Williamson's machine whose ACPI tables contain
device objects that are supposed to coresspond to PCIe root ports,
but those ports aren't physically present (or at least they aren't
visible in the PCI config space to us).  The BIOS generates multiple
device check notifies for those objects during boot and for each of
them we go straight for the parent bus rescan, but the parent bus is
the root bus in this particular case.  In consequence, we rescan the
whole PCI bus from the top several times in a row, which is
completely unnecessary, increases boot time by 50% (after previous
fixes) and generates excess dmesg output from the PCI subsystem.

Fix the problem by checking if we can find anything new in the
slot corresponding to the device we've got a device check notify
for and doing nothig if that's not the case.

The spec (ACPI 5.0, Section 5.6.6) appears to mandate this behavior,
as it says:

  Device Check. Used to notify OSPM that the device either appeared
  or disappeared. If the device has appeared, OSPM will re-enumerate
  from the parent. If the device has disappeared, OSPM will
  invalidate the state of the device. OSPM may optimize out
  re-enumeration.

Therefore, according to the spec, we are free to do nothing if
nothing changes.

References: https://bugzilla.kernel.org/show_bug.cgi?id=60865
Reported-and-tested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/hotplug/acpiphp_glue.c