Zeng, Xin
2016-Dec-15 00:59 UTC
[Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
On Thursday, December 15, 2016 8:45 AM, Gonglei (Arei) Wrote: < > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c < > b/drivers/crypto/virtio/virtio_crypto_core.c < > > new file mode 100644 < > > index 0000000..c0854a1 < > > --- /dev/null < > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c < > > @@ -0,0 +1,474 @@ < > [..] < > > + < > > +static void virtcrypto_dataq_callback(struct virtqueue *vq) < > > +{ < > > + struct virtio_crypto *vcrypto = vq->vdev->priv; < > > + struct virtio_crypto_request *vc_req; < > > + unsigned long flags; < > > + unsigned int len; < > > + struct ablkcipher_request *ablk_req; < > > + int error; < > > + < > > + spin_lock_irqsave(&vcrypto->lock, flags); < > < > Would it make sense to use a per virtqueue lock < > like in virtio_blk for example instead of locking on the whole < > device? OK, it seems you use only one dataqueue, so it < > may not be that relevant. < > < Currently yes, both the backend device (cryptodev-backend-builtin) < and the frontend driver use one dataqueue. < I think it makes sense to use per virtqueue lock here though it only uses one queue so far, but in the spec we already have multi queues support. < Regards, < -Gonglei
Gonglei (Arei)
2016-Dec-15 01:08 UTC
[Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
Regards, -Gonglei> -----Original Message----- > From: Zeng, Xin [mailto:xin.zeng at intel.com] > Sent: Thursday, December 15, 2016 8:59 AM > To: Gonglei (Arei); Halil Pasic; linux-kernel at vger.kernel.org; > qemu-devel at nongnu.org; virtio-dev at lists.oasis-open.org; > virtualization at lists.linux-foundation.org; linux-crypto at vger.kernel.org > Cc: Huangweidong (C); Claudio Fontana; mst at redhat.com; Luonengjun; > Hanweidong (Randy); Xuquan (Quan Xu); Wanzongshun (Vincent); > stefanha at redhat.com; Zhoujian (jay, Euler); cornelia.huck at de.ibm.com; > longpeng; arei.gonglei at hotmail.com; davem at davemloft.net; Wubin (H); > herbert at gondor.apana.org.au > Subject: RE: [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver > > On Thursday, December 15, 2016 8:45 AM, Gonglei (Arei) Wrote: > < > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c > < > b/drivers/crypto/virtio/virtio_crypto_core.c > < > > new file mode 100644 > < > > index 0000000..c0854a1 > < > > --- /dev/null > < > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c > < > > @@ -0,0 +1,474 @@ > < > [..] > < > > + > < > > +static void virtcrypto_dataq_callback(struct virtqueue *vq) > < > > +{ > < > > + struct virtio_crypto *vcrypto = vq->vdev->priv; > < > > + struct virtio_crypto_request *vc_req; > < > > + unsigned long flags; > < > > + unsigned int len; > < > > + struct ablkcipher_request *ablk_req; > < > > + int error; > < > > + > < > > + spin_lock_irqsave(&vcrypto->lock, flags); > < > > < > Would it make sense to use a per virtqueue lock > < > like in virtio_blk for example instead of locking on the whole > < > device? OK, it seems you use only one dataqueue, so it > < > may not be that relevant. > < > > < Currently yes, both the backend device (cryptodev-backend-builtin) > < and the frontend driver use one dataqueue. > < > > I think it makes sense to use per virtqueue lock here though it only uses one > queue so far, > but in the spec we already have multi queues support. >Yes, I agree. Will do that in V8 soon. Hope to catch up with Michael's pull request for 4.10. Regards, -Gonglei
Michael S. Tsirkin
2016-Dec-15 16:42 UTC
[Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
On Thu, Dec 15, 2016 at 01:08:51AM +0000, Gonglei (Arei) wrote:> > > > > Regards, > -Gonglei > > > > -----Original Message----- > > From: Zeng, Xin [mailto:xin.zeng at intel.com] > > Sent: Thursday, December 15, 2016 8:59 AM > > To: Gonglei (Arei); Halil Pasic; linux-kernel at vger.kernel.org; > > qemu-devel at nongnu.org; virtio-dev at lists.oasis-open.org; > > virtualization at lists.linux-foundation.org; linux-crypto at vger.kernel.org > > Cc: Huangweidong (C); Claudio Fontana; mst at redhat.com; Luonengjun; > > Hanweidong (Randy); Xuquan (Quan Xu); Wanzongshun (Vincent); > > stefanha at redhat.com; Zhoujian (jay, Euler); cornelia.huck at de.ibm.com; > > longpeng; arei.gonglei at hotmail.com; davem at davemloft.net; Wubin (H); > > herbert at gondor.apana.org.au > > Subject: RE: [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver > > > > On Thursday, December 15, 2016 8:45 AM, Gonglei (Arei) Wrote: > > < > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c > > < > b/drivers/crypto/virtio/virtio_crypto_core.c > > < > > new file mode 100644 > > < > > index 0000000..c0854a1 > > < > > --- /dev/null > > < > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c > > < > > @@ -0,0 +1,474 @@ > > < > [..] > > < > > + > > < > > +static void virtcrypto_dataq_callback(struct virtqueue *vq) > > < > > +{ > > < > > + struct virtio_crypto *vcrypto = vq->vdev->priv; > > < > > + struct virtio_crypto_request *vc_req; > > < > > + unsigned long flags; > > < > > + unsigned int len; > > < > > + struct ablkcipher_request *ablk_req; > > < > > + int error; > > < > > + > > < > > + spin_lock_irqsave(&vcrypto->lock, flags); > > < > > > < > Would it make sense to use a per virtqueue lock > > < > like in virtio_blk for example instead of locking on the whole > > < > device? OK, it seems you use only one dataqueue, so it > > < > may not be that relevant. > > < > > > < Currently yes, both the backend device (cryptodev-backend-builtin) > > < and the frontend driver use one dataqueue. > > < > > > > I think it makes sense to use per virtqueue lock here though it only uses one > > queue so far, > > but in the spec we already have multi queues support. > > > Yes, I agree. Will do that in V8 soon. > Hope to catch up with Michael's pull request for 4.10. > > Regards, > -GongleiI merged v7, this change will have to wait. Sorry.
Maybe Matching Threads
- [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
- [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
- [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
- [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
- [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver