mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors
@ 2026-10-06 10:21 sungbyeongchan
  2026-10-08  1:21 ` Xuan Zhuo
  2026-10-08  5:04 ` [PATCH v3] " sung byeongchan
  0 siblings, 2 replies; 5+ messages in thread
From: sungbyeongchan @ 2026-10-06 10:21 UTC (permalink / raw)
  To: Michael S . Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo
  Cc: virtualization, linux-kernel, sungbyeongchan

Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: LLM
Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
---
Changes in v2:
- Drop the commit message paragraphs as requested by Michael S. Tsirkin.
- Add Michael's Acked-by.

 drivers/virtio/virtio_ring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index db678f5a80e03..b4cb433df1dec 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -905,7 +905,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
 {
 	struct vring_desc_extra *extra;
 	unsigned int i;
-	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
 
 	/* Clear data ptr. */
 	vq->split.desc_state[head].data = NULL;
@@ -915,7 +914,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
 	/* Put back on free list: unmap first-level descriptors and find end */
 	i = head;
 
-	while (vq->split.vring.desc[i].flags & nextflag) {
+	while (extra[i].flags & VRING_DESC_F_NEXT) {
 		i = vring_unmap_one_split(vq, &extra[i]);
 		vq->vq.num_free++;
 	}
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors
  2026-10-06 10:21 [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors sungbyeongchan
@ 2026-10-08  1:21 ` Xuan Zhuo
  2026-10-08  6:19   ` Michael S. Tsirkin
  2026-10-08  5:04 ` [PATCH v3] " sung byeongchan
  1 sibling, 1 reply; 5+ messages in thread
From: Xuan Zhuo @ 2026-10-08  1:21 UTC (permalink / raw)
  To: sungbyeongchan
  Cc: virtualization, linux-kernel, sungbyeongchan,
	Michael S . Tsirkin, Jason Wang, Eugenio Pérez

On Tue,  6 Oct 2026 19:21:12 +0900, sungbyeongchan <tjdqudcks0424@naver.com> wrote:
> Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Assisted-by: LLM
> Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
> ---
> Changes in v2:
> - Drop the commit message paragraphs as requested by Michael S. Tsirkin.

You misunderstood him.

We can not accept a commit without commit message.


> - Add Michael's Acked-by.
>
>  drivers/virtio/virtio_ring.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index db678f5a80e03..b4cb433df1dec 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -905,7 +905,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
>  {
>  	struct vring_desc_extra *extra;
>  	unsigned int i;
> -	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>
>  	/* Clear data ptr. */
>  	vq->split.desc_state[head].data = NULL;
> @@ -915,7 +914,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
>  	/* Put back on free list: unmap first-level descriptors and find end */
>  	i = head;
>
> -	while (vq->split.vring.desc[i].flags & nextflag) {
> +	while (extra[i].flags & VRING_DESC_F_NEXT) {
>  		i = vring_unmap_one_split(vq, &extra[i]);
>  		vq->vq.num_free++;
>  	}
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3] virtio_ring: use shadow flags when detaching split descriptors
  2026-10-06 10:21 [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors sungbyeongchan
  2026-10-08  1:21 ` Xuan Zhuo
@ 2026-10-08  5:04 ` sung byeongchan
  2026-10-08  7:02   ` Michael S. Tsirkin
  1 sibling, 1 reply; 5+ messages in thread
From: sung byeongchan @ 2026-10-08  5:04 UTC (permalink / raw)
  To: Michael S . Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo
  Cc: virtualization, linux-kernel, sungbyeongchan

From: sungbyeongchan <tjdqudcks0424@naver.com>

Split virtqueues save descriptor flags and next indexes in desc_extra
before publishing descriptors to the device. The detach path uses the
shadow next index, but decides whether to continue by rereading the NEXT
flag from the shared descriptor.

Use the shadow flags for the continuation decision as well. This keeps
all detach metadata in the same driver-owned snapshot and avoids an
unnecessary shared-ring read.

Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: LLM
Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
---
Changes in v3:
- Restore a concise commit message explaining the mixed shared/shadow
  metadata problem. The v2 response had removed the whole description.
- Keep Michael's Acked-by.
- No code changes.

Changes in v2:
- Drop the two paragraphs Michael identified as unnecessary.
- Add Michael's Acked-by.

 drivers/virtio/virtio_ring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index db678f5a80e03..b4cb433df1dec 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -905,7 +905,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
 {
 	struct vring_desc_extra *extra;
 	unsigned int i;
-	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
 
 	/* Clear data ptr. */
 	vq->split.desc_state[head].data = NULL;
@@ -915,7 +914,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
 	/* Put back on free list: unmap first-level descriptors and find end */
 	i = head;
 
-	while (vq->split.vring.desc[i].flags & nextflag) {
+	while (extra[i].flags & VRING_DESC_F_NEXT) {
 		i = vring_unmap_one_split(vq, &extra[i]);
 		vq->vq.num_free++;
 	}
base-commit: 0c2669a9f4a1d607e7591ae50ccf3c432a0aff08
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors
  2026-10-08  1:21 ` Xuan Zhuo
@ 2026-10-08  6:19   ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2026-10-08  6:19 UTC (permalink / raw)
  To: Xuan Zhuo
  Cc: sungbyeongchan, virtualization, linux-kernel, Jason Wang,
	Eugenio Pérez

On Thu, Oct 08, 2026 at 09:21:38AM +0800, Xuan Zhuo wrote:
> On Tue,  6 Oct 2026 19:21:12 +0900, sungbyeongchan <tjdqudcks0424@naver.com> wrote:
> > Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > Assisted-by: LLM
> > Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
> > ---
> > Changes in v2:
> > - Drop the commit message paragraphs as requested by Michael S. Tsirkin.
> 
> You misunderstood him.
> 
> We can not accept a commit without commit message.


Indeed.
> 
> > - Add Michael's Acked-by.
> >
> >  drivers/virtio/virtio_ring.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index db678f5a80e03..b4cb433df1dec 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -905,7 +905,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
> >  {
> >  	struct vring_desc_extra *extra;
> >  	unsigned int i;
> > -	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
> >
> >  	/* Clear data ptr. */
> >  	vq->split.desc_state[head].data = NULL;
> > @@ -915,7 +914,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
> >  	/* Put back on free list: unmap first-level descriptors and find end */
> >  	i = head;
> >
> > -	while (vq->split.vring.desc[i].flags & nextflag) {
> > +	while (extra[i].flags & VRING_DESC_F_NEXT) {
> >  		i = vring_unmap_one_split(vq, &extra[i]);
> >  		vq->vq.num_free++;
> >  	}
> > --
> > 2.43.0
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] virtio_ring: use shadow flags when detaching split descriptors
  2026-10-08  5:04 ` [PATCH v3] " sung byeongchan
@ 2026-10-08  7:02   ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2026-10-08  7:02 UTC (permalink / raw)
  To: sung byeongchan
  Cc: Jason Wang, Eugenio Pérez, Xuan Zhuo, virtualization, linux-kernel

On Thu, Oct 08, 2026 at 02:04:23PM +0900, sung byeongchan wrote:
> From: sungbyeongchan <tjdqudcks0424@naver.com>
> 
> Split virtqueues save descriptor flags and next indexes in desc_extra
> before publishing descriptors to the device. The detach path uses the
> shadow next index, but decides whether to continue by rereading the NEXT
> flag from the shared descriptor.
> 
> Use the shadow flags for the continuation decision as well. This keeps
> all detach metadata in the same driver-owned snapshot and avoids an
> unnecessary shared-ring read.
> 
> Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Assisted-by: LLM
> Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
> ---

Thanks, will apply! Can you pls confirm sungbyeongchan without space is your
preferred form to be called, and not a mistake? 


> Changes in v3:
> - Restore a concise commit message explaining the mixed shared/shadow
>   metadata problem. The v2 response had removed the whole description.
> - Keep Michael's Acked-by.
> - No code changes.
> 
> Changes in v2:
> - Drop the two paragraphs Michael identified as unnecessary.
> - Add Michael's Acked-by.
> 
>  drivers/virtio/virtio_ring.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index db678f5a80e03..b4cb433df1dec 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -905,7 +905,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
>  {
>  	struct vring_desc_extra *extra;
>  	unsigned int i;
> -	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>  
>  	/* Clear data ptr. */
>  	vq->split.desc_state[head].data = NULL;
> @@ -915,7 +914,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
>  	/* Put back on free list: unmap first-level descriptors and find end */
>  	i = head;
>  
> -	while (vq->split.vring.desc[i].flags & nextflag) {
> +	while (extra[i].flags & VRING_DESC_F_NEXT) {
>  		i = vring_unmap_one_split(vq, &extra[i]);
>  		vq->vq.num_free++;
>  	}
> base-commit: 0c2669a9f4a1d607e7591ae50ccf3c432a0aff08
> -- 
> 2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-08  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 10:21 [PATCH v2] virtio_ring: use shadow flags when detaching split descriptors sungbyeongchan
2026-10-08  1:21 ` Xuan Zhuo
2026-10-08  6:19   ` Michael S. Tsirkin
2026-10-08  5:04 ` [PATCH v3] " sung byeongchan
2026-10-08  7:02   ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®