Re: [RESEND PATCH V2 5/6] perf/x86/intel/uncore: Generic support for the PCI sub driver

From: Liang, Kan
Date: Tue Sep 22 2020 - 09:05:31 EST




On 9/21/2020 6:19 PM, Bjorn Helgaas wrote:
On Mon, Sep 14, 2020 at 07:34:19AM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

Some uncore counters may be located in the configuration space of a PCI
device, which already has a bonded driver. Currently, the uncore driver
cannot register a PCI uncore PMU for these counters, because, to
register a PCI uncore PMU, the uncore driver must be bond to the device.
However, one device can only have one bonded driver.

Add an uncore PCI sub driver to support such kind of devices.

The sub driver doesn't own the device. In initialization, the sub
driver searches the device via pci_get_device(), and register the
corresponding PMU for the device. In the meantime, the sub driver
registeris a PCI bus notifier, which is used to notify the sub driver
once the device is removed. The sub driver can unregister the PMU
accordingly.

s/registeris/registers/

It looks like this only handles hot-remove of the device, not hot-add.
Maybe that's OK for your use case, I dunno, so just pointing it out.


Hi Bjorn,

Thanks for the review.

Yes, the patch only supports the hot-remove for now, because
- I didn't get any requests for the hot-add support. I doubt anyone hot-adds a Root Port device in practice.
- To be honest, I don't have a test case to verify the hot-add of a Root Port device.
I used the command line below to test the hot-remove.
sudo bash -c 'echo 1 > /sys/bus/pci/devices/0000\:14\:04.0/remove'
Then the device is gone. I have no idea how to add it back.

So I only implemented the hot-remove in this patch. If anyone requires the hot-add, I can add it later separately.

Thanks,
Kan