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]
Date:   Mon, 16 Nov 2020 12:21:33 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>,
        virtualization@...ts.linux-foundation.org
Cc:     Stefan Hajnoczi <stefanha@...hat.com>,
        Laurent Vivier <lvivier@...hat.com>,
        linux-kernel@...r.kernel.org, Eli Cohen <elic@...dia.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Max Gurtovoy <mgurtovoy@...dia.com>
Subject: Re: [PATCH RFC 10/12] vdpa_sim: split vdpasim_virtqueue's iov field
 in riov and wiov


On 2020/11/13 下午9:47, Stefano Garzarella wrote:
> vringh_getdesc_iotlb() manages 2 iovs for writable and readable
> descriptors. This is very useful for the block device, where for
> each request we have both types of descriptor.
>
> Let's split the vdpasim_virtqueue's iov field in riov and wiov
> to use them with vringh_getdesc_iotlb().
>
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>


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


> ---
>   drivers/vdpa/vdpa_sim/vdpa_sim.h     | 3 ++-
>   drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 6 +++---
>   drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 8 ++++----
>   3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
> index cc21e07aa2f7..0d4629675e4b 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
> @@ -27,7 +27,8 @@ struct vdpasim;
>   
>   struct vdpasim_virtqueue {
>   	struct vringh vring;
> -	struct vringh_kiov iov;
> +	struct vringh_kiov riov;
> +	struct vringh_kiov wiov;
>   	unsigned short head;
>   	bool ready;
>   	u64 desc_addr;
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> index 122a3c039507..8e41b3ab98d5 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> @@ -41,13 +41,13 @@ static void vdpasim_blk_work(struct work_struct *work)
>   		if (!vq->ready)
>   			continue;
>   
> -		while (vringh_getdesc_iotlb(&vq->vring, &vq->iov, &vq->iov,
> +		while (vringh_getdesc_iotlb(&vq->vring, &vq->riov, &vq->wiov,
>   					    &vq->head, GFP_ATOMIC) > 0) {
>   
>   			int write;
>   
> -			vq->iov.i = vq->iov.used - 1;
> -			write = vringh_iov_push_iotlb(&vq->vring, &vq->iov, &status, 1);
> +			vq->wiov.i = vq->wiov.used - 1;
> +			write = vringh_iov_push_iotlb(&vq->vring, &vq->wiov, &status, 1);
>   			if (write <= 0)
>   				break;
>   
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> index d0a1403f64b2..783b1e85b09c 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> @@ -47,12 +47,12 @@ static void vdpasim_net_work(struct work_struct *work)
>   
>   	while (true) {
>   		total_write = 0;
> -		err = vringh_getdesc_iotlb(&txq->vring, &txq->iov, NULL,
> +		err = vringh_getdesc_iotlb(&txq->vring, &txq->riov, NULL,
>   					   &txq->head, GFP_ATOMIC);
>   		if (err <= 0)
>   			break;
>   
> -		err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->iov,
> +		err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->wiov,
>   					   &rxq->head, GFP_ATOMIC);
>   		if (err <= 0) {
>   			vringh_complete_iotlb(&txq->vring, txq->head, 0);
> @@ -60,13 +60,13 @@ static void vdpasim_net_work(struct work_struct *work)
>   		}
>   
>   		while (true) {
> -			read = vringh_iov_pull_iotlb(&txq->vring, &txq->iov,
> +			read = vringh_iov_pull_iotlb(&txq->vring, &txq->riov,
>   						     vdpasim->buffer,
>   						     PAGE_SIZE);
>   			if (read <= 0)
>   				break;
>   
> -			write = vringh_iov_push_iotlb(&rxq->vring, &rxq->iov,
> +			write = vringh_iov_push_iotlb(&rxq->vring, &rxq->wiov,
>   						      vdpasim->buffer, read);
>   			if (write <= 0)
>   				break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ