diff mbox series

[v5,5/5] virtio-crypto: enable retry for virtio-crypto-dev

Message ID 20220505092408.53692-6-pizhenwei@bytedance.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show
Series virtio-crypto: Improve performance | expand

Commit Message

zhenwei pi May 5, 2022, 9:24 a.m. UTC
From: lei he <helei.sig11@bytedance.com>

Enable retry for virtio-crypto-dev, so that crypto-engine
can process cipher-requests parallelly.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: lei he <helei.sig11@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 drivers/crypto/virtio/virtio_crypto_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Gonglei (Arei) May 6, 2022, 9:34 a.m. UTC | #1
> -----Original Message-----
> From: zhenwei pi [mailto:pizhenwei@bytedance.com]
> Sent: Thursday, May 5, 2022 5:24 PM
> To: Gonglei (Arei) <arei.gonglei@huawei.com>; mst@redhat.com
> Cc: jasowang@redhat.com; herbert@gondor.apana.org.au;
> linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org;
> linux-crypto@vger.kernel.org; helei.sig11@bytedance.com;
> pizhenwei@bytedance.com; davem@davemloft.net
> Subject: [PATCH v5 5/5] virtio-crypto: enable retry for virtio-crypto-dev
> 
> From: lei he <helei.sig11@bytedance.com>
> 
> Enable retry for virtio-crypto-dev, so that crypto-engine can process
> cipher-requests parallelly.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Gonglei <arei.gonglei@huawei.com>
> Signed-off-by: lei he <helei.sig11@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  drivers/crypto/virtio/virtio_crypto_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c
> b/drivers/crypto/virtio/virtio_crypto_core.c
> index 60490ffa3df1..f67e0d4c1b0c 100644
> --- a/drivers/crypto/virtio/virtio_crypto_core.c
> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> @@ -144,7 +144,8 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
>  		spin_lock_init(&vi->data_vq[i].lock);
>  		vi->data_vq[i].vq = vqs[i];
>  		/* Initialize crypto engine */
> -		vi->data_vq[i].engine = crypto_engine_alloc_init(dev, 1);
> +		vi->data_vq[i].engine = crypto_engine_alloc_init_and_set(dev, true,
> NULL, 1,
> +						virtqueue_get_vring_size(vqs[i]));

Here the '1' can be 'true' too.

Sure, you can add

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

Regards,
-Gonglei

>  		if (!vi->data_vq[i].engine) {
>  			ret = -ENOMEM;
>  			goto err_engine;
> --
> 2.20.1
zhenwei pi May 6, 2022, 9:55 a.m. UTC | #2
On 5/6/22 17:34, Gonglei (Arei) wrote:
> 
> 
>> -----Original Message-----
>> From: zhenwei pi [mailto:pizhenwei@bytedance.com]
>> Sent: Thursday, May 5, 2022 5:24 PM
>> To: Gonglei (Arei) <arei.gonglei@huawei.com>; mst@redhat.com
>> Cc: jasowang@redhat.com; herbert@gondor.apana.org.au;
>> linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org;
>> linux-crypto@vger.kernel.org; helei.sig11@bytedance.com;
>> pizhenwei@bytedance.com; davem@davemloft.net
>> Subject: [PATCH v5 5/5] virtio-crypto: enable retry for virtio-crypto-dev
>>
>> From: lei he <helei.sig11@bytedance.com>
>>
>> Enable retry for virtio-crypto-dev, so that crypto-engine can process
>> cipher-requests parallelly.
>>
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Cc: Gonglei <arei.gonglei@huawei.com>
>> Signed-off-by: lei he <helei.sig11@bytedance.com>
>> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
>> ---
>>   drivers/crypto/virtio/virtio_crypto_core.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c
>> b/drivers/crypto/virtio/virtio_crypto_core.c
>> index 60490ffa3df1..f67e0d4c1b0c 100644
>> --- a/drivers/crypto/virtio/virtio_crypto_core.c
>> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
>> @@ -144,7 +144,8 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
>>   		spin_lock_init(&vi->data_vq[i].lock);
>>   		vi->data_vq[i].vq = vqs[i];
>>   		/* Initialize crypto engine */
>> -		vi->data_vq[i].engine = crypto_engine_alloc_init(dev, 1);
>> +		vi->data_vq[i].engine = crypto_engine_alloc_init_and_set(dev, true,
>> NULL, 1,
>> +						virtqueue_get_vring_size(vqs[i]));
> 
> Here the '1' can be 'true' too.
> 
> Sure, you can add
> 
> Reviewed-by: Gonglei <arei.gonglei@huawei.com>
> 
> Regards,
> -Gonglei
> 
>>   		if (!vi->data_vq[i].engine) {
>>   			ret = -ENOMEM;
>>   			goto err_engine;
>> --
>> 2.20.1
> 

Thanks to Lei!

Hi, Michael
I would appreciate it if you could apply this minor change, or I send 
the v6 series, which one do you prefer?
Michael S. Tsirkin May 6, 2022, 11:33 a.m. UTC | #3
On Fri, May 06, 2022 at 05:55:33PM +0800, zhenwei pi wrote:
> On 5/6/22 17:34, Gonglei (Arei) wrote:
> > 
> > 
> > > -----Original Message-----
> > > From: zhenwei pi [mailto:pizhenwei@bytedance.com]
> > > Sent: Thursday, May 5, 2022 5:24 PM
> > > To: Gonglei (Arei) <arei.gonglei@huawei.com>; mst@redhat.com
> > > Cc: jasowang@redhat.com; herbert@gondor.apana.org.au;
> > > linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org;
> > > linux-crypto@vger.kernel.org; helei.sig11@bytedance.com;
> > > pizhenwei@bytedance.com; davem@davemloft.net
> > > Subject: [PATCH v5 5/5] virtio-crypto: enable retry for virtio-crypto-dev
> > > 
> > > From: lei he <helei.sig11@bytedance.com>
> > > 
> > > Enable retry for virtio-crypto-dev, so that crypto-engine can process
> > > cipher-requests parallelly.
> > > 
> > > Cc: Michael S. Tsirkin <mst@redhat.com>
> > > Cc: Jason Wang <jasowang@redhat.com>
> > > Cc: Gonglei <arei.gonglei@huawei.com>
> > > Signed-off-by: lei he <helei.sig11@bytedance.com>
> > > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> > > ---
> > >   drivers/crypto/virtio/virtio_crypto_core.c | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c
> > > b/drivers/crypto/virtio/virtio_crypto_core.c
> > > index 60490ffa3df1..f67e0d4c1b0c 100644
> > > --- a/drivers/crypto/virtio/virtio_crypto_core.c
> > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> > > @@ -144,7 +144,8 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
> > >   		spin_lock_init(&vi->data_vq[i].lock);
> > >   		vi->data_vq[i].vq = vqs[i];
> > >   		/* Initialize crypto engine */
> > > -		vi->data_vq[i].engine = crypto_engine_alloc_init(dev, 1);
> > > +		vi->data_vq[i].engine = crypto_engine_alloc_init_and_set(dev, true,
> > > NULL, 1,
> > > +						virtqueue_get_vring_size(vqs[i]));
> > 
> > Here the '1' can be 'true' too.
> > 
> > Sure, you can add
> > 
> > Reviewed-by: Gonglei <arei.gonglei@huawei.com>
> > 
> > Regards,
> > -Gonglei
> > 
> > >   		if (!vi->data_vq[i].engine) {
> > >   			ret = -ENOMEM;
> > >   			goto err_engine;
> > > --
> > > 2.20.1
> > 
> 
> Thanks to Lei!
> 
> Hi, Michael
> I would appreciate it if you could apply this minor change, or I send the v6
> series, which one do you prefer?
> 
> -- 


send v6 with acks and change pls
diff mbox series

Patch

diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
index 60490ffa3df1..f67e0d4c1b0c 100644
--- a/drivers/crypto/virtio/virtio_crypto_core.c
+++ b/drivers/crypto/virtio/virtio_crypto_core.c
@@ -144,7 +144,8 @@  static int virtcrypto_find_vqs(struct virtio_crypto *vi)
 		spin_lock_init(&vi->data_vq[i].lock);
 		vi->data_vq[i].vq = vqs[i];
 		/* Initialize crypto engine */
-		vi->data_vq[i].engine = crypto_engine_alloc_init(dev, 1);
+		vi->data_vq[i].engine = crypto_engine_alloc_init_and_set(dev, true, NULL, 1,
+						virtqueue_get_vring_size(vqs[i]));
 		if (!vi->data_vq[i].engine) {
 			ret = -ENOMEM;
 			goto err_engine;