All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guo Zhi <qtxuning1999@sjtu.edu.cn>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	kvm list <kvm@vger.kernel.org>,
	virtualization <virtualization@lists.linux-foundation.org>,
	eperezma <eperezma@redhat.com>, jasowang <jasowang@redhat.com>,
	sgarzare <sgarzare@redhat.com>, Michael Tsirkin <mst@redhat.com>
Subject: Re: [RFC v3 5/7] virtio: unmask F_NEXT flag in desc_extra
Date: Thu, 1 Sep 2022 14:14:09 +0800 (CST)	[thread overview]
Message-ID: <1987009989.9672563.1662012849811.JavaMail.zimbra@sjtu.edu.cn> (raw)
In-Reply-To: <1662012423.9200838-1-xuanzhuo@linux.alibaba.com>



----- Original Message -----
> From: "Xuan Zhuo" <xuanzhuo@linux.alibaba.com>
> To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>
> Cc: "netdev" <netdev@vger.kernel.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "kvm list" <kvm@vger.kernel.org>,
> "virtualization" <virtualization@lists.linux-foundation.org>, "Guo Zhi" <qtxuning1999@sjtu.edu.cn>, "eperezma"
> <eperezma@redhat.com>, "jasowang" <jasowang@redhat.com>, "sgarzare" <sgarzare@redhat.com>, "Michael Tsirkin"
> <mst@redhat.com>
> Sent: Thursday, September 1, 2022 2:07:03 PM
> Subject: Re: [RFC v3 5/7] virtio: unmask F_NEXT flag in desc_extra

> On Thu,  1 Sep 2022 13:54:32 +0800, Guo Zhi <qtxuning1999@sjtu.edu.cn> wrote:
>> We didn't unmask F_NEXT flag in desc_extra in the end of a chain,
>> unmask it so that we can access desc_extra to get next information.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>  drivers/virtio/virtio_ring.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
>> index a5ec724c01d8..00aa4b7a49c2 100644
>> --- a/drivers/virtio/virtio_ring.c
>> +++ b/drivers/virtio/virtio_ring.c
>> @@ -567,7 +567,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
>>  	}
>>  	/* Last one doesn't continue. */
>>  	desc[prev].flags &= cpu_to_virtio16(_vq->vdev, ~VRING_DESC_F_NEXT);
>> -	if (!indirect && vq->use_dma_api)
>> +	if (!indirect)
>>  		vq->split.desc_extra[prev & (vq->split.vring.num - 1)].flags &=
>>  			~VRING_DESC_F_NEXT;
>>
>> @@ -584,6 +584,8 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
>>  					 total_sg * sizeof(struct vring_desc),
>>  					 VRING_DESC_F_INDIRECT,
>>  					 false);
>> +		vq->split.desc_extra[head & (vq->split.vring.num - 1)].flags &=
>> +			~VRING_DESC_F_NEXT;
> 
> Wondering if this is necessary? When setting flags, NEXT is not included.

I adopted your advice in this patch series and remove this unnecessary code, but I
leave that modification i patch 6/7. Sorry for my git rebase mistake.

Thanks

> 
>>  	}
>>
>>  	/* We're using some buffers from the free list. */
>> @@ -685,7 +687,6 @@ static void detach_buf_split(struct vring_virtqueue *vq,
>> unsigned int head,
>>  			     void **ctx)
>>  {
>>  	unsigned int i, j;
>> -	__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>>
>>  	/* Clear data ptr. */
>>  	vq->split.desc_state[head].data = NULL;
>> @@ -693,7 +694,7 @@ static void detach_buf_split(struct vring_virtqueue *vq,
>> unsigned int head,
>>  	/* Put back on free list: unmap first-level descriptors and find end */
>>  	i = head;
>>
>> -	while (vq->split.vring.desc[i].flags & nextflag) {
>> +	while (vq->split.desc_extra[i].flags & VRING_DESC_F_NEXT) {
>>  		vring_unmap_one_split(vq, i);
>>  		i = vq->split.desc_extra[i].next;
>>  		vq->vq.num_free++;
>> --
>> 2.17.1
>>

  reply	other threads:[~2022-09-01  6:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  5:54 [RFC v3 0/7] In order support for virtio_ring, vhost and vsock Guo Zhi
2022-09-01  5:54 ` [RFC v3 1/7] vhost: expose used buffers Guo Zhi
2022-09-01  8:55   ` Eugenio Perez Martin
2022-09-07  4:21   ` Jason Wang
2022-09-07  4:21     ` Jason Wang
2022-09-08  8:43     ` Guo Zhi
2022-09-01  5:54 ` [RFC v3 2/7] vhost_test: batch used buffer Guo Zhi
2022-09-01  5:54 ` [RFC v3 3/7] vsock: batch buffers in tx Guo Zhi
2022-09-01  9:00   ` Eugenio Perez Martin
2022-09-07  4:27   ` Jason Wang
2022-09-07  4:27     ` Jason Wang
2022-09-08  8:41     ` Guo Zhi
2022-09-01  5:54 ` [RFC v3 4/7] vsock: announce VIRTIO_F_IN_ORDER in vsock Guo Zhi
2022-09-01  5:54 ` [RFC v3 5/7] virtio: unmask F_NEXT flag in desc_extra Guo Zhi
2022-09-01  6:07   ` Xuan Zhuo
2022-09-01  6:07     ` Xuan Zhuo
2022-09-01  6:14     ` Guo Zhi [this message]
2022-09-01  5:54 ` [RFC v3 6/7] virtio: in order support for virtio_ring Guo Zhi
2022-09-01  6:10   ` Xuan Zhuo
2022-09-01  6:10     ` Xuan Zhuo
2022-09-07  5:38   ` Jason Wang
2022-09-07  5:38     ` Jason Wang
2022-09-08  8:47     ` Guo Zhi
2022-09-08  9:36     ` Guo Zhi
2022-10-03 11:32     ` Guo Zhi
2022-09-01  5:54 ` [RFC v3 7/7] virtio: announce VIRTIO_F_IN_ORDER support Guo Zhi
2022-09-07  4:13 ` [RFC v3 0/7] In order support for virtio_ring, vhost and vsock Jason Wang
2022-09-07  4:13   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1987009989.9672563.1662012849811.JavaMail.zimbra@sjtu.edu.cn \
    --to=qtxuning1999@sjtu.edu.cn \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.