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

Re: [PATCH V11 1/3] libxl: Add support for Virtio disk configuration


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Date: Sat, 16 Jul 2022 15:55:28 +0000
  • Accept-language: en-US, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=btePDiAM88NFpJagtvHPsjc+2cSx5GO/bLziVxhqff0=; b=EPii9M7iAr5E37zuRGpD4j9IKIfjQZsqTVcDGl7MCy1lYnxhaDipeewu0dIYapDqh463Fr/7tZLbq+s3q/zlaqNk4CIM/iYnJ7fkmEycXtFll6NamcJVDJFCEthURGfTwhgxy1rZQb7CccJFK6HXwwtIsn9uNu3z3HzxZmejQpiYkXPJkslWwh80OCKAG3HtDs8/KuOrpiuPIbq+eRBJ0yDgrkU5Y6WmgM+pyx3BOOmwr98zixAU9TF0enGepVc+RB/tSU6cdoO065tsfCa81M6OFDwo6sKK4deJ3OAvPBJamGM46iLBIDS+/xRC7xCYwYkcQYn8WYtPj2MagtzfrQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EU1Njc9+2DurIE0E2b/ae85NQqfEFe6sEGVLur/93nJ2sqDG9KQ6YLSmQnPDfLoYDZo1BCALupVdtHolQ+jOaQp5nUqxqOYz059HNygjywjSJ4SQUi4uCuv/MDwF7nOa1X/2uY5imXdYlIwaFnpQZPPYeESIOy/UCyVRZQeCZI4M+Yn1Bhg1Okmaf/akZbS9fcIKhnmVcp8e72FmaxImNB3+ED3L/pz+2k9HYUAKZRLI7UCEfTlFAwqG+T0N1z7mT4U7fVAMkrpt/RSiMj16e4XyKq40UUn8s7zcGj3Zt9rfZ55XmDdwlGoblv9/oWs/rpOVM7BgWkX2KktzSUGFIA==
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Nick Rosbrook <rosbrookn@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Sat, 16 Jul 2022 15:55:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYmH/5Fy4H059mo02DmQSX0PsOXK2BJ++A
  • Thread-topic: [PATCH V11 1/3] libxl: Add support for Virtio disk configuration

Hello all.


On 15.07.22 22:20, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
>
> This patch adds basic support for configuring and assisting virtio-mmio
> based virtio-disk backend (emulator) which is intended to run out of
> Qemu and could be run in any domain.
> Although the Virtio block device is quite different from traditional
> Xen PV block device (vbd) from the toolstack's point of view:
>   - as the frontend is virtio-blk which is not a Xenbus driver, nothing
>     written to Xenstore are fetched by the frontend currently ("vdev"
>     is not passed to the frontend). But this might need to be revised
>     in future, so frontend data might be written to Xenstore in order to
>     support hotplugging virtio devices or passing the backend domain id
>     on arch where the device-tree is not available.
>   - the ring-ref/event-channel are not used for the backend<->frontend
>     communication, the proposed IPC for Virtio is IOREQ/DM
> it is still a "block device" and ought to be integrated in existing
> "disk" handling. So, re-use (and adapt) "disk" parsing/configuration
> logic to deal with Virtio devices as well.
>
> For the immediate purpose and an ability to extend that support for
> other use-cases in future (Qemu, virtio-pci, etc) perform the following
> actions:
> - Add new disk backend type (LIBXL_DISK_BACKEND_STANDALONE) and reflect
>    that in the configuration
> - Introduce new disk "specification" and "transport" fields to struct
>    libxl_device_disk. Both are written to the Xenstore. The transport
>    field is only used for the specification "virtio" and it assumes
>    only "mmio" value for now.
> - Introduce new "specification" option with "xen" communication
>    protocol being default value.
> - Add new device kind (LIBXL__DEVICE_KIND_VIRTIO_DISK) as current
>    one (LIBXL__DEVICE_KIND_VBD) doesn't fit into Virtio disk model
>
> An example of domain configuration for Virtio disk:
> disk = [ 'phy:/dev/mmcblk0p3, xvda1, backendtype=standalone, 
> specification=virtio']
>
> Nothing has changed for default Xen disk configuration.
>
> Please note, this patch is not enough for virtio-disk to work
> on Xen (Arm), as for every Virtio device (including disk) we need
> to allocate Virtio MMIO params (IRQ and memory region) and pass
> them to the backend, also update Guest device-tree. The subsequent
> patch will add these missing bits. For the current patch,
> the default "irq" and "base" are just written to the Xenstore.
> This is not an ideal splitting, but this way we avoid breaking
> the bisectability.
>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> ---
> Changes RFC -> V1:
>     - no changes
>
> Changes V1 -> V2:
>     - rebase according to the new location of libxl_virtio_disk.c
>
> Changes V2 -> V3:
>     - no changes
>
> Changes V3 -> V4:
>     - rebase according to the new argument for DEFINE_DEVICE_TYPE_STRUCT
>
> Changes V4 -> V5:
>     - split the changes, change the order of the patches
>     - update patch description
>     - don't introduce new "vdisk" configuration option with own parsing logic,
>       re-use Xen PV block "disk" parsing/configuration logic for the 
> virtio-disk
>     - introduce "virtio" flag and document it's usage
>     - add LIBXL_HAVE_DEVICE_DISK_VIRTIO
>     - update libxlu_disk_l.[ch]
>     - drop num_disks variable/MAX_VIRTIO_DISKS
>     - drop Wei's T-b
>
> Changes V5 -> V6:
>     - rebase on current staging
>     - use "%"PRIu64 instead of %lu for disk->base in device_disk_add()
>     - update *.gen.go files
>
> Changes V6 -> V7:
>     - rebase on current staging
>     - update *.gen.go files and libxlu_disk_l.[ch] files
>     - update patch description
>     - rework significantly to support more flexible configuration
>       and have more generic basic implementation for being able to extend
>       that for other use-cases (virtio-pci, qemu, etc).
>
> Changes V7 -> V8:
>     - update *.gen.go files and libxlu_disk_l.[ch] files
>     - update patch description and comments in the code
>     - use "specification" config option instead of "protocol"
>     - update libxl_types.idl and code according to new fields
>       in libxl_device_disk
>
> Changes V8 -> V9:
>     - update (and harden) checks in libxl__device_disk_setdefault(),
>       return error in case of incorrect settings of specification
>       and transport
>     - remove both asserts in device_disk_add()
>     - update virtio related code in libxl__disk_from_xenstore(),
>       do not fail if specification node is absent, replace
>       open-coded checks of fetched specification and transport by
>       libxl_disk_specification_from_string() and 
> libxl_disk_transport_from_string()
>       respectively
>     - s/libxl_device_disk_get_path/libxl__device_disk_get_path
>     - add a comment for virtio-mmio parameters in struct libxl_device_disk
>
> Changes V9 -> V10:
>     - s/ERROR_FAIL/ERROR_INVAL in both places in 
> libxl__device_disk_setdefault()
>     - rework libxl__device_disk_get_path()
>
> Changes V10 -> V10.1:
>     - fix small coding style issue in libxl__device_disk_get_path()
>     - drop specification check in main_blockattach() and add
>       required check in libxl__device_disk_setdefault()
>     - update specification check in main_blockdetach()
>
> Changes V10.1 -> V11:
>     - Anthony already gave his Reviewed-by, I dropped it due to the changes
>     - George already gave his Acked-by, I dropped it due to the changes
>     - s/other/standalone for the backendtype
> ---
>   docs/man/xl-disk-configuration.5.pod.in   |  38 +-
>   tools/golang/xenlight/helpers.gen.go      |   8 +
>   tools/golang/xenlight/types.gen.go        |  18 +
>   tools/include/libxl.h                     |   7 +
>   tools/libs/light/libxl_device.c           |  62 +-
>   tools/libs/light/libxl_disk.c             | 146 +++-
>   tools/libs/light/libxl_internal.h         |   2 +
>   tools/libs/light/libxl_types.idl          |  18 +
>   tools/libs/light/libxl_types_internal.idl |   1 +
>   tools/libs/light/libxl_utils.c            |   2 +
>   tools/libs/util/libxlu_disk_l.c           | 959 +++++++++++-----------
>   tools/libs/util/libxlu_disk_l.h           |   2 +-
>   tools/libs/util/libxlu_disk_l.l           |   9 +
>   tools/xl/xl_block.c                       |   6 +
>   14 files changed, 798 insertions(+), 480 deletions(-)


I have just realized that current patch doesn't apply to the staging 
clearly.

It's my fault, as V11 is based on the same staging state as V10 was.

It conflicts with changes done by the following commit:

54d8f27d04 tools/libxl: report trusted backend status to frontends


Also I noticed that golang bindings in current staging is out-of-sync.

I will push a rebased version soon in reply to current thread. Sorry for 
the inconvenience.


[snip]

-- 
Regards,

Oleksandr Tyshchenko

 


Rackspace

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