PCI: Avoid unnecessary CPU switch when calling driver .probe() method
authorAlexander Duyck <alexander.h.duyck@intel.com>
Mon, 18 Nov 2013 17:59:59 +0000 (10:59 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 25 Nov 2013 21:34:45 +0000 (14:34 -0700)
commit12c3156f10c5d8c5f1fb3f0bbdb8c1ddb1d1f65c
tree8436ef47131021f2ac50116d87f7931428e6292c
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae
PCI: Avoid unnecessary CPU switch when calling driver .probe() method

If we are already on a CPU local to the device, call the driver .probe()
method directly without using work_on_cpu().

This is a workaround for a lockdep warning in the following scenario:

  pci_call_probe
    work_on_cpu(cpu, local_pci_probe, ...)
      driver .probe
        pci_enable_sriov
          ...
            pci_bus_add_device
              ...
                pci_call_probe
                  work_on_cpu(cpu, local_pci_probe, ...)

It would be better to fix PCI so we don't call VF driver .probe() methods
from inside a PF driver .probe() method, but that's a bigger project.

[bhelgaas: open bugzilla, rework comments & changelog]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=65071
Link: http://lkml.kernel.org/r/CAE9FiQXYQEAZ=0sG6+2OdffBqfLS9MpoN1xviRR9aDbxPxcKxQ@mail.gmail.com
Link: http://lkml.kernel.org/r/20130624195942.40795.27292.stgit@ahduyck-cp1.jf.intel.com
Tested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Yinghai Lu <yinghai@kernel.org>
drivers/pci/pci-driver.c