lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250815060320-mutt-send-email-mst@kernel.org>
Date: Fri, 15 Aug 2025 06:04:20 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
	virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
	hch@...radead.org
Subject: Re: [PATCH V5 4/9] virtio: introduce vring_mapping_token

On Fri, Aug 15, 2025 at 09:02:09AM +0800, Jason Wang wrote:
> On Thu, Aug 14, 2025 at 6:42 PM Michael S. Tsirkin <mst@...hat.com> wrote:
> >
> > On Thu, Aug 14, 2025 at 11:36:22AM +0800, Jason Wang wrote:
> > > > > diff --git a/include/linux/virtio.h b/include/linux/virtio.h
> > > > > index addbc209275a..37029df94aaf 100644
> > > > > --- a/include/linux/virtio.h
> > > > > +++ b/include/linux/virtio.h
> > > > > @@ -40,6 +40,13 @@ struct virtqueue {
> > > > >       void *priv;
> > > > >  };
> > > > >
> > > > > +union vring_mapping_token {
> > > > > +     /* Device that performs DMA */
> > > > > +     struct device *dma_dev;
> > > > > +     /* Transport specific token used for doing map */
> > > > > +     void *opaque;
> > > >
> > > > Please just declare whatever structure you want it to be.
> > >
> > > It's an opaque one and so
> > >
> > > 1) the virtio core knows nothing about that because it could be
> > > transport or device specific
> > > 2) no assumption of the type and usage, it just receive it from the
> > > transport and pass it back when doing the mapping
> > >
> > > It should work like page->private etc.
> > >
> > > Does this make sense?
> > >
> > > Thanks
> >
> > I fully expect most devices simply to use DMA here and no weird
> > tricks. vduse is the weird one, but I don't see us making it
> > grow much beyond that.
> >
> > So I think for now we can just make it vduse_iova_domain *.
> 
> It requires exporting VDUSE's internal data structure to the virtio
> layer which is a kind of layer violation.

It's just a forward declaration. You do not need the structure.

> And the iova domain will be
> soon replaced by virtqueue group in Eungeio's series that support
> multiple address spaces
> 
> > If we see
> > it's getting out of hand with too many types, we can think of solutions.
> 
> Considering we've already at it, I think it's better to have a
> solution now if it's not complicated:
> 
> I can think of two kind of solutions:
> 
> 1) Stick to the current void * pointer which is simple and straightforward
> 2) Eugenio's suggestion of having a virtio_map_head and let the
> transport/device get the container struct which is the real token.
> 
> E.g
> 
> struct vduse_iova_domain {
>       struct virtio_map_head map;
>       ......
> };
> 
> If you don't like void *, can we go fo 2)?
> 
> Thanks
> 
> 
> >
> > --
> > MST
> >


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ