[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of vendor code



>>> On 14.05.19 at 18:13, <Paul.Durrant@xxxxxxxxxx> wrote:
>>  -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>> Sent: 13 May 2019 08:36
>> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
>> Cc: Brian Woods <brian.woods@xxxxxxx>; Suravee Suthikulpanit 
> <suravee.suthikulpanit@xxxxxxx>; Andrew
>> Cooper <Andrew.Cooper3@xxxxxxxxxx>; Roger Pau Monne <roger.pau@xxxxxxxxxx>; 
>> Wei 
> Liu
>> <wei.liu2@xxxxxxxxxx>; Kevin Tian <kevin.tian@xxxxxxxxx>; xen-devel 
> <xen-devel@xxxxxxxxxxxxxxxxxxxx>
>> Subject: Re: [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of 
> vendor code
>> 
>> >>> On 08.05.19 at 15:24, <paul.durrant@xxxxxxxxxx> wrote:
>> > It's not vendor specific so it shouldn't really be there.
>> 
>> Perhaps, but this needs better justification:
>> 
>> > --- a/xen/drivers/passthrough/vtd/iommu.c
>> > +++ b/xen/drivers/passthrough/vtd/iommu.c
>> > @@ -2372,10 +2372,6 @@ static int __init vtd_setup(void)
>> >      P(iommu_hap_pt_share, "Shared EPT tables");
>> >  #undef P
>> >
>> > -    ret = scan_pci_devices();
>> > -    if ( ret )
>> > -        goto error;
>> > -
>> >      ret = init_vtd_hw();
>> 
>> Even after some looking around, it's not obvious to me that the latter
>> call doesn't depend on PCI devices being known, more specifically
>> segment 0's bus2bridge[] having been filled. Nor can I tell whether
>> there would be some noticeable misbehavior (prior to any guests
>> starting) if there was a dependency and it got broken by the re-
>> ordering.
> 
> I don't see any dependency but the code is somewhat tangled. Perhaps it 
> would be better to build the PCI topology *before* IOMMU init and then 
> iterate over the the devices after init to do the group assignment. I 
> certainly can't see anything in the scan as it stands that would need the 
> IOMMU to have been initialized.

Ah, yes, that's likely a better model. As to the dependency
aspect: pci_add_device() calls iommu_add_device(). But oddly
enough _scan_pci_devices() calls alloc_pdev(), not
pci_add_device(). So indeed there doesn't look to be any
dependency at present.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.