[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1649832244.772237-6-xuanzhuo@linux.alibaba.com>
Date: Wed, 13 Apr 2022 14:44:04 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Jeff Dike <jdike@...toit.com>, Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Vadim Pasternak <vadimp@...dia.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Cornelia Huck <cohuck@...hat.com>,
Halil Pasic <pasic@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Johannes Berg <johannes.berg@...el.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
linux-um@...ts.infradead.org, netdev@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-remoteproc@...r.kernel.org, linux-s390@...r.kernel.org,
kvm@...r.kernel.org, bpf@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v9 08/32] virtio_ring: split: extract the logic of attach vring
On Tue, 12 Apr 2022 11:31:08 +0800, Jason Wang <jasowang@...hat.com> wrote:
>
> 在 2022/4/6 上午11:43, Xuan Zhuo 写道:
> > Separate the logic of attach vring, subsequent patches will call it
> > separately.
> >
> > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > ---
> > drivers/virtio/virtio_ring.c | 20 ++++++++++++++------
> > 1 file changed, 14 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index 6de67439cb57..083f2992ba0d 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -916,6 +916,19 @@ static void *virtqueue_detach_unused_buf_split(struct virtqueue *_vq)
> > return NULL;
> > }
> >
> > +static void vring_virtqueue_attach_split(struct vring_virtqueue *vq,
> > + struct vring vring,
> > + struct vring_desc_state_split *desc_state,
> > + struct vring_desc_extra *desc_extra)
> > +{
> > + vq->split.vring = vring;
> > + vq->split.queue_dma_addr = 0;
> > + vq->split.queue_size_in_bytes = 0;
>
>
> Any reason to add the above two assignment in attach? It seems belong to
> free or reset.
As discussed in patch 11, since there is no dma_addr in __vring_new_virtqueue(),
the corresponding vq->split.queue_dma_addr cannot be set, so the purpose here
is just to initialize it.
In the next version, struct vring_virtqueue_split will be passed to
vring_virtqueue_attach_split() to make the logic here look more reasonable.
Thanks.
>
> Thanks
>
>
> > +
> > + vq->split.desc_state = desc_state;
> > + vq->split.desc_extra = desc_extra;
> > +}
> > +
> > static int vring_alloc_state_extra_split(u32 num,
> > struct vring_desc_state_split **desc_state,
> > struct vring_desc_extra **desc_extra)
> > @@ -2262,10 +2275,6 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,
> > if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
> > vq->weak_barriers = false;
> >
> > - vq->split.queue_dma_addr = 0;
> > - vq->split.queue_size_in_bytes = 0;
> > -
> > - vq->split.vring = vring;
> > vq->split.avail_flags_shadow = 0;
> > vq->split.avail_idx_shadow = 0;
> >
> > @@ -2283,8 +2292,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,
> > return NULL;
> > }
> >
> > - vq->split.desc_state = state;
> > - vq->split.desc_extra = extra;
> > + vring_virtqueue_attach_split(vq, vring, state, extra);
> >
> > /* Put everything in free lists. */
> > vq->free_head = 0;
>
Powered by blists - more mailing lists