|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/msi: prevent MSI entry re-writes of the same data
On 05.03.2025 18:57, Roger Pau Monné wrote:
> On Wed, Mar 05, 2025 at 11:30:51AM +0100, Jan Beulich wrote:
>> On 28.02.2025 12:32, Roger Pau Monne wrote:
>>> @@ -1407,7 +1415,9 @@ int pci_restore_msi_state(struct pci_dev *pdev)
>>> }
>>> type = entry->msi_attrib.type;
>>>
>>> - msg = entry->msg;
>>> + msg.dest32 = entry->msg.dest32;
>>> + msi_compose_msg(desc->arch.vector, NULL, &msg);
>>> + entry->msg = (typeof(entry->msg)){};
>>> write_msi_msg(entry, &msg);
>>
>> Hmm, this isn't exactly a "restore" then anymore. That said, re-constructing
>> the message may even be more correct. Then, however, the question is whether
>> passing NULL as msi_compose_msg()'s middle argument is really appropriate. A
>> little bit of commentary may be desirable here in any event, also as to need
>> to clear entry->msg.
>
> I can add a comment. Note that as part of the patch a comment is
> already added to both the msi_compose_msg() prototype and definition
> regarding what passing a NULL cpu_mask implies.
Right; the comment I'm asking for here is to explain why it's not really a
restore that we do, but a re-build.
>>> --- a/xen/drivers/passthrough/vtd/iommu.c
>>> +++ b/xen/drivers/passthrough/vtd/iommu.c
>>> @@ -1182,7 +1182,7 @@ static void cf_check dma_msi_end(struct irq_desc
>>> *desc, u8 vector)
>>> static void cf_check dma_msi_set_affinity(
>>> struct irq_desc *desc, const cpumask_t *mask)
>>> {
>>> - struct msi_msg msg;
>>> + struct msi_msg msg = {};
>>> unsigned int dest;
>>> unsigned long flags;
>>> struct vtd_iommu *iommu = desc->action->dev_id;
>>
>> Why not a similar transformation as you do in set_msi_affinity(), eliminating
>> the local "dest"?
>
> It was more intrusive, but I can certainly do it.
>
>> A change like the one here is likely needed in __hpet_setup_msi_irq(), to
>> prevent accidental "uninitialized struct field" warnings.
>
> Hm, won't the struct be fully initialized in that case, by getting
> passed a cpu_mask?
Oh, of course. No idea what I was thinking ...
> I don't mind doing so however.
No need to then, I guess.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |