lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0aa1a062-968b-370a-3a50-e0364914a7c4@redhat.com>
Date:   Wed, 27 Jul 2022 11:05:16 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
        virtualization@...ts.linux-foundation.org
Cc:     Richard Weinberger <richard@....at>,
        Anton Ivanov <anton.ivanov@...bridgegreys.com>,
        Johannes Berg <johannes@...solutions.net>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        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>,
        Eric Farman <farman@...ux.ibm.com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...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>,
        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,
        kangjie.xu@...ux.alibaba.com
Subject: Re: [PATCH v13 08/42] virtio_ring: split: __vring_new_virtqueue()
 accept struct vring_virtqueue_split


在 2022/7/26 15:21, Xuan Zhuo 写道:
> __vring_new_virtqueue() instead accepts struct vring_virtqueue_split.
>
> The purpose of this is to pass more information into
> __vring_new_virtqueue() to make the code simpler and the structure
> cleaner.
>
> Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>


Acked-by: Jason Wang <jasowang@...hat.com>


> ---
>   drivers/virtio/virtio_ring.c | 29 +++++++++++++++--------------
>   1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 4e54ed7ee7fb..4d65c437d968 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -205,7 +205,7 @@ struct vring_virtqueue {
>   };
>   
>   static struct virtqueue *__vring_new_virtqueue(unsigned int index,
> -					       struct vring vring,
> +					       struct vring_virtqueue_split *vring_split,
>   					       struct virtio_device *vdev,
>   					       bool weak_barriers,
>   					       bool context,
> @@ -959,6 +959,7 @@ static struct virtqueue *vring_create_virtqueue_split(
>   	void (*callback)(struct virtqueue *),
>   	const char *name)
>   {
> +	struct vring_virtqueue_split vring_split = {};
>   	struct virtqueue *vq;
>   	void *queue = NULL;
>   	dma_addr_t dma_addr;
> @@ -994,10 +995,10 @@ static struct virtqueue *vring_create_virtqueue_split(
>   		return NULL;
>   
>   	queue_size_in_bytes = vring_size(num, vring_align);
> -	vring_init(&vring, num, queue, vring_align);
> +	vring_init(&vring_split.vring, num, queue, vring_align);
>   
> -	vq = __vring_new_virtqueue(index, vring, vdev, weak_barriers, context,
> -				   notify, callback, name);
> +	vq = __vring_new_virtqueue(index, &vring_split, vdev, weak_barriers,
> +				   context, notify, callback, name);
>   	if (!vq) {
>   		vring_free_queue(vdev, queue_size_in_bytes, queue,
>   				 dma_addr);
> @@ -2206,7 +2207,7 @@ EXPORT_SYMBOL_GPL(vring_interrupt);
>   
>   /* Only available for split ring */
>   static struct virtqueue *__vring_new_virtqueue(unsigned int index,
> -					       struct vring vring,
> +					       struct vring_virtqueue_split *vring_split,
>   					       struct virtio_device *vdev,
>   					       bool weak_barriers,
>   					       bool context,
> @@ -2243,7 +2244,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index,
>   	vq->split.queue_dma_addr = 0;
>   	vq->split.queue_size_in_bytes = 0;
>   
> -	vq->split.vring = vring;
> +	vq->split.vring = vring_split->vring;
>   	vq->split.avail_flags_shadow = 0;
>   	vq->split.avail_idx_shadow = 0;
>   
> @@ -2255,19 +2256,19 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index,
>   					vq->split.avail_flags_shadow);
>   	}
>   
> -	vq->split.desc_state = kmalloc_array(vring.num,
> +	vq->split.desc_state = kmalloc_array(vring_split->vring.num,
>   			sizeof(struct vring_desc_state_split), GFP_KERNEL);
>   	if (!vq->split.desc_state)
>   		goto err_state;
>   
> -	vq->split.desc_extra = vring_alloc_desc_extra(vring.num);
> +	vq->split.desc_extra = vring_alloc_desc_extra(vring_split->vring.num);
>   	if (!vq->split.desc_extra)
>   		goto err_extra;
>   
> -	memset(vq->split.desc_state, 0, vring.num *
> +	memset(vq->split.desc_state, 0, vring_split->vring.num *
>   			sizeof(struct vring_desc_state_split));
>   
> -	virtqueue_init(vq, vq->split.vring.num);
> +	virtqueue_init(vq, vring_split->vring.num);
>   
>   	spin_lock(&vdev->vqs_list_lock);
>   	list_add_tail(&vq->vq.list, &vdev->vqs);
> @@ -2317,14 +2318,14 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
>   				      void (*callback)(struct virtqueue *vq),
>   				      const char *name)
>   {
> -	struct vring vring;
> +	struct vring_virtqueue_split vring_split = {};
>   
>   	if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED))
>   		return NULL;
>   
> -	vring_init(&vring, num, pages, vring_align);
> -	return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context,
> -				     notify, callback, name);
> +	vring_init(&vring_split.vring, num, pages, vring_align);
> +	return __vring_new_virtqueue(index, &vring_split, vdev, weak_barriers,
> +				     context, notify, callback, name);
>   }
>   EXPORT_SYMBOL_GPL(vring_new_virtqueue);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ