On Thu, 17 Feb 2022 15:19:44 +0800, Jason Wang <jasowang at redhat.com> wrote:> On Thu, Feb 10, 2022 at 4:51 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > > > virtqueue_add() only supports virtual addresses, dma is completed in > > virtqueue_add(). > > > > In some scenarios (such as the AF_XDP scenario), DMA is completed in advance, so > > it is necessary for us to support passing the DMA address to virtqueue_add(). > > I'd suggest rename this feature as "unmanaged DMA".OK> > > > > Record this predma information in extra->flags, which can be skipped when > > executing dma unmap. > > Question still, can we use per-virtqueue flag instead of per > descriptor flag? If my memory is correct, the answer is yes in the > discussion for the previous version. >Yes. per-virtqueue? I guess it should be per-submit. This patch set only adds a flag to desc_extra[head].flags, so that we can know if we need to unmap dma when we detach. Thanks.> Thanks > > > > > v1: > > 1. All sgs requested at one time are required to be unified PREDMA, and several > > of them are not supported to be PREDMA > > 2. virtio_dma_map() is removed from this patch set and will be submitted > > together with the next time AF_XDP supports virtio dma > > 3. Added patch #2 #3 to remove the check for flags when performing unmap > > indirect desc > > > > Xuan Zhuo (6): > > virtio: rename vring_unmap_state_packed() to > > vring_unmap_extra_packed() > > virtio: remove flags check for unmap split indirect desc > > virtio: remove flags check for unmap packed indirect desc > > virtio: virtqueue_add() support predma > > virtio: split: virtqueue_add_split() support dma address > > virtio: packed: virtqueue_add_packed() support dma address > > > > drivers/virtio/virtio_ring.c | 199 ++++++++++++++++++++++------------- > > 1 file changed, 126 insertions(+), 73 deletions(-) > > > > -- > > 2.31.0 > > >
On Fri, Feb 18, 2022 at 04:55:23PM +0800, Xuan Zhuo wrote:> On Thu, 17 Feb 2022 15:19:44 +0800, Jason Wang <jasowang at redhat.com> wrote: > > On Thu, Feb 10, 2022 at 4:51 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > > > > > virtqueue_add() only supports virtual addresses, dma is completed in > > > virtqueue_add(). > > > > > > In some scenarios (such as the AF_XDP scenario), DMA is completed in advance, so > > > it is necessary for us to support passing the DMA address to virtqueue_add(). > > > > I'd suggest rename this feature as "unmanaged DMA". > > OKIIUC when you say "dma is completed" you really mean "memory is mapped for dma". What is special is that virtio suddenly gets s/g that is already mapped for DMA, not in the way DMA (direct memory access) itself happens. right? Pls document as such. And this is why I'd call this flag "mapped" or "premapped", not "predma". "unmanaged" is also ok, though it's a bit vague wrt what exactly is managed. I'll defer to Jason on this. Jason what do you prefer?> > > > > > > > Record this predma information in extra->flags, which can be skipped when > > > executing dma unmap. > > > > Question still, can we use per-virtqueue flag instead of per > > descriptor flag? If my memory is correct, the answer is yes in the > > discussion for the previous version. > > > > Yes. > > per-virtqueue? I guess it should be per-submit. > > This patch set only adds a flag to desc_extra[head].flags, so that we can know > if we need to unmap dma when we detach. > > Thanks. > > > Thanks > > > > > > > > v1: > > > 1. All sgs requested at one time are required to be unified PREDMA, and several > > > of them are not supported to be PREDMA > > > 2. virtio_dma_map() is removed from this patch set and will be submitted > > > together with the next time AF_XDP supports virtio dma > > > 3. Added patch #2 #3 to remove the check for flags when performing unmap > > > indirect desc > > > > > > Xuan Zhuo (6): > > > virtio: rename vring_unmap_state_packed() to > > > vring_unmap_extra_packed() > > > virtio: remove flags check for unmap split indirect desc > > > virtio: remove flags check for unmap packed indirect desc > > > virtio: virtqueue_add() support predma > > > virtio: split: virtqueue_add_split() support dma address > > > virtio: packed: virtqueue_add_packed() support dma address > > > > > > drivers/virtio/virtio_ring.c | 199 ++++++++++++++++++++++------------- > > > 1 file changed, 126 insertions(+), 73 deletions(-) > > > > > > -- > > > 2.31.0 > > > > >
On Fri, Feb 18, 2022 at 5:00 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote:> > On Thu, 17 Feb 2022 15:19:44 +0800, Jason Wang <jasowang at redhat.com> wrote: > > On Thu, Feb 10, 2022 at 4:51 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > > > > > virtqueue_add() only supports virtual addresses, dma is completed in > > > virtqueue_add(). > > > > > > In some scenarios (such as the AF_XDP scenario), DMA is completed in advance, so > > > it is necessary for us to support passing the DMA address to virtqueue_add(). > > > > I'd suggest rename this feature as "unmanaged DMA". > > OK > > > > > > > > > Record this predma information in extra->flags, which can be skipped when > > > executing dma unmap. > > > > Question still, can we use per-virtqueue flag instead of per > > descriptor flag? If my memory is correct, the answer is yes in the > > discussion for the previous version. > > > > Yes. > > per-virtqueue? I guess it should be per-submit. > > This patch set only adds a flag to desc_extra[head].flags, so that we can know > if we need to unmap dma when we detach.I meant if we can manage to make it per virtqueue, there's no need to maintain per buffer flag. So we know something that needs to be mapped by virtio core itself, e.g the indirect page. Other than this, all the rest could be pre-mapped. For vnet header, it could be mapped by virtio-net which could be still treated as pre mapped DMA since it's not the virtio ring code. Anything I miss here? Thanks> > Thanks. > > > Thanks > > > > > > > > v1: > > > 1. All sgs requested at one time are required to be unified PREDMA, and several > > > of them are not supported to be PREDMA > > > 2. virtio_dma_map() is removed from this patch set and will be submitted > > > together with the next time AF_XDP supports virtio dma > > > 3. Added patch #2 #3 to remove the check for flags when performing unmap > > > indirect desc > > > > > > Xuan Zhuo (6): > > > virtio: rename vring_unmap_state_packed() to > > > vring_unmap_extra_packed() > > > virtio: remove flags check for unmap split indirect desc > > > virtio: remove flags check for unmap packed indirect desc > > > virtio: virtqueue_add() support predma > > > virtio: split: virtqueue_add_split() support dma address > > > virtio: packed: virtqueue_add_packed() support dma address > > > > > > drivers/virtio/virtio_ring.c | 199 ++++++++++++++++++++++------------- > > > 1 file changed, 126 insertions(+), 73 deletions(-) > > > > > > -- > > > 2.31.0 > > > > > >