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: <CACGkMEuZKSd5CATEiPUoFiWCU5JY+myn6zsJV+UYUt71-4Xdrg@mail.gmail.com>
Date: Fri, 24 Jan 2025 09:03:39 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eugenio Perez Martin <eperezma@...hat.com>
Cc: linux-kernel@...r.kernel.org, mst@...hat.com, 
	Hanna Reitz <hreitz@...hat.com>, Stefano Garzarella <sgarzare@...hat.com>, 
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Vivek Goyal <vgoyal@...hat.com>, 
	Miklos Szeredi <miklos@...redi.hu>, German Maglione <gmaglione@...hat.com>, 
	Stefan Hajnoczi <stefanha@...hat.com>, virtualization@...ts.linux.dev
Subject: Re: [RFC 2/5] virtio_ring: introduce virtqueue_map/unmap_sgs()

On Thu, Jan 23, 2025 at 3:32 PM Eugenio Perez Martin
<eperezma@...hat.com> wrote:
>
> On Thu, Jan 23, 2025 at 2:51 AM Jason Wang <jasowang@...hat.com> wrote:
> >
> > On Thu, Jan 23, 2025 at 12:32 AM Eugenio Pérez <eperezma@...hat.com> wrote:
> > >
> > > From: Jason Wang <jasowang@...hat.com>
> > >
> > > Introduce new virtqueue DMA operations which allows the drivers that
> > > want to make use of the premapping API but operate at the sg level.
> > >
> > > Note that we still follow the assumtions if virtqueue_add() so
> > > dma_map_sg() is not used. This could be optimized in the future.
> > > Signed-off-by: Jason Wang <jasowang@...hat.com>
> > > Signed-off-by: Eugenio Pérez <eperezma@...hat.com>
> > > --
> > > Eugenio's changes: Remove blank
> > > TODO: Should we call directly dma_map instead of this? XDP do the direct
> > > call.
> >
> > Note that we should have an indirection layer as the device is not
> > necessarily DMA capable.
> >
>
> Can you expand on this? virtqueue_map_sgs calls directly to
> dma_map_page for each entry in the sg. This indirection layer should
> be in the device's callback for DMA, isn't it?

Nope, there are devices that can't do DMA.

Basically, the virtio core should

1) provide mapping helpers then we should use
2) transport specific method to do the mapping, e.g PCI knows it can
do DMA so it can use DMA API

only 1) is implemented now, in the future we need to implement 2) (we
still have dirty hacks for vdpa_sim etc now).

So it's better not to go back to calling dma_map_sg() directly.

>
> > And we probably need to rename the virtqueue_dma_map_XXX() to
> > virtqueue_map_XXX()
> >
>
> Ok so maybe these functions are already enough without using
> dma_map_sgs. I"m ok with renaming these, but that should be done in a
> separate series, isn't it?

Yes, this explains 1) above.

Thanks

>
> Thanks!
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ