Re: Re: PING: [PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-10-19 Thread zhenwei pi via Virtualization
Cc Paolo, Stefan, Xuan and linux-block. On 10/19/23 17:52, Michael S. Tsirkin wrote: On Thu, Oct 19, 2023 at 05:43:55PM +0800, zhenwei pi wrote: Hi Michael, This seems to have been ignored as you suggested. LINK: https://www.spinics.net/lists/linux-virtualization/msg63015.html Pls Cc more

PING: [PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-10-19 Thread zhenwei pi via Virtualization
Hi Michael, This seems to have been ignored as you suggested. LINK: https://www.spinics.net/lists/linux-virtualization/msg63015.html On 9/4/23 14:10, zhenwei pi wrote: The following codes have an implicit conversion from size_t to u32: (u32)max_size = (size_t)virtio_max_dma_size(vdev

Re: Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled

2023-09-27 Thread zhenwei pi via Virtualization
ontext. Good catch. Will fix it. Thanks Gonglei! Sorry I first misunderstood this as a problem within the virtio-ccw driver, but it is actually about virtio-crypto. Thanks for fixing this! Regards, Halil -- zhenwei pi ___ Virtualization mailing list

[PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-09-04 Thread zhenwei pi via Virtualization
The following codes have an implicit conversion from size_t to u32: (u32)max_size = (size_t)virtio_max_dma_size(vdev); This may lead overflow, Ex (size_t)4G -> (u32)0. Once virtio_max_dma_size() has a larger size than U32_MAX, use U32_MAX instead. Signed-off-by: zhenwei pi --- drivers/bl

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-07-04 Thread zhenwei pi via Virtualization
On 7/4/23 14:21, Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio

PING Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-07-03 Thread zhenwei pi via Virtualization
:37 +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is U32_MAX. An example of virtio_max_dma_size in virtio_blk.c: u32 v, max_size

Re: Re: Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-18 Thread zhenwei pi via Virtualization
On 5/18/23 18:09, Michael S. Tsirkin wrote: On Thu, May 18, 2023 at 08:47:22AM +0800, zhenwei pi wrote: On 5/17/23 18:39, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 04:35:55PM +0800, zhenwei pi wrote: On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM

Re: Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 18:39, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 04:35:55PM +0800, zhenwei pi wrote: On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM +0800, zhenwei pi wrote: I have a plan to introduce 'Virtio Over Fabrics'(TCP) as Virtio transport

Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM +0800, zhenwei pi wrote: I have a plan to introduce 'Virtio Over Fabrics'(TCP) as Virtio transport, as mentioned in cover letter of this series: 3 weeks ago, I posted a proposal 'Virtio Over Fabrics': https

Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 15:39, Christoph Hellwig wrote: On Wed, May 17, 2023 at 10:54:23AM +0800, zhenwei pi wrote: All the vring based virtqueue methods could be abstratct in theory, MST suggested that add/get bufs and kick functions are quite perfmance sensitive, so export these functions from

Re: Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 14:10, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 12:58:10PM +0800, zhenwei pi wrote: On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM

Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensit

Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive API. - Reduce changes in tools/virtio. Add test result(no obvious change): Before: time ./vringh_t

[PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
eep it or rename it to 'vring_virtqueue_add_split'? zhenwei pi (2): virtio: abstract virtqueue related methods tools/virtio: implement virtqueue in test drivers/virtio/virtio_ring.c | 285 +- include/linux/virtio.h | 441 +++ incl

[PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
that add/get bufs and kick functions are quite perfmance sensitive, so export these functions from virtio_ring.ko, drivers still call them in a fast path. Cc: Stefan Hajnoczi Signed-off-by: zhenwei pi --- drivers/virtio/virtio_ring.c | 285 +- include/linux/virtio.h | 441

[PATCH v2 2/2] tools/virtio: implement virtqueue in test

2023-05-16 Thread zhenwei pi via Virtualization
virtqueue related functions has been abstract since commit ("virtio: abstract virtqueue related methods"), add compatible for abstract API. Signed-off-by: zhenwei pi --- tools/virtio/linux/virtio.h | 355 1 file changed, 324 insertions(+), 31

Re: Re: Re: [PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
On 5/12/23 19:35, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 07:09:40PM +0800, zhenwei pi wrote: On 5/12/23 18:46, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 05:46:17PM +0800, zhenwei pi wrote: There is already a virtqueue abstract structure in virtio subsystem (see struct

Re: Re: [PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
On 5/12/23 18:46, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 05:46:17PM +0800, zhenwei pi wrote: There is already a virtqueue abstract structure in virtio subsystem (see struct virtqueue in include/linux/virtio.h), however the vring based virtqueue is used only in the past years

[PATCH 2/2] tools/virtio: implement virtqueue in test

2023-05-12 Thread zhenwei pi via Virtualization
virtqueue related functions has been removed from virtio_ring.c since commit("virtio: abstract virtqueue related methods"), rather than compiling with drivers/virtio/virtio.c, implement virtqueue functions here. Signed-off-by: zhenwei pi --- tools/virtio/Makefile | 4 +- to

[PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
virtqueue_detach_unused_buf virtqueue_get_vring_size virtqueue_resize virtqueue_is_broken virtio_break_device __virtio_unbreak_device Cc: Stefan Hajnoczi Signed-off-by: zhenwei pi --- drivers/virtio/virtio.c | 362 +++ drivers/virtio/virtio_ring.c

[PATCH 0/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
with prefix *virtqueue*, for example 'virtqueue_add_split', just keep it or rename it to 'vring_virtqueue_add_split'? zhenwei pi (2): virtio: abstract virtqueue related methods tools/virtio: implement virtqueue in test drivers/virtio/virtio.c | 362 ++ drivers

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-10 Thread zhenwei pi via Virtualization
On 5/10/23 11:26, Xuan Zhuo wrote: On Wed, 10 May 2023 10:54:37 +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is U32_MAX

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-09 Thread zhenwei pi via Virtualization
On 5/10/23 11:39, Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio

[PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-09 Thread zhenwei pi via Virtualization
s 0. Fixes: e6d6dd6c875e ("virtio: Introduce virtio_max_dma_size()") Cc: Joerg Roedel Signed-off-by: zhenwei pi --- drivers/virtio/virtio_ring.c | 12 include/linux/virtio.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_rin

Re: [PATCH] virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session()

2022-11-14 Thread zhenwei pi
Looks good to me, thanks! Acked-by: zhenwei pi On 11/14/22 19:07, Wei Yongjun wrote: From: Wei Yongjun 'vc_ctrl_req' is alloced in virtio_crypto_alg_skcipher_close_session(), and should be freed in the invalid ctrl_status->status error handling case. Otherwise there is a memory leak. Fi

[PATCH v10 1/1] crypto: Introduce RSA algorithm

2022-06-11 Thread zhenwei pi
There are two parts in this patch: 1, support akcipher service by cryptodev-builtin driver 2, virtio-crypto driver supports akcipher service In principle, we should separate this into two patches, to avoid compiling error, merge them into one. Then virtio-crypto gets request from guest side, and

[PATCH v10 0/1] Introduce akcipher service for virtio-crypto

2022-06-11 Thread zhenwei pi
N1 decoder into QEMU. - Implement RSA backend by nettle/hogweed. Zhenwei Pi (1): crypto: Introduce RSA algorithm backends/cryptodev-builtin.c | 276 + backends/cryptodev-vhost-user.c | 34 +++- backends/cryptodev.c | 32 ++- hw/virtio/virtio-crypto.c

[PATCH v9 1/1] crypto: Introduce RSA algorithm

2022-06-10 Thread zhenwei pi
There are two parts in this patch: 1, support akcipher service by cryptodev-builtin driver 2, virtio-crypto driver supports akcipher service In principle, we should separate this into two patches, to avoid compiling error, merge them into one. Then virtio-crypto gets request from guest side, and

[PATCH v9 0/1] Introduce akcipher service for virtio-crypto

2022-06-10 Thread zhenwei pi
- crypto: Introduce akcipher crypto class - virtio-crypto: Introduce RSA algorithm v1 -> v2: - Update virtio_crypto.h from v2 version of related kernel patch. v1: - Support akcipher for virtio-crypto. - Introduce akcipher class. - Introduce ASN1 decoder into QEMU. - Implement RSA backend by net

PING: RE: RE: [PATCH v8 1/1] crypto: Introduce RSA algorithm

2022-06-08 Thread zhenwei pi
Hi, Michael QEMU side was reviewed by Gonglei a week ago. To avoid this to be ignored, PING! On 5/31/22 20:08, Gonglei (Arei) wrote: -Original Message- From: zhenwei pi [mailto:pizhen...@bytedance.com] Sent: Tuesday, May 31, 2022 9:48 AM To: Gonglei (Arei) Cc: qemu-de

Re: Re: [PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-06-02 Thread zhenwei pi
On 6/1/22 15:59, David Hildenbrand wrote: On 01.06.22 04:17, zhenwei pi wrote: On 5/31/22 12:08, Jue Wang wrote: On Mon, May 30, 2022 at 8:49 AM Peter Xu wrote: On Mon, May 30, 2022 at 07:33:35PM +0800, zhenwei pi wrote: A VM uses RAM of 2M huge page. Once a MCE(@HVAy in [HVAx,HVAz

Re: Re: Re: [PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-05-31 Thread zhenwei pi
On 5/31/22 12:08, Jue Wang wrote: On Mon, May 30, 2022 at 8:49 AM Peter Xu wrote: On Mon, May 30, 2022 at 07:33:35PM +0800, zhenwei pi wrote: A VM uses RAM of 2M huge page. Once a MCE(@HVAy in [HVAx,HVAz)) occurs, the 2M([HVAx,HVAz)) of hypervisor becomes unaccessible, but the guest poisons

Re: RE: RE: [PATCH v8 1/1] crypto: Introduce RSA algorithm

2022-05-31 Thread zhenwei pi
On 5/31/22 20:08, Gonglei (Arei) wrote: -Original Message- From: zhenwei pi [mailto:pizhen...@bytedance.com] Sent: Tuesday, May 31, 2022 9:48 AM To: Gonglei (Arei) Cc: qemu-de...@nongnu.org; m...@redhat.com; virtualization@lists.linux-foundation.org; helei.si...@bytedance.com; berra

Re: RE: [PATCH v8 1/1] crypto: Introduce RSA algorithm

2022-05-30 Thread zhenwei pi
On 5/30/22 21:31, Gonglei (Arei) wrote: -Original Message- From: zhenwei pi [mailto:pizhen...@bytedance.com] Sent: Friday, May 27, 2022 4:48 PM To: m...@redhat.com; Gonglei (Arei) Cc: qemu-de...@nongnu.org; virtualization@lists.linux-foundation.org; helei.si...@bytedance.com; berra

Re: Re: [PATCH 3/3] virtio_balloon: Introduce memory recover

2022-05-30 Thread zhenwei pi
he notifier and might end up leaking memory here that we allocated? + unregister_memory_failure_notifier(>memory_failure_nb); + cancel_work_sync(>unpoison_memory_work); + } + Could we be leaking memory from the virtballoon_remove() path? Yes, I'll fix the possible memor

Re: Re: [PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-05-30 Thread zhenwei pi
On 5/30/22 15:41, David Hildenbrand wrote: On 27.05.22 08:32, zhenwei pi wrote: On 5/27/22 02:37, Peter Xu wrote: On Wed, May 25, 2022 at 01:16:34PM -0700, Jue Wang wrote: The hypervisor _must_ emulate poisons identified in guest physical address space (could be transported from the source

Re: Re: [PATCH 2/3] mm/memory-failure.c: support reset PTE during unpoison

2022-05-29 Thread zhenwei pi
On 5/30/22 13:02, HORIGUCHI NAOYA(堀口 直也) wrote: On Fri, May 20, 2022 at 03:06:47PM +0800, zhenwei pi wrote: Origianlly, unpoison_memory() is only used by hwpoison-inject, and unpoisons a page which is poisoned by hwpoison-inject too. The kernel PTE entry has no change during software poison

[PATCH v8 1/1] crypto: Introduce RSA algorithm

2022-05-27 Thread zhenwei pi
a enc=pkcs1 >/tmp/enc.pub echo "Dec with priv key..." keyctl pkey_decrypt $PRIV_KEY_ID 0 /tmp/enc.pub enc=pkcs1 >/tmp/dec cmp /tmp/data /tmp/dec echo "Verify with pub key..." keyctl pkey_verify $PUB_KEY_ID 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1 Signed-off-by

Introduce akcipher service for virtio-crypto

2022-05-27 Thread zhenwei pi
r into QEMU. - Implement RSA backend by nettle/hogweed. Zhenwei Pi (1): crypto: Introduce RSA algorithm backends/cryptodev-builtin.c | 274 + backends/cryptodev-vhost-user.c | 34 +++- backends/cryptodev.c | 32 ++- hw/virtio/virtio-crypto.c |

Re: Re: [PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-05-27 Thread zhenwei pi
relationship between UE and CE. So from the point of my view, to fix the corrupted page for VM seems good enough. And yes, unpoisoning several pages does not help significantly, but it is still a chance to make the virtualization better. -- zhenwei pi

Re: [PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-05-26 Thread zhenwei pi
Hi, Andrew & Naoya I would appreciate it if you could give me any hint about the changes of memory/memory-failure! On 5/20/22 15:06, zhenwei pi wrote: Hi, I'm trying to recover hardware corrupted page by virtio balloon, the workflow of this feature like this: Guest 5.MF

Re: Re: [PATCH 3/3] virtio_balloon: Introduce memory recover

2022-05-26 Thread zhenwei pi
On 5/27/22 03:18, Michael S. Tsirkin wrote: On Fri, May 20, 2022 at 03:06:48PM +0800, zhenwei pi wrote: Introduce a new queue 'recover VQ', this allows guest to recover hardware corrupted page: Guest 5.MF -> 6.RVQ FE10.Unpoison p

Re: Re: [PATCH v7 0/9] Introduce akcipher service for virtio-crypto

2022-05-26 Thread zhenwei pi
RSA algorithm by gcrypt test/crypto: Add test suite for crypto akcipher tests/crypto: Add test suite for RSA keys Zhenwei Pi (3): virtio-crypto: header update crypto: Introduce akcipher crypto class crypto: Introduce RSA algorithm backends/cryptodev-builtin.c | 2

Re: Re: [PATCH 3/3] virtio_balloon: Introduce memory recover

2022-05-24 Thread zhenwei pi
On 5/25/22 03:35, Sean Christopherson wrote: On Fri, May 20, 2022, zhenwei pi wrote: @@ -59,6 +60,12 @@ enum virtio_balloon_config_read { VIRTIO_BALLOON_CONFIG_READ_CMD_ID = 0, }; +/* the request body to commucate with host side */ +struct __virtio_balloon_recover

Re: [PATCH] virtio-crypto: Fix an error handling path in virtio_crypto_alg_skcipher_close_session()

2022-05-22 Thread zhenwei pi
%u, session_id: 0x%llx\n", ctrl_status->status, destroy_session->session_id); - return -EINVAL; + err = -EINVAL; + goto out; } err = 0; This looks good to me, thanks! Acked-by:

[PATCH 3/3] virtio_balloon: Introduce memory recover

2022-05-20 Thread zhenwei pi
ion fault at 7f5be2e5a010 The 'HardwareCorrupted' in /proc/meminfo also shows 0 kB. Signed-off-by: zhenwei pi --- drivers/virtio/virtio_balloon.c | 243 include/uapi/linux/virtio_balloon.h | 16 ++ 2 files changed, 259 insertions(+) diff --git a/drivers/vir

[PATCH 2/3] mm/memory-failure.c: support reset PTE during unpoison

2022-05-20 Thread zhenwei pi
add 'bool reset_kpte' to get a change to fix the PTE entry if the page is fixed by hypervisor. Signed-off-by: zhenwei pi --- include/linux/mm.h | 2 +- mm/hwpoison-inject.c | 2 +- mm/memory-failure.c | 26 +++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff

[PATCH 1/3] memory-failure: Introduce memory failure notifier

2022-05-20 Thread zhenwei pi
Introduce memory failure notifier, once hardware memory failure occurs, after the kernel handles the corrupted page successfully, someone who registered this chain gets noticed of the corrupted PFN. Signed-off-by: zhenwei pi --- include/linux/mm.h | 2 ++ mm/memory-failure.c | 33

[PATCH 0/3] recover hardware corrupted page by virtio balloon

2022-05-20 Thread zhenwei pi
red, once the guest gets the 'corrupted_pages' with 0, then the guest could unpoison all the poisoned pages which are recorded in the balloon driver. zhenwei pi (3): memory-failure: Introduce memory failure notifier mm/memory-failure.c: support reset PTE during unpoison virtio_ball

[PATCH v6 9/9] crypto: Introduce RSA algorithm

2022-05-13 Thread zhenwei pi
a enc=pkcs1 >/tmp/enc.pub echo "Dec with priv key..." keyctl pkey_decrypt $PRIV_KEY_ID 0 /tmp/enc.pub enc=pkcs1 >/tmp/dec cmp /tmp/data /tmp/dec echo "Verify with pub key..." keyctl pkey_verify $PUB_KEY_ID 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1 Signed-off-by

[PATCH v6 8/9] tests/crypto: Add test suite for RSA keys

2022-05-13 Thread zhenwei pi
From: Lei He As Daniel suggested, Add tests suite for rsakey, as a way to prove that we can handle DER errors correctly. Signed-off-by: zhenwei pi Signed-off-by: lei he Reviewed-by: Daniel P. Berrangé --- tests/unit/test-crypto-akcipher.c | 285 +- 1 file changed

[PATCH v6 7/9] test/crypto: Add test suite for crypto akcipher

2022-05-13 Thread zhenwei pi
From: Lei He Add unit test and benchmark test for crypto akcipher. Signed-off-by: lei he Signed-off-by: zhenwei pi Reviewed-by: Daniel P. Berrangé --- tests/bench/benchmark-crypto-akcipher.c | 157 ++ tests/bench/meson.build | 1 + tests/bench/test_akcipher_keys.inc

[PATCH v6 6/9] crypto: Implement RSA algorithm by gcrypt

2022-05-13 Thread zhenwei pi
From: Lei He Added gcryt implementation of RSA algorithm, RSA algorithm implemented by gcrypt has a higher priority than nettle because it supports raw padding. Signed-off-by: zhenwei pi Signed-off-by: lei he --- crypto/akcipher-gcrypt.c.inc | 597 +++ crypto

[PATCH v6 5/9] crypto: Implement RSA algorithm by hogweed

2022-05-13 Thread zhenwei pi
From: Lei He Implement RSA algorithm by hogweed from nettle. Thus QEMU supports a 'real' RSA backend to handle request from guest side. It's important to test RSA offload case without OS & hardware requirement. Signed-off-by: lei he Signed-off-by: zhenwei pi --- crypto/akcipher-nettle.c

[PATCH v6 4/9] crypto: add ASN.1 DER decoder

2022-05-13 Thread zhenwei pi
From: Lei He Add an ANS.1 DER decoder which is used to parse asymmetric cipher keys Signed-off-by: zhenwei pi Signed-off-by: lei he --- crypto/der.c | 189 +++ crypto/der.h | 81 ++ crypto/meson.build | 1 + tests/unit

[PATCH v6 3/9] crypto: Introduce akcipher crypto class

2022-05-13 Thread zhenwei pi
-by: zhenwei pi Reviewed-by: Daniel P. Berrangé --- crypto/akcipher.c | 102 crypto/akcipherpriv.h | 55 + crypto/meson.build| 1 + include/crypto/akcipher.h | 158 ++ 4 files changed, 316 insertions(+) create

[PATCH v6 2/9] qapi: crypto-akcipher: Introduce akcipher types to qapi

2022-05-13 Thread zhenwei pi
From: Lei He Introduce akcipher types, also include RSA related types. Reviewed-by: Daniel P. Berrangé Signed-off-by: Lei He Signed-off-by: zhenwei pi --- qapi/crypto.json | 64 1 file changed, 64 insertions(+) diff --git a/qapi/crypto.json

[PATCH v6 1/9] virtio-crypto: header update

2022-05-13 Thread zhenwei pi
Update header from linux, support akcipher service. Reviewed-by: Daniel P. Berrangé Reviewed-by: Gonglei Signed-off-by: lei he Signed-off-by: zhenwei pi --- .../standard-headers/linux/virtio_crypto.h| 82 ++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git

[PATCH v6 0/9] Introduce akcipher service for virtio-crypto

2022-05-13 Thread zhenwei pi
backend by nettle/hogweed. Lei He (6): qapi: crypto-akcipher: Introduce akcipher types to qapi crypto: add ASN.1 DER decoder crypto: Implement RSA algorithm by hogweed crypto: Implement RSA algorithm by gcrypt test/crypto: Add test suite for crypto akcipher tests/crypto: Add test suite f

Re: Re: [PATCH v5 1/9] virtio-crypto: header update

2022-05-12 Thread zhenwei pi
suite for crypto akcipher Fixed the issues you pointed out. Do you have suggestions about the other patches? Or I'll send the v6 series? On 5/12/22 17:55, Daniel P. Berrangé wrote: On Thu, Apr 28, 2022 at 09:59:35PM +0800, zhenwei pi wrote: Update header from linux, support akcipher service

PING: [PATCH v6 0/5] virtio-crypto: Improve performance

2022-05-10 Thread zhenwei pi
Hi, Michael I would appreciate it if you could review this series! On 5/6/22 21:16, zhenwei pi wrote: v5 -> v6: - Minor fix for crypto_engine_alloc_init_and_set(). - All the patches have been reviewed by Gonglei, add this in patch. Thanks to Gonglei. v4 -> v5: - Fix poten

PING: [PATCH v5 9/9] crypto: Introduce RSA algorithm

2022-05-08 Thread zhenwei pi
Hi, Lei I would appreciate it if you could review this patch! On 4/28/22 21:59, zhenwei pi wrote: There are two parts in this patch: 1, support akcipher service by cryptodev-builtin driver 2, virtio-crypto driver supports akcipher service In principle, we should separate this into two patches

Re: Re: Re: [PATCH 3/4] mm/memofy-failure.c: optimize hwpoison_filter

2022-05-07 Thread zhenwei pi
On 5/7/22 16:20, Naoya Horiguchi wrote: On Sat, May 07, 2022 at 08:28:05AM +0800, zhenwei pi wrote: On 5/7/22 00:28, David Hildenbrand wrote: On 06.05.22 15:38, zhenwei pi wrote: On 5/6/22 16:59, Naoya Horiguchi wrote: On Fri, Apr 29, 2022 at 10:22:05PM +0800, zhenwei pi wrote

Re: Re: [PATCH 3/4] mm/memofy-failure.c: optimize hwpoison_filter

2022-05-06 Thread zhenwei pi
On 5/7/22 00:28, David Hildenbrand wrote: On 06.05.22 15:38, zhenwei pi wrote: On 5/6/22 16:59, Naoya Horiguchi wrote: On Fri, Apr 29, 2022 at 10:22:05PM +0800, zhenwei pi wrote: In the memory failure procedure, hwpoison_filter has higher priority, if memory_filter() filters the error

Re: Re: [PATCH 3/4] mm/memofy-failure.c: optimize hwpoison_filter

2022-05-06 Thread zhenwei pi
On 5/6/22 16:59, Naoya Horiguchi wrote: On Fri, Apr 29, 2022 at 10:22:05PM +0800, zhenwei pi wrote: In the memory failure procedure, hwpoison_filter has higher priority, if memory_filter() filters the error event, there is no need to do the further work. Could you clarify what problem you

[PATCH v6 2/5] virtio-crypto: use private buffer for control request

2022-05-06 Thread zhenwei pi
arpenter Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Reviewed-by: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 57 --- drivers/crypto/virtio/virtio_crypto_common.h | 17 -- .../virtio/virtio_crypto_skcipher_algs.c

[PATCH v6 4/5] virtio-crypto: adjust dst_len at ops callback

2022-05-06 Thread zhenwei pi
lei Signed-off-by: lei he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c in

[PATCH v6 3/5] virtio-crypto: wait ctrl queue instead of busy polling

2022-05-06 Thread zhenwei pi
wait wait Test this patch, the guest side get ~200K/s operations with 300% CPU utilization. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Reviewed-by: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 29 ++- drivers/cry

[PATCH v6 5/5] virtio-crypto: enable retry for virtio-crypto-dev

2022-05-06 Thread zhenwei pi
From: lei he Enable retry for virtio-crypto-dev, so that crypto-engine can process cipher-requests parallelly. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Reviewed-by: Gonglei Signed-off-by: lei he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_core.c | 3 ++- 1

[PATCH v6 1/5] virtio-crypto: change code style

2022-05-06 Thread zhenwei pi
The new style shows more obviously: - the variable we want to operate. - an assignment statement in a single line. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Reviewed-by: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 40 ++- .../virtio/vir

[PATCH v6 0/5] virtio-crypto: Improve performance

2022-05-06 Thread zhenwei pi
n crypto engine to improve performance for data queue, this allows the larger depth instead of 1. - Fix dst data length in akcipher service. - Other style fix. lei he (2): virtio-crypto: adjust dst_len at ops callback virtio-crypto: enable retry for virtio-crypto-dev zhenwei pi (3): virtio-cryp

Re: RE: [PATCH v5 5/5] virtio-crypto: enable retry for virtio-crypto-dev

2022-05-06 Thread zhenwei pi
On 5/6/22 17:34, Gonglei (Arei) wrote: -Original Message- From: zhenwei pi [mailto:pizhen...@bytedance.com] Sent: Thursday, May 5, 2022 5:24 PM To: Gonglei (Arei) ; m...@redhat.com Cc: jasow...@redhat.com; herb...@gondor.apana.org.au; linux-ker...@vger.kernel.org; virtualization

Re: Re: PING: [PATCH v4 0/5] virtio-crypto: Improve performance

2022-05-05 Thread zhenwei pi
On 5/5/22 12:57, Michael S. Tsirkin wrote: On Thu, May 05, 2022 at 03:14:40AM +, Gonglei (Arei) wrote: -Original Message- From: zhenwei pi [mailto:pizhen...@bytedance.com] Sent: Thursday, May 5, 2022 10:35 AM To: Gonglei (Arei) ; m...@redhat.com; jasow...@redhat.com Cc: herb

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

2022-05-05 Thread zhenwei pi
From: lei he Enable retry for virtio-crypto-dev, so that crypto-engine can process cipher-requests parallelly. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: lei he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_core.c | 3 ++- 1 file changed, 2

[PATCH v5 4/5] virtio-crypto: adjust dst_len at ops callback

2022-05-05 Thread zhenwei pi
he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c index 382ccec9ab12..2a60d0525

[PATCH v5 3/5] virtio-crypto: wait ctrl queue instead of busy polling

2022-05-05 Thread zhenwei pi
wait wait Test this patch, the guest side get ~200K/s operations with 300% CPU utilization. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 29 ++- drivers/crypto/virtio/virtio_crypto_comm

[PATCH v5 2/5] virtio-crypto: use private buffer for control request

2022-05-05 Thread zhenwei pi
arpenter Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 57 --- drivers/crypto/virtio/virtio_crypto_common.h | 17 -- .../virtio/virtio_crypto_skcipher_algs.c | 50 ++--

[PATCH v5 1/5] virtio-crypto: change code style

2022-05-05 Thread zhenwei pi
The new style shows more obviously: - the variable we want to operate. - an assignment statement in a single line. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 40 ++- .../virtio/virtio_crypto_skcipher_alg

[PATCH v5 0/5] virtio-crypto: Improve performance

2022-05-05 Thread zhenwei pi
. lei he (2): virtio-crypto: adjust dst_len at ops callback virtio-crypto: enable retry for virtio-crypto-dev zhenwei pi (3): virtio-crypto: change code style virtio-crypto: use private buffer for control request virtio-crypto: wait ctrl queue instead of busy polling

PING: [PATCH v4 0/5] virtio-crypto: Improve performance

2022-05-04 Thread zhenwei pi
that this driver is not used widely. So I'd like to rework a lot, it would be best to complete this work in 5.18 window. This gets different point with Jason. I would appreciate it if you could give me any hint. On 4/24/22 18:41, zhenwei pi wrote: Hi, Lei I'd like to move helper and callback functions(Eg

[PATCH v5 9/9] crypto: Introduce RSA algorithm

2022-04-28 Thread zhenwei pi
a enc=pkcs1 >/tmp/enc.pub echo "Dec with priv key..." keyctl pkey_decrypt $PRIV_KEY_ID 0 /tmp/enc.pub enc=pkcs1 >/tmp/dec cmp /tmp/data /tmp/dec echo "Verify with pub key..." keyctl pkey_verify $PUB_KEY_ID 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1 Signed-off-by

[PATCH v5 7/9] test/crypto: Add test suite for crypto akcipher

2022-04-28 Thread zhenwei pi
From: Lei He Add unit test and benchmark test for crypto akcipher. Signed-off-by: lei he Signed-off-by: zhenwei pi Reviewed-by: Daniel P. Berrangé --- tests/bench/benchmark-crypto-akcipher.c | 157 ++ tests/bench/meson.build | 4 + tests/bench/test_akcipher_keys.inc

[PATCH v5 8/9] tests/crypto: Add test suite for RSA keys

2022-04-28 Thread zhenwei pi
From: Lei He As Daniel suggested, Add tests suite for rsakey, as a way to prove that we can handle DER errors correctly. Signed-off-by: lei he --- tests/unit/test-crypto-akcipher.c | 285 +- 1 file changed, 282 insertions(+), 3 deletions(-) diff --git

[PATCH v5 6/9] crypto: Implement RSA algorithm by gcrypt

2022-04-28 Thread zhenwei pi
From: Lei He Added gcryt implementation of RSA algorithm, RSA algorithm implemented by gcrypt has a higher priority than nettle because it supports raw padding. Signed-off-by: lei he --- crypto/akcipher-gcrypt.c.inc | 520 +++ crypto/akcipher.c| 4

[PATCH v5 5/9] crypto: Implement RSA algorithm by hogweed

2022-04-28 Thread zhenwei pi
From: Lei He Implement RSA algorithm by hogweed from nettle. Thus QEMU supports a 'real' RSA backend to handle request from guest side. It's important to test RSA offload case without OS & hardware requirement. Signed-off-by: lei he Signed-off-by: zhenwei pi --- crypto/akcipher-nettle.c

[PATCH v5 4/9] crypto: add ASN.1 DER decoder

2022-04-28 Thread zhenwei pi
From: Lei He Add an ANS.1 DER decoder which is used to parse asymmetric cipher keys Signed-off-by: zhenwei pi Signed-off-by: lei he --- crypto/der.c | 190 +++ crypto/der.h | 82 ++ crypto/meson.build | 1 + tests/unit

[PATCH v5 3/9] crypto: Introduce akcipher crypto class

2022-04-28 Thread zhenwei pi
-by: zhenwei pi --- crypto/akcipher.c | 102 crypto/akcipherpriv.h | 55 + crypto/meson.build| 1 + include/crypto/akcipher.h | 158 ++ 4 files changed, 316 insertions(+) create mode 100644 crypto/akcipher.c

[PATCH v5 2/9] qapi: crypto-akcipher: Introduce akcipher types to qapi

2022-04-28 Thread zhenwei pi
From: Lei He Introduce akcipher types, also include RSA related types. Reviewed-by: Daniel P. Berrangé Signed-off-by: Lei He Signed-off-by: zhenwei pi --- qapi/crypto.json | 64 1 file changed, 64 insertions(+) diff --git a/qapi/crypto.json

[PATCH v5 1/9] virtio-crypto: header update

2022-04-28 Thread zhenwei pi
Update header from linux, support akcipher service. Reviewed-by: Gonglei Signed-off-by: lei he Signed-off-by: zhenwei pi --- .../standard-headers/linux/virtio_crypto.h| 82 ++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/include/standard-headers/linux

[PATCH v5 0/9] Introduce akcipher service for virtio-crypto

2022-04-28 Thread zhenwei pi
SA algorithm by gcrypt test/crypto: Add test suite for crypto akcipher tests/crypto: Add test suite for RSA keys Zhenwei Pi (3): virtio-crypto: header update crypto: Introduce akcipher crypto class crypto: Introduce RSA algorithm backends/cryptodev-builtin.c | 272 -

Re: Re: [PATCH v4 1/5] virtio-crypto: change code style

2022-04-26 Thread zhenwei pi
On 4/26/22 14:12, Jason Wang wrote: On Sun, Apr 24, 2022 at 6:45 PM zhenwei pi wrote: Use temporary variable to make code easy to read and maintain. /* Pad cipher's parameters */ vcrypto->ctrl.u.sym_create_session.op_type = cpu_to_l

Re: Re: Re: [PATCH v3 1/5] virtio-crypto: use private buffer for control request

2022-04-24 Thread zhenwei pi
On 4/24/22 14:21, Jason Wang wrote: On Fri, Apr 22, 2022 at 5:12 PM zhenwei pi wrote: On 4/22/22 15:41, Jason Wang wrote: 在 2022/4/21 18:40, zhenwei pi 写道: Originally, all of the control requests share a single buffer( ctrl & input & ctrl_status fields in struct virtio_crypto), thi

[PATCH v4 5/5] virtio-crypto: enable retry for virtio-crypto-dev

2022-04-24 Thread zhenwei pi
From: lei he Enable retry for virtio-crypto-dev, so that crypto-engine can process cipher-requests parallelly. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: lei he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_core.c | 3 ++- 1 file changed, 2

[PATCH v4 4/5] virtio-crypto: adjust dst_len at ops callback

2022-04-24 Thread zhenwei pi
he Signed-off-by: zhenwei pi --- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c index 1e98502830cf..1892901d2

[PATCH v4 3/5] virtio-crypto: wait ctrl queue instead of busy polling

2022-04-24 Thread zhenwei pi
wait wait Test this patch, the guest side get ~200K/s operations with 300% CPU utilization. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 29 ++- drivers/crypto/virtio/virtio_crypto_comm

[PATCH v4 2/5] virtio-crypto: use private buffer for control request

2022-04-24 Thread zhenwei pi
sending to host to avoid to divulge any information. * Ex, virtio_crypto_ctrl_request::ctrl::u::destroy_session::padding[48] */ So use kzalloc to allocate buffer of struct virtio_crypto_ctrl_request. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- ..

[PATCH v4 1/5] virtio-crypto: change code style

2022-04-24 Thread zhenwei pi
The new style shows more obviously: - the variable we want to operate. - an assignment statement in a single line. Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Gonglei Signed-off-by: zhenwei pi --- .../virtio/virtio_crypto_akcipher_algs.c | 40 ++- .../virtio/virtio_crypto_skcipher_alg

[PATCH v4 0/5] virtio-crypto: Improve performance

2022-04-24 Thread zhenwei pi
ble retry for virtio-crypto-dev zhenwei pi (3): virtio-crypto: change code style virtio-crypto: use private buffer for control request virtio-crypto: wait ctrl queue instead of busy polling .../virtio/virtio_crypto_akcipher_algs.c | 83 ++- drivers/crypto/virtio/virtio_crypto_common

Re: Re: [PATCH v3 1/5] virtio-crypto: use private buffer for control request

2022-04-22 Thread zhenwei pi
On 4/22/22 15:41, Jason Wang wrote: 在 2022/4/21 18:40, zhenwei pi 写道: Originally, all of the control requests share a single buffer( ctrl & input & ctrl_status fields in struct virtio_crypto), this allows queue depth 1 only, the performance of control queue gets limited by thi

Re: Re: [PATCH v3 2/5] virtio-crypto: wait ctrl queue instead of busy polling

2022-04-22 Thread zhenwei pi
On 4/22/22 15:46, Jason Wang wrote: 在 2022/4/21 18:40, zhenwei pi 写道: Originally, after submitting request into virtio crypto control queue, the guest side polls the result from the virt queue. This works like following: CPU0   CPU1   ... CPUx  CPUy

  1   2   >