xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Brian Woods <brian.woods@amd.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of vendor code
Date: Wed, 15 May 2019 00:29:39 -0600	[thread overview]
Message-ID: <5CDBB1D3020000780022F109@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <9a476c95c1fb410b9330c45fa6799b9a@AMSPEX02CL03.citrite.net>

>>> On 14.05.19 at 18:13, <Paul.Durrant@citrix.com> wrote:
>>  -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: 13 May 2019 08:36
>> To: Paul Durrant <Paul.Durrant@citrix.com>
>> Cc: Brian Woods <brian.woods@amd.com>; Suravee Suthikulpanit 
> <suravee.suthikulpanit@amd.com>; Andrew
>> Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne <roger.pau@citrix.com>; Wei 
> Liu
>> <wei.liu2@citrix.com>; Kevin Tian <kevin.tian@intel.com>; xen-devel 
> <xen-devel@lists.xenproject.org>
>> 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@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Jan Beulich" <JBeulich@suse.com>
To: "Paul Durrant" <paul.durrant@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Brian Woods <brian.woods@amd.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of vendor code
Date: Wed, 15 May 2019 00:29:39 -0600	[thread overview]
Message-ID: <5CDBB1D3020000780022F109@prv1-mh.provo.novell.com> (raw)
Message-ID: <20190515062939.JMYR2j69MPCD70udzVYF4jY2aD_EBdIWMYa77kmKNuU@z> (raw)
In-Reply-To: <9a476c95c1fb410b9330c45fa6799b9a@AMSPEX02CL03.citrite.net>

>>> On 14.05.19 at 18:13, <Paul.Durrant@citrix.com> wrote:
>>  -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: 13 May 2019 08:36
>> To: Paul Durrant <Paul.Durrant@citrix.com>
>> Cc: Brian Woods <brian.woods@amd.com>; Suravee Suthikulpanit 
> <suravee.suthikulpanit@amd.com>; Andrew
>> Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne <roger.pau@citrix.com>; Wei 
> Liu
>> <wei.liu2@citrix.com>; Kevin Tian <kevin.tian@intel.com>; xen-devel 
> <xen-devel@lists.xenproject.org>
>> 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@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-05-15  6:29 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 13:23 [PATCH 0/5] iommu groups + cleanup Paul Durrant
2019-05-08 13:23 ` [Xen-devel] " Paul Durrant
2019-05-08 13:23 ` [PATCH 1/5] iommu: trivial re-organisation to avoid unnecessary test Paul Durrant
2019-05-08 13:23   ` [Xen-devel] " Paul Durrant
2019-05-13 15:22   ` Jan Beulich
2019-05-13 15:22     ` [Xen-devel] " Jan Beulich
2019-05-08 13:24 ` [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of vendor code Paul Durrant
2019-05-08 13:24   ` [Xen-devel] " Paul Durrant
2019-05-13 15:35   ` Jan Beulich
2019-05-13 15:35     ` [Xen-devel] " Jan Beulich
2019-05-14 16:13     ` Paul Durrant
2019-05-14 16:13       ` [Xen-devel] " Paul Durrant
2019-05-15  6:29       ` Jan Beulich [this message]
2019-05-15  6:29         ` Jan Beulich
2019-05-08 13:24 ` [PATCH 3/5] iommu: move iommu_get_ops() into common code Paul Durrant
2019-05-08 13:24   ` [Xen-devel] " Paul Durrant
2019-05-13 16:11   ` Jan Beulich
2019-05-13 16:11     ` [Xen-devel] " Jan Beulich
2019-05-14 16:19     ` Paul Durrant
2019-05-14 16:19       ` [Xen-devel] " Paul Durrant
2019-05-14 21:36       ` Julien Grall
2019-05-14 21:36         ` [Xen-devel] " Julien Grall
2019-05-15  6:32       ` Jan Beulich
2019-05-15  6:32         ` [Xen-devel] " Jan Beulich
2019-05-08 13:24 ` [PATCH 4/5] iommu: introduce iommu_groups Paul Durrant
2019-05-08 13:24   ` [Xen-devel] " Paul Durrant
2019-05-15  8:44   ` Roger Pau Monné
2019-05-15  8:44     ` [Xen-devel] " Roger Pau Monné
2019-05-31 13:48     ` Paul Durrant
2019-05-31 13:48       ` [Xen-devel] " Paul Durrant
2019-05-15 14:17   ` Jan Beulich
2019-05-15 14:17     ` [Xen-devel] " Jan Beulich
2019-05-31 13:55     ` Paul Durrant
2019-05-31 13:55       ` [Xen-devel] " Paul Durrant
2019-05-31 14:13       ` Jan Beulich
2019-05-31 14:13         ` [Xen-devel] " Jan Beulich
2019-05-31 14:21         ` Paul Durrant
2019-05-31 14:21           ` [Xen-devel] " Paul Durrant
2019-05-15 14:24   ` Jan Beulich
2019-05-15 14:24     ` [Xen-devel] " Jan Beulich
2019-05-08 13:24 ` [PATCH 5/5] iommu / pci: re-implement XEN_DOMCTL_get_device_group Paul Durrant
2019-05-08 13:24   ` [Xen-devel] " Paul Durrant
2019-05-15  9:06   ` Roger Pau Monné
2019-05-15  9:06     ` [Xen-devel] " Roger Pau Monné
2019-06-03  9:58     ` Paul Durrant
2019-06-03  9:58       ` [Xen-devel] " Paul Durrant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5CDBB1D3020000780022F109@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=brian.woods@amd.com \
    --cc=kevin.tian@intel.com \
    --cc=paul.durrant@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).