From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sergio Lopez <slp@redhat.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"David Airlie" <airlied@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Gurchetan Singh" <gurchetansingh@chromium.org>,
"Chia-I Wu" <olvaffe@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Simona Vetter" <simona@ffwll.ch>,
"Rob Clark" <robdclark@gmail.com>,
"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
fnkl.kernel@gmail.com, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 0/5] virtio: obtain SHM page size from device
Date: Thu, 13 Feb 2025 10:53:07 -0500 [thread overview]
Message-ID: <20250213105231-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250213-virtio-shm-page-size-v1-0-5ee1f9984350@redhat.com>
On Thu, Feb 13, 2025 at 04:49:14PM +0100, Sergio Lopez wrote:
> There's an incresing number of machines supporting multiple page sizes
> and, on these machines, the host and a guest can be running with
> different pages sizes.
>
> In addition to this, there might be devices that have a required and/or
> preferred page size for mapping memory.
>
> In this series, we extend virtio_shm_region with a field to hold the
> page size. This field has a 16-bit size to accommodate into the existing
> padding virtio_pci_cap, simplifying the introduction of this additional
> data into the structure. The device will provide the page size in format
> PAGE_SIZE >> 12.
>
> The series also extends the PCI and MMIO transports to obtain the
> corresponding value from the device. For the PCI one, it should be safe
> since we're using an existing 16-bit padding in the virtio_pci_cap
> struct. For MMIO, we need to access a new register, so there's a risk
> the VMM may overreact and crash the VM. I've checked libkrun,
> firecracker, cloud-hypervisor and crosvm, and all of them should deal
> with the unexpected MMIO read gracefully. QEMU doesn't support SHM for
> the MMIO transport, so that isn't a concern either.
>
> How the SHM page size information is used depends on each device. Some
> may silently round up allocations, some may expose this information to
> userspace. This series includes a patch that extends virtio-gpu to
> expose the information via the VIRTGPU_GETPARAM ioctl, as an example of
> the second approach.
>
> This patch series is an RFC because it requires changes to the VIRTIO
> specifications. This patch series will be used as a reference to
> propose such changes.
>
> Signed-off-by: Sergio Lopez <slp@redhat.com>
don't you want to negotiate the page size with the
driver then?
> ---
> Sergio Lopez (5):
> virtio_config: add page_size field to virtio_shm_region
> virtio: introduce VIRTIO_F_SHM_PAGE_SIZE
> virtio-pci: extend virtio_pci_cap to hold page_size
> virtio-mmio: read shm region page size
> drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params
>
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++
> drivers/virtio/virtio_mmio.c | 13 +++++++++++++
> drivers/virtio/virtio_pci_modern.c | 31 ++++++++++++++++++++++++++++---
> drivers/virtio/virtio_ring.c | 2 ++
> include/linux/virtio_config.h | 1 +
> include/uapi/drm/virtgpu_drm.h | 1 +
> include/uapi/linux/virtio_config.h | 7 ++++++-
> include/uapi/linux/virtio_mmio.h | 3 +++
> include/uapi/linux/virtio_pci.h | 2 +-
> 9 files changed, 60 insertions(+), 5 deletions(-)
> ---
> base-commit: 4dc1d1bec89864d8076e5ab314f86f46442bfb02
> change-id: 20250213-virtio-shm-page-size-6e9a08c7ded1
>
> Best regards,
> --
> Sergio Lopez <slp@redhat.com>
next prev parent reply other threads:[~2025-02-13 15:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 15:49 [RFC PATCH 0/5] virtio: obtain SHM page size from device Sergio Lopez
2025-02-13 15:49 ` [PATCH RFC 1/5] virtio_config: add page_size field to virtio_shm_region Sergio Lopez
2025-02-13 15:49 ` [PATCH RFC 2/5] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE Sergio Lopez
2025-02-13 15:49 ` [PATCH RFC 3/5] virtio-pci: extend virtio_pci_cap to hold page_size Sergio Lopez
2025-02-13 19:22 ` Daniel Verkamp
2025-02-13 19:31 ` Daniel Verkamp
2025-02-14 9:13 ` Sergio Lopez Pascual
2025-02-14 9:09 ` Sergio Lopez Pascual
2025-02-13 15:49 ` [PATCH RFC 4/5] virtio-mmio: read shm region page size Sergio Lopez
2025-02-13 15:49 ` [PATCH RFC 5/5] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params Sergio Lopez
2025-02-13 15:53 ` Michael S. Tsirkin [this message]
2025-02-14 9:20 ` [RFC PATCH 0/5] virtio: obtain SHM page size from device Sergio Lopez Pascual
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=20250213105231-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=airlied@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eperezma@redhat.com \
--cc=fnkl.kernel@gmail.com \
--cc=gurchetansingh@chromium.org \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=olvaffe@gmail.com \
--cc=robdclark@gmail.com \
--cc=simona@ffwll.ch \
--cc=slp@redhat.com \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/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