Re: [PATCH RFC 09/15] hw/virtio/vhost-shadow-virtqueue: specified vring placement

Connor Kite <[email protected]>
Newsgroups dev.linux.lists.virtio-fs,org.nongnu.qemu-devel
Message-ID <CA+spn3ocMhWx_0wK_b0oNGxphnBw3gJQqYd9XR9D3Bq3bETKFQ@mail.gmail.com>
On Mon, Aug 3, 2026 at 5:48 AM Hanna Czenczek <[email protected]> wrote:
>
> On 24.07.26 00:30, Connor Kite wrote:
> > By default svq vrings are placed in an anonymous memory map. As svqs
> > will be leveraged to enable memory isolation in vhost-user, it is useful
> > to be able to place the vrings in a shared isolation memory region.
> >
> > Adds the option to specify vring placement by providing a vring base
> > address before starting the svq.
> >
> > Signed-off-by: Connor Kite <[email protected]>
> > ---
> >   hw/virtio/vhost-shadow-virtqueue.c | 22 +++++++++++++++-------
> >   hw/virtio/vhost-shadow-virtqueue.h |  3 +++
> >   2 files changed, 18 insertions(+), 7 deletions(-)
>
> I would go beyond Stefan and say that I do really ask for explicit
> bounds checking on the area.
>
> Besides that, `vhost_svq_stop()` still always calls `munmap()` on `desc`
> and `used` and that must absolutely not be done in case a fixed location
> was provided.
>
> Also, it would be nicer to have a function to set the base address
> instead of having to modify the svq object directly.
>
> Hanna

Got it!  I now check that the last address in the vring area is not
less than the
first address.  vhost_svq_start now returns an int so that success/error can be
communicated to the caller.

I just moved some existing changes to vhost_svq_stop forward to this patch to
just memset the vring area to 0 if static location is used and vring
pointers are not
null.

vhost_svq_set_base_addr has been added in to remove direct adjustment to the svq
base address.

Best,
Connor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.