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

Re: [PATCH 2/2] xen/virtio: Avoid use of the dom0 backend in dom0


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 4 Jul 2023 16:49:09 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1a3Wu7ZwpKUye8yTK3Oda4WTS140fzit/X7bwpStt90=; b=bTcGDdINW5wAC0QUYz/DEnP0G5pR+nM+ROx4N/SypXQKadnPt11gntNWTmzyGH9er3eNvX3XKFng0LSovuZK/adY4/s4ew2qf+ZnCoE5EWJ4V9oPTV9F38XcJ9XXZMIuUrN2lhjzVWrjss9i9A+fk/s5xNaVEYShFk5Bz2niKwj+rWfEhRa8ZgxXTmyGlMbpa8j73J4jUBXFGiv9kSoD/pkB8o+/TNBtKI7mkeg2SOweB1vO5YmvvGUJb1tvZcsPGygCvRSwwTOdlXTizNNsBBF7KdggmBhNloOhUchDChaLuTcjrS0y/s+HOSbdiDGlTD7ADvC7GkYFs4xKA/i+lg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SfU9qXoZ1t2w1SiIiIaERUNHq5a4Oo/ukxRCKVBz41hTPPeZ9PUUJroeiV//KstA2A2o0HkJI0qUJmEqrCZmdg+sEmulVLkjghuGd+bJMhHjmmq1y0M3kGqvB8yNZjS8fE5tWjoDkuagzI+c+imHDwYOrjzFJgaNatp7UlXjtyMJhcKhIcoZQ1r0Dd3OcyhOseC4Val0wIciJOsW4nlZv6PBPmklWhTLMDU1FgpNazDuSGwCFsj2q2Z3gxH608MgWnpfPh0hgDXD2w2aJCW5XRzvXScAbE40s8/PbfYiShPKHK1qrlYsah4ZHQOjyTdtYwmQOW7pOIKvQsJ/ZfR7ww==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Petr Pavlu <petr.pavlu@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, vikram.garhwal@xxxxxxx
  • Delivery-date: Tue, 04 Jul 2023 14:49:36 +0000
  • Ironport-data: A9a23:IS6XAakZPWgM1nE/fIl/0pvo5gw8J0RdPkR7XQ2eYbSJt1+Wr1Gzt xIfC2COPPrYMGDyeItyYYTn/BsP78TdnN83HQE++HszFCMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5K2aVA8w5ARkPqgU5AOGzBH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 cwYdj81TwGju8mZh7+WSNJImsI9COC+aevzulk4pd3YJdAPZMmaBo7tvJpf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVI3iea8WDbWUoXiqcF9hEGXq 3iA523kKhobKMae2XyO9XfEaurnxHqkBtNKReXjnhJsqB6i7DMCK0QdbH+QhaGkk1+xfPR+C VNBr0LCqoB3riRHVOLVWhSipXeesx00WtxOEvY74gWA1qrV5QmCAmEOCDVGbbQOtsAsQicx/ kSUhN6vDjtq2JWOUm6U/LqQqTK0OAAWIHUEaCtCShEKi/HEpIwwlRvJQsxULL+ujtb1FDfzx BiHtCE7wb4UiKYjz6in5xbfiiyou7DSUxU4oA7QWwqN/g5/IYKoeYGswVza9upbapaUSEGbu 3oJkNTY6/oBZbmJlSqQUKAOEauv6vKtLjLRmxhsEoMn+jDr/GSsFahO4TJkLUIvPc8eeSDgZ GfavA8X75hWVEZGdodyaoO1Ts8tlK7pEI28UuiON4QfJJ9saAWA4SdiI1aK2Hzgm1Qtlqd5P oqHdcGrDjARDqEPICeKetrxGIQDnkgWrV4/j7ihp/h7+dJyvEKodIo=
  • Ironport-hdrordr: A9a23:kLd+o6iHlir4lMlBqYnMvVTwOXBQXhsji2hC6mlwRA09TyVXrb HVoB17726ItN91Yh4dcL+7Sc+9qB/nhPlICMwqTNOftUrdyRqVxeJZnOnfKl/balTDH7VmpN ldmsFFYbWaZzUXsS+52njcLz9K+qj+zEnHv5ak856vd2BXgmNbgTuRxjz6LmRGAC1PBZ84E5 TZw8pculObCAQqhw2Adxo4tvD41qL2fYzdEGI7OyI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jul 04, 2023 at 01:43:46PM +0200, Marek Marczykowski-Górecki wrote:
> Hi,
> 
> FWIW, I have ran into this issue some time ago too. I run Xen on top of
> KVM and then passthrough some of the virtio devices (network one
> specifically) into a (PV) guest. So, I hit both cases, the dom0 one and
> domU one. As a temporary workaround I needed to disable
> CONFIG_XEN_VIRTIO completely (just disabling
> CONFIG_XEN_VIRTIO_FORCE_GRANT was not enough to fix it).
> With that context in place, the actual response below.
> 
> On Tue, Jul 04, 2023 at 12:39:40PM +0200, Juergen Gross wrote:
> > On 04.07.23 09:48, Roger Pau Monné wrote:
> > > On Thu, Jun 29, 2023 at 03:44:04PM -0700, Stefano Stabellini wrote:
> > > > On Thu, 29 Jun 2023, Oleksandr Tyshchenko wrote:
> > > > > On 29.06.23 04:00, Stefano Stabellini wrote:
> > > > > > I think we need to add a second way? It could be anything that can 
> > > > > > help
> > > > > > us distinguish between a non-grants-capable virtio backend and a
> > > > > > grants-capable virtio backend, such as:
> > > > > > - a string on xenstore
> > > > > > - a xen param
> > > > > > - a special PCI configuration register value
> > > > > > - something in the ACPI tables
> > > > > > - the QEMU machine type
> > > > > 
> > > > > 
> > > > > Yes, I remember there was a discussion regarding that. The point is to
> > > > > choose a solution to be functional for both PV and HVM *and* to be 
> > > > > able
> > > > > to support a hotplug. IIRC, the xenstore could be a possible 
> > > > > candidate.
> > > > 
> > > > xenstore would be among the easiest to make work. The only downside is
> > > > the dependency on xenstore which otherwise virtio+grants doesn't have.
> > > 
> > > I would avoid introducing a dependency on xenstore, if nothing else we
> > > know it's a performance bottleneck.
> > > 
> > > We would also need to map the virtio device topology into xenstore, so
> > > that we can pass different options for each device.
> > 
> > This aspect (different options) is important. How do you want to pass virtio
> > device configuration parameters from dom0 to the virtio backend domain? You
> > probably need something like Xenstore (a virtio based alternative like 
> > virtiofs
> > would work, too) for that purpose.
> > 
> > Mapping the topology should be rather easy via the PCI-Id, e.g.:
> > 
> > /local/domain/42/device/virtio/0000:00:1c.0/backend
> 
> While I agree this would probably be the simplest to implement, I don't
> like introducing xenstore dependency into virtio frontend either.
> Toolstack -> backend communication is probably easier to solve, as it's
> much more flexible (could use qemu cmdline, QMP, other similar
> mechanisms for non-qemu backends etc).

I also think features should be exposed uniformly for devices, it's at
least weird to have certain features exposed in the PCI config space
while other features exposed in xenstore.

For virtio-mmio this might get a bit confusing, are we going to add
xenstore entries based on the position of the device config mmio
region?

I think on Arm PCI enumeration is not (usually?) done by the firmware,
at which point the SBDF expected by the tools/backend might be
different than the value assigned by the guest OS.

I think there are two slightly different issues, one is how to pass
information to virtio backends, I think doing this initially based on
xenstore is not that bad, because it's an internal detail of the
backend implementation. However passing information to virtio
frontends using xenstore is IMO a bad idea, there's already a way to
negotiate features between virtio frontends and backends, and Xen
should just expand and use that.


> > > > Vikram is working on virtio with grants support in QEMU as we speak.
> > > > Maybe we could find a way to add a flag in QEMU so that we can detect at
> > > > runtime if a given virtio device support grants or not.
> > > 
> > > Isn't there a way for the device to expose capabilities already?  For
> > > example how does a virtio-blk backend expose support for indirect
> > > descriptors?
> > 
> > Those capabilities are defined in the virtio spec [1]. Adding the backend
> > domid would be possible, but it probably wouldn't be that easy (requires
> > changing the virtio spec by either expanding an existing config area or by
> > adding a new one). I'm not sure handling in the specific frontends is
> > generic enough for being able to have a central place where the backend
> > domid could be retrieved, without requiring any change of the frontends.
> 
> IMHO the proper solution is to extend the spec. I don't have much
> experience with virtio code, but reading the spec it looks like new
> config area will be better for compatibility/uniform handling in a
> frontent-agnostic way. Since it will definitely take time, some
> transitional solution (maybe even xenstore...) might be warranted.

My fear is that such 'transitional' solutions end up being definitive
ones, as people move to other stuff once things work.  Might be better
to implement a transitional approach based on a future virtio
specification change rather than something out of band based on a
completely different communication channel.

Thanks, Roger.



 


Rackspace

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