All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH v2 1/4] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use
Date: Thu, 17 Jan 2019 10:21:34 +0100	[thread overview]
Message-ID: <20190117092134.5jkayufjoerleybm@mac> (raw)
In-Reply-To: <20190116170033.GO1205@mail-itl>

On Wed, Jan 16, 2019 at 06:00:33PM +0100, Marek Marczykowski-Górecki wrote:
> On Wed, Jan 16, 2019 at 05:47:19PM +0100, Roger Pau Monné wrote:
> > On Tue, Jan 15, 2019 at 04:36:28PM +0100, Marek Marczykowski-Górecki wrote:
> > > HVM domains use IOMMU and device model assistance for communicating with
> > > PCI devices, xen-pcifront/pciback is used only in PV domains.
> > 
> > You still need pciback in order to reset the device when it's
> > deassigned from the guest, so it's functionality is not only used by
> > PV guests.
> 
> Right, I'll update the commit message to match v2 code.
> 
> > > When HVM domain has device model in stubdomain, attaching xen-pciback to
> > > the target domain itself is not only useless, but also may prevent
> > > attaching xen-pciback to the stubdomain, effectively breaking PCI
> > > passthrough.
> > 
> > Right. When doing passthrough with a stubdomain you want the target
> > domain to have the memory and IO regions mapped, and the stubdomain to
> > handle the rest.
> > 
> > > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> > > ---
> > > Changes in v2:
> > >  - previously called "libxl: attach xen-pciback only to PV domains"
> > >  - instead of excluding all HVMs, change the condition to what actually
> > >    matters here - check if stubdomain is in use; this way xen-pciback is
> > >    always in use (either for the target domain, or it's stubdomain),
> > >    fixing PCI reset by xen-pciback concerns
> > > ---
> > >  tools/libxl/libxl_pci.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
> > > index 87afa03..3b6b23c 100644
> > > --- a/tools/libxl/libxl_pci.c
> > > +++ b/tools/libxl/libxl_pci.c
> > > @@ -1106,7 +1106,7 @@ out:
> > >          }
> > >      }
> > >  
> > > -    if (!starting)
> > > +    if (!starting && !libxl_get_stubdom_id(CTX, domid))
> > 
> > This change seems to assume that both libxl_domain_config for the
> > target and the stubdomain will have the assigned pci devices in the
> > pcidevs field. 
> 
> Not really. libxl__device_pci_add() calls do_pci_add() for both stubdomain
> (if applicable) and target domain.

OK. From an architectural PoV I think it would make more sense to copy
the list of pci devices to the stubdom config in libxl__spawn_stub_dm,
but I'm not that familiar with pci handling in libxl, so there might
be a reason why things are done like this currently.

The change LGTM, albeit I found the pci handling code quite hard to
follow. I'm also not sure whether certain parts of the code are
correct, for example the PCI INTx seems to be mapped to both the
stubdomain and the target domain, when it's only the target domain the
one that actually uses it.

Thanks, Roger.

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

  reply	other threads:[~2019-01-17  9:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 15:36 [PATCH v2 0/4] Fix PCI passthrough for HVM with stubdomain Marek Marczykowski-Górecki
2019-01-15 15:36 ` [PATCH v2 1/4] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use Marek Marczykowski-Górecki
2019-01-16 16:47   ` Roger Pau Monné
2019-01-16 17:00     ` Marek Marczykowski-Górecki
2019-01-17  9:21       ` Roger Pau Monné [this message]
2019-01-17 13:32         ` Marek Marczykowski-Górecki
2019-01-15 15:36 ` [PATCH v2 2/4] libxl: attach PCI device to qemu only after setting pciback/pcifront Marek Marczykowski-Górecki
2019-01-17 10:29   ` Roger Pau Monné
2019-01-26  2:24     ` Marek Marczykowski-Górecki
2019-01-15 15:36 ` [PATCH v2 3/4] libxl: don't try to manipulate json config for stubdomain Marek Marczykowski-Górecki
2019-01-17 10:44   ` Roger Pau Monné
2019-01-15 15:36 ` [PATCH v2 4/4] xen/x86: Allow stubdom access to irq created for msi Marek Marczykowski-Górecki
2019-01-16  9:21   ` Roger Pau Monné
2019-01-16 10:52     ` Marek Marczykowski-Górecki
2019-01-16 12:20       ` Roger Pau Monné
     [not found]         ` <94C5C3AC020000F30063616D@prv1-mh.provo.novell.com>
2019-01-16 12:57           ` Jan Beulich
2019-01-16 13:07             ` Roger Pau Monné
2019-01-16 13:49         ` Marek Marczykowski-Górecki
2019-01-17  8:57           ` Roger Pau Monné
     [not found]             ` <FB0C9893020000480063616D@prv1-mh.provo.novell.com>
2019-01-17 11:52               ` Jan Beulich
2019-01-17 11:56                 ` Roger Pau Monné
2019-01-17 12:20                   ` Jan Beulich
2019-01-17 12:32                     ` Roger Pau Monné
     [not found]                       ` <21B633D80200008F0063616D@prv1-mh.provo.novell.com>
2019-01-17 13:12                         ` Jan Beulich
2019-01-25 19:43       ` Marek Marczykowski-Górecki
2019-01-25 20:04         ` Marek Marczykowski-Górecki

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=20190117092134.5jkayufjoerleybm@mac \
    --to=roger.pau@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=marmarek@invisiblethingslab.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.