Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, 18 Oct 2023 05:13:44 -0400, "Michael S. Tsirkin" wrote: > On Wed, Oct 18, 2023 at 04:57:21PM +0800, Xuan Zhuo wrote: > > On Wed, 18 Oct 2023 04:44:24 -0400, "Michael S. Tsirkin" > > wrote: > > > On Wed, Oct 18, 2023 at 04:00:22PM +0800, Xuan Zhuo wrote: > > > > On Wed, 18 Oct 2023 03:59:03 -0400, "Michael S. Tsirkin" > > > > wrote: > > > > > On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > > > > > > Hi Michael, > > > > > > > > > > > > Do you think it's appropriate to push the first two patches of this > > > > > > patch set to > > > > > > linux 6.6? > > > > > > > > > > > > Thanks. > > > > > > > > > > I generally treat patchsets as a whole unless someone asks me to do > > > > > otherwise. Why do you want this? > > > > > > > > As we discussed, the patch set supporting AF_XDP will be push to > > > > net-next. > > > > But the two patchs belong to the vhost. > > > > > > > > So, if you think that is appropriate, I will post a new > > > > patchset(include the two > > > > patchs without virtio-net + AF_XDP) to vhost. I wish that can be merged > > > > to 6.6. > > > > > > Oh wait 6.6? Too late really, merge window has been closed for weeks. > > > > I mean as a fix. So I ask you do you think it is appropriate? > > Sure if there's a bugfix please post is separately - what issues do > these two patches fix? this is the part I'm missing. Especially patch 2 > which just adds a new API. No bugfix. That is the requirement of the supporting AF_XDP. So please ignore my question. Sorry ^_^. Thanks. > > > > > > > > Then when the 6.7 net-next merge window is open, I can push this patch > > > > set to 6.7. > > > > The v1 version use the virtqueue_dma_map_single_attrs to replace > > > > virtqueue_dma_map_page_attrs. But I think we should use > > > > virtqueue_dma_map_page_attrs. > > > > > > > > Thanks. > > > > > > > > > > Get a complete working patchset that causes no regressions posted first > > > please > > > then we will discuss merge strategy. > > > I would maybe just put everything in one file for now, easier to merge, > > > refactor later when it's all upstream. But up to you. > > > > OK. I will get a working patchset firstly. > > > > Thanks. > > > > > > > > > > > > > > > > > > -- > > > > > MST > > > > > > > > > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, Oct 18, 2023 at 04:57:21PM +0800, Xuan Zhuo wrote: > On Wed, 18 Oct 2023 04:44:24 -0400, "Michael S. Tsirkin" > wrote: > > On Wed, Oct 18, 2023 at 04:00:22PM +0800, Xuan Zhuo wrote: > > > On Wed, 18 Oct 2023 03:59:03 -0400, "Michael S. Tsirkin" > > > wrote: > > > > On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > > > > > Hi Michael, > > > > > > > > > > Do you think it's appropriate to push the first two patches of this > > > > > patch set to > > > > > linux 6.6? > > > > > > > > > > Thanks. > > > > > > > > I generally treat patchsets as a whole unless someone asks me to do > > > > otherwise. Why do you want this? > > > > > > As we discussed, the patch set supporting AF_XDP will be push to net-next. > > > But the two patchs belong to the vhost. > > > > > > So, if you think that is appropriate, I will post a new patchset(include > > > the two > > > patchs without virtio-net + AF_XDP) to vhost. I wish that can be merged > > > to 6.6. > > > > Oh wait 6.6? Too late really, merge window has been closed for weeks. > > I mean as a fix. So I ask you do you think it is appropriate? Sure if there's a bugfix please post is separately - what issues do these two patches fix? this is the part I'm missing. Especially patch 2 which just adds a new API. > > > > > Then when the 6.7 net-next merge window is open, I can push this patch > > > set to 6.7. > > > The v1 version use the virtqueue_dma_map_single_attrs to replace > > > virtqueue_dma_map_page_attrs. But I think we should use > > > virtqueue_dma_map_page_attrs. > > > > > > Thanks. > > > > > > > Get a complete working patchset that causes no regressions posted first > > please > > then we will discuss merge strategy. > > I would maybe just put everything in one file for now, easier to merge, > > refactor later when it's all upstream. But up to you. > > OK. I will get a working patchset firstly. > > Thanks. > > > > > > > > > > > > > -- > > > > MST > > > > > > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, 18 Oct 2023 04:44:24 -0400, "Michael S. Tsirkin" wrote: > On Wed, Oct 18, 2023 at 04:00:22PM +0800, Xuan Zhuo wrote: > > On Wed, 18 Oct 2023 03:59:03 -0400, "Michael S. Tsirkin" > > wrote: > > > On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > > > > Hi Michael, > > > > > > > > Do you think it's appropriate to push the first two patches of this > > > > patch set to > > > > linux 6.6? > > > > > > > > Thanks. > > > > > > I generally treat patchsets as a whole unless someone asks me to do > > > otherwise. Why do you want this? > > > > As we discussed, the patch set supporting AF_XDP will be push to net-next. > > But the two patchs belong to the vhost. > > > > So, if you think that is appropriate, I will post a new patchset(include > > the two > > patchs without virtio-net + AF_XDP) to vhost. I wish that can be merged to > > 6.6. > > Oh wait 6.6? Too late really, merge window has been closed for weeks. I mean as a fix. So I ask you do you think it is appropriate? > > > Then when the 6.7 net-next merge window is open, I can push this patch set > > to 6.7. > > The v1 version use the virtqueue_dma_map_single_attrs to replace > > virtqueue_dma_map_page_attrs. But I think we should use > > virtqueue_dma_map_page_attrs. > > > > Thanks. > > > > Get a complete working patchset that causes no regressions posted first please > then we will discuss merge strategy. > I would maybe just put everything in one file for now, easier to merge, > refactor later when it's all upstream. But up to you. OK. I will get a working patchset firstly. Thanks. > > > > > > > > -- > > > MST > > > > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, Oct 18, 2023 at 04:00:22PM +0800, Xuan Zhuo wrote: > On Wed, 18 Oct 2023 03:59:03 -0400, "Michael S. Tsirkin" > wrote: > > On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > > > Hi Michael, > > > > > > Do you think it's appropriate to push the first two patches of this patch > > > set to > > > linux 6.6? > > > > > > Thanks. > > > > I generally treat patchsets as a whole unless someone asks me to do > > otherwise. Why do you want this? > > As we discussed, the patch set supporting AF_XDP will be push to net-next. > But the two patchs belong to the vhost. > > So, if you think that is appropriate, I will post a new patchset(include the > two > patchs without virtio-net + AF_XDP) to vhost. I wish that can be merged to > 6.6. Oh wait 6.6? Too late really, merge window has been closed for weeks. > Then when the 6.7 net-next merge window is open, I can push this patch set to > 6.7. > The v1 version use the virtqueue_dma_map_single_attrs to replace > virtqueue_dma_map_page_attrs. But I think we should use > virtqueue_dma_map_page_attrs. > > Thanks. > Get a complete working patchset that causes no regressions posted first please then we will discuss merge strategy. I would maybe just put everything in one file for now, easier to merge, refactor later when it's all upstream. But up to you. > > > > -- > > MST > > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, 18 Oct 2023 03:59:03 -0400, "Michael S. Tsirkin" wrote: > On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > > Hi Michael, > > > > Do you think it's appropriate to push the first two patches of this patch > > set to > > linux 6.6? > > > > Thanks. > > I generally treat patchsets as a whole unless someone asks me to do > otherwise. Why do you want this? As we discussed, the patch set supporting AF_XDP will be push to net-next. But the two patchs belong to the vhost. So, if you think that is appropriate, I will post a new patchset(include the two patchs without virtio-net + AF_XDP) to vhost. I wish that can be merged to 6.6. Then when the 6.7 net-next merge window is open, I can push this patch set to 6.7. The v1 version use the virtqueue_dma_map_single_attrs to replace virtqueue_dma_map_page_attrs. But I think we should use virtqueue_dma_map_page_attrs. Thanks. > > -- > MST > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > Hi Michael, > > Do you think it's appropriate to push the first two patches of this patch set > to > linux 6.6? > > Thanks. I see this is with the eye towards merging this gradually. However, I want the patchset to be ready first, right now it's not - with build failures and new warnings on some systems. -- MST ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
On Wed, Oct 18, 2023 at 03:53:00PM +0800, Xuan Zhuo wrote: > Hi Michael, > > Do you think it's appropriate to push the first two patches of this patch set > to > linux 6.6? > > Thanks. I generally treat patchsets as a whole unless someone asks me to do otherwise. Why do you want this? -- MST ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
Hi Michael, Do you think it's appropriate to push the first two patches of this patch set to linux 6.6? Thanks. On Wed, 11 Oct 2023 17:27:08 +0800, Xuan Zhuo wrote: > Introduce virtqueue_dma_[un]map_page_attrs() to do dma/unmap for pages. > > Signed-off-by: Xuan Zhuo > --- > drivers/virtio/virtio_ring.c | 52 > include/linux/virtio.h | 7 + > 2 files changed, 59 insertions(+) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index b3ded56722f4..36aae63336b8 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -3111,6 +3111,58 @@ const struct vring *virtqueue_get_vring(const struct > virtqueue *vq) > } > EXPORT_SYMBOL_GPL(virtqueue_get_vring); > > +/** > + * virtqueue_dma_map_page_attrs - map page DMA for _vq > + * @_vq: the struct virtqueue we're talking about. > + * @page: the page to do dma > + * @offset: the offset inside the page > + * @size: the size of the page to do dma > + * @dir: DMA direction > + * @attrs: DMA Attrs > + * > + * The caller calls this to do dma mapping in advance. The DMA address can be > + * passed to this _vq when it is in pre-mapped mode. > + * > + * return DMA address. Caller should check that by > virtqueue_dma_mapping_error(). > + */ > +dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page > *page, > + size_t offset, size_t size, > + enum dma_data_direction dir, > + unsigned long attrs) > +{ > + struct vring_virtqueue *vq = to_vvq(_vq); > + > + if (!vq->use_dma_api) > + return (dma_addr_t)(page_to_phys(page) + offset); > + > + return dma_map_page_attrs(vring_dma_dev(vq), page, offset, size, dir, > attrs); > +} > +EXPORT_SYMBOL_GPL(virtqueue_dma_map_page_attrs); > + > +/** > + * virtqueue_dma_unmap_page_attrs - unmap page DMA for _vq > + * @_vq: the struct virtqueue we're talking about. > + * @addr: the dma address to unmap > + * @size: the size of the buffer > + * @dir: DMA direction > + * @attrs: DMA Attrs > + * > + * Unmap the address that is mapped by the virtqueue_dma_map_* APIs. > + * > + */ > +void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, > + size_t size, enum dma_data_direction dir, > + unsigned long attrs) > +{ > + struct vring_virtqueue *vq = to_vvq(_vq); > + > + if (!vq->use_dma_api) > + return; > + > + dma_unmap_page_attrs(vring_dma_dev(vq), addr, size, dir, attrs); > +} > +EXPORT_SYMBOL_GPL(virtqueue_dma_unmap_page_attrs); > + > /** > * virtqueue_dma_map_single_attrs - map DMA for _vq > * @_vq: the struct virtqueue we're talking about. > diff --git a/include/linux/virtio.h b/include/linux/virtio.h > index 1cf7b004348b..d7c7f4fdee2f 100644 > --- a/include/linux/virtio.h > +++ b/include/linux/virtio.h > @@ -212,6 +212,13 @@ void unregister_virtio_driver(struct virtio_driver *drv); > module_driver(__virtio_driver, register_virtio_driver, \ > unregister_virtio_driver) > > +dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page > *page, > + size_t offset, size_t size, > + enum dma_data_direction dir, > + unsigned long attrs); > +void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, > + size_t size, enum dma_data_direction dir, > + unsigned long attrs); > dma_addr_t virtqueue_dma_map_single_attrs(struct virtqueue *_vq, void *ptr, > size_t size, > enum dma_data_direction dir, unsigned > long attrs); > void virtqueue_dma_unmap_single_attrs(struct virtqueue *_vq, dma_addr_t addr, > -- > 2.32.0.3.g01195cf9f > ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs
Introduce virtqueue_dma_[un]map_page_attrs() to do dma/unmap for pages. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 52 include/linux/virtio.h | 7 + 2 files changed, 59 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b3ded56722f4..36aae63336b8 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -3111,6 +3111,58 @@ const struct vring *virtqueue_get_vring(const struct virtqueue *vq) } EXPORT_SYMBOL_GPL(virtqueue_get_vring); +/** + * virtqueue_dma_map_page_attrs - map page DMA for _vq + * @_vq: the struct virtqueue we're talking about. + * @page: the page to do dma + * @offset: the offset inside the page + * @size: the size of the page to do dma + * @dir: DMA direction + * @attrs: DMA Attrs + * + * The caller calls this to do dma mapping in advance. The DMA address can be + * passed to this _vq when it is in pre-mapped mode. + * + * return DMA address. Caller should check that by virtqueue_dma_mapping_error(). + */ +dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page *page, + size_t offset, size_t size, + enum dma_data_direction dir, + unsigned long attrs) +{ + struct vring_virtqueue *vq = to_vvq(_vq); + + if (!vq->use_dma_api) + return (dma_addr_t)(page_to_phys(page) + offset); + + return dma_map_page_attrs(vring_dma_dev(vq), page, offset, size, dir, attrs); +} +EXPORT_SYMBOL_GPL(virtqueue_dma_map_page_attrs); + +/** + * virtqueue_dma_unmap_page_attrs - unmap page DMA for _vq + * @_vq: the struct virtqueue we're talking about. + * @addr: the dma address to unmap + * @size: the size of the buffer + * @dir: DMA direction + * @attrs: DMA Attrs + * + * Unmap the address that is mapped by the virtqueue_dma_map_* APIs. + * + */ +void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, + size_t size, enum dma_data_direction dir, + unsigned long attrs) +{ + struct vring_virtqueue *vq = to_vvq(_vq); + + if (!vq->use_dma_api) + return; + + dma_unmap_page_attrs(vring_dma_dev(vq), addr, size, dir, attrs); +} +EXPORT_SYMBOL_GPL(virtqueue_dma_unmap_page_attrs); + /** * virtqueue_dma_map_single_attrs - map DMA for _vq * @_vq: the struct virtqueue we're talking about. diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 1cf7b004348b..d7c7f4fdee2f 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -212,6 +212,13 @@ void unregister_virtio_driver(struct virtio_driver *drv); module_driver(__virtio_driver, register_virtio_driver, \ unregister_virtio_driver) +dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page *page, + size_t offset, size_t size, + enum dma_data_direction dir, + unsigned long attrs); +void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, + size_t size, enum dma_data_direction dir, + unsigned long attrs); dma_addr_t virtqueue_dma_map_single_attrs(struct virtqueue *_vq, void *ptr, size_t size, enum dma_data_direction dir, unsigned long attrs); void virtqueue_dma_unmap_single_attrs(struct virtqueue *_vq, dma_addr_t addr, -- 2.32.0.3.g01195cf9f ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization