Re: [PATCH V4 1/3] driver core: mark device as irq affinity managed if any irq is managed

Thomas Gleixner
2021-07-21T07:25:36Z

On Mon, Jul 19 2021 at 11:44, Christoph Hellwig wrote:
> On Mon, Jul 19, 2021 at 08:51:22AM +0100, John Garry wrote:
>>> Address this issue by adding one field of .irq_affinity_managed into
>>> 'struct device'.
>>>
>>> Suggested-by: Christoph Hellwig <hch@lst.de>
>>> Signed-off-by: Ming Lei <ming.lei@redhat.com>
>>
>> Did you consider that for PCI device we effectively have this info already:
>>
>> bool dev_has_managed_msi_irq(struct device *dev)
>> {
>> struct msi_desc *desc;
>>
>> list_for_each_entry(desc, dev_to_msi_list(dev), list) {
>> if (desc->affinity && desc->affinity->is_managed)
>> return true;
>> }
>>
>> return false;
>
> Just walking the list seems fine to me given that this is not a
> performance criticial path. But what are the locking implications?

At the moment there are none because the list is initialized in the
setup path and never modified afterwards. Though that might change
sooner than later to fix the virtio wreckage vs. MSI-X.

> Also does the above imply this won't work for your platform MSI case?

The msi descriptors are attached to struct device and independent of
platform/PCI/whatever.

Thanks,

tglx