[PATCH] MAINTAINERS: update email of zhenwei pi

2025-05-27 Thread zhenwei pi
I will leave ByteDance in the next days. Update email to stay reachable. Signed-off-by: zhenwei pi --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7060cf49b9..2da7cf76b7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3278,7

Re: [PATCH] cryptodev: Fix error handling in cryptodev_lkcf_execute_task()

2025-03-18 Thread zhenwei pi
LGTM, thanks! Reviewed-by: zhenwei pi On 3/12/25 18:11, Markus Armbruster wrote: When cryptodev_lkcf_set_op_desc() fails, we report an error, but continue anyway. This is wrong. We then pass a non-null @local_error to various functions, which could easily fail error_setv()'s asserti

Re: Re: [PATCH] cryptodev: Fix error handling in cryptodev_lkcf_execute_task()

2025-03-18 Thread zhenwei pi
On 3/18/25 21:21, Markus Armbruster wrote: zhenwei pi writes: Hi Markus, Current code style seems buggy, I think the main reason is that the Error *errp is not generated at right place. keyctl_pkey_XXX fails without new error, qcrypto_akcipher_XXX fails with new error, but they are in

Re: Re: [PATCH] cryptodev: Fix error handling in cryptodev_lkcf_execute_task()

2025-03-14 Thread zhenwei pi
;local_error); } if (ret < 0) { -if (!local_error) { -if (errno != EKEYREJECTED) { -error_report("Failed do operation with keyctl: %d", errno); -} -} else { -error_report_err(local_error); -} stat

Re: Bad error handling in cryptodev_lkcf_execute_task(), need advice

2025-03-12 Thread zhenwei pi
On 3/12/25 16:10, Markus Armbruster wrote: scripts/coccinelle/error-use-after-free.cocci led me to this function: static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task) { CryptoDevBackendLKCFSession *session = task->sess; CryptoDevBackendAsymOpInfo *asym_

Re: [PATCH] cryptodev: Fix error handling in cryptodev_lkcf_execute_task()

2025-03-12 Thread zhenwei pi
On 3/12/25 18:11, Markus Armbruster wrote: When cryptodev_lkcf_set_op_desc() fails, we report an error, but continue anyway. This is wrong. We then pass a non-null @local_error to various functions, which could easily fail error_setv()'s assertion on failure. Fail the function instead. Whe

Re: Re: [RFC] Proposal for a QEMU video subsystem for cameras and webcams

2025-03-11 Thread zhenwei pi
On 3/11/25 00:57, Thomas Huth wrote: On 10/03/2025 17.51, Alex Bennée wrote: David Milosevic writes: Dear QEMU Developers, I would like to propose the development of a video subsystem in QEMU, with the initial implementation focusing on UVC video device emulation and support for multipl

Re: [PATCH] cryptodev/vhost: allocate CryptoDevBackendVhost using g_mem0()

2025-02-12 Thread zhenwei pi
Acked-by: zhenwei pi On 2/11/25 21:55, Stefano Garzarella wrote: The function `vhost_dev_init()` expects the `struct vhost_dev` (passed as a parameter) to be fully initialized. This is important because some parts of the code check whether `vhost_dev->config_ops` is NULL to determine if it

Re: Re: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks

2024-12-24 Thread zhenwei pi
On 12/24/24 16:59, Philippe Mathieu-Daudé wrote: Hi Gabriel, On 24/12/24 00:46, Gabriel Barrantes wrote:  From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001 From: Gabriel Barrantes Date: Mon, 23 Dec 2024 14:58:12 -0600 Subject: [PATCH] backends/cryptodev-vhost-user: Fix

Re: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks

2024-12-24 Thread zhenwei pi
LGTM, thanks. Reviewed-by: zhenwei pi On 12/24/24 07:46, Gabriel Barrantes wrote: From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001 From: Gabriel Barrantes Date: Mon, 23 Dec 2024 14:58:12 -0600 Subject: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks Do

Re: Re: [PATCH v11 02/10] block/raw: add persistent reservation in/out driver

2024-09-09 Thread zhenwei pi
On 9/10/24 04:18, Keith Busch wrote: On Mon, Sep 09, 2024 at 07:34:45PM +0800, Changqi Lu wrote: +static int coroutine_fn GRAPH_RDLOCK +raw_co_pr_register(BlockDriverState *bs, uint64_t old_key, + uint64_t new_key, BlockPrType type, + bool ptpl, bool ignore

PING: [PATCH] qapi: Document QCryptodevBackendServiceType

2024-08-19 Thread zhenwei pi
Hi Markus, This seems to be ignored... On 8/13/24 09:51, zhenwei pi wrote: > On 8/12/24 14:14, Philippe Mathieu-Daudé wrote: >> On 12/8/24 03:42, zhenwei pi wrote: >>> QCryptodevBackendServiceType was introduced by >>> bc304a6442e (cryptodev: Introduce server type in

Re: Re: [PATCH] qapi: Document QCryptodevBackendServiceType

2024-08-12 Thread zhenwei pi
On 8/12/24 14:14, Philippe Mathieu-Daudé wrote: > On 12/8/24 03:42, zhenwei pi wrote: >> QCryptodevBackendServiceType was introduced by >> bc304a6442e (cryptodev: Introduce server type in QAPI). However there >> is a lack of member description. Thanks to Markus for

Re: The members of QCryptodevBackendServiceType are undocumented

2024-08-11 Thread zhenwei pi
Hi Markus, Sorry for the lack of necessary description. I sent a patch, please review it. On 8/9/24 02:09, Markus Armbruster wrote: > Hi Zhenwei Pi, > > You added the type in commit bc304a6442e (cryptodev: Introduce server > type in QAPI). The doc comment describes none of the memb

[PATCH] qapi: Document QCryptodevBackendServiceType

2024-08-11 Thread zhenwei pi
QCryptodevBackendServiceType was introduced by bc304a6442e (cryptodev: Introduce server type in QAPI). However there is a lack of member description. Thanks to Markus for pointing out this. Signed-off-by: zhenwei pi --- qapi/cryptodev.json | 10 ++ 1 file changed, 10 insertions(+) diff

[PATCH v3 2/2] test: Remove libibumad dependence

2024-06-11 Thread zhenwei pi
Remove libibumad dependence from the test environment. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: zhenwei pi --- scripts/ci/setup/ubuntu/ubuntu-2204-aarch64.yaml | 1 - scripts/ci/setup/ubuntu/ubuntu-2204-s390x.yaml| 1 - tests/docker/dockerfiles/debian-amd64-cross.docker

[PATCH v3 1/2] meson: Remove libibumad dependence

2024-06-11 Thread zhenwei pi
e Mathieu-Daudé Signed-off-by: zhenwei pi --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index ec59effca2..226b97ea26 100644 --- a/meson.build +++ b/meson.build @@ -1885,11 +1885,9 @@ endif rdma = not_found if not get_option(&#

[PATCH v3 0/2] meson: Remove libibumad dependence

2024-06-11 Thread zhenwei pi
v2 -> v3: - refresh lcitool after removing libibumad v1 -> v2: - remove libibumad from tests/lcitool/projects/qemu.yml v1: - remove libibumad dependence Zhenwei Pi (2): meson: Remove libibumad dependence test: Remove libibumad dependence meson

[PATCH v2 0/1] meson: Remove libibumad dependence

2024-06-11 Thread zhenwei pi
v1 -> v2: remove libibumad from tests/lcitool/projects/qemu.yml v1: remove libibumad dependence Zhenwei Pi (1): meson: Remove libibumad dependence meson.build | 4 +--- tests/lcitool/projects/qemu.yml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) -- 2.34.1

[PATCH v2 1/1] meson: Remove libibumad dependence

2024-06-11 Thread zhenwei pi
e Mathieu-Daudé Signed-off-by: zhenwei pi --- meson.build | 4 +--- tests/lcitool/projects/qemu.yml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/meson.build b/meson.build index ec59effca2..226b97ea26 100644 --- a/meson.build +++ b/meson.build @@ -1885,11 +

[PATCH] meson: Remove libumad dependence

2024-06-11 Thread zhenwei pi
e Mathieu-Daudé Signed-off-by: zhenwei pi --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index ec59effca2..226b97ea26 100644 --- a/meson.build +++ b/meson.build @@ -1885,11 +1885,9 @@ endif rdma = not_found if not get_option(&#

Re: Re: [PATCH 1/9] block: add persistent reservation in/out api

2024-05-09 Thread zhenwei pi
guest PR out without PTPL will work, but the backend uses PTPL=1 instead. Will this request succeed? If the backend driver' supports PTPL capability, it will succeed. Otherwise it will fail. -- zhenwei pi

Re: [PATCH-for-9.0? v2] backends/cryptodev: Do not abort for invalid session ID

2024-04-09 Thread zhenwei pi
LGTM, thanks! Reviewed-by: zhenwei pi On 4/9/24 17:47, Philippe Mathieu-Daudé wrote: Instead of aborting when a session ID is invalid, return VIRTIO_CRYPTO_INVSESS ("Invalid session id"). Reproduced using: $ cat << EOF | qemu-system-i386 -display none \ -machine q3

Re: [PATCH-for-9.0?] backends/cryptodev: Do not abort for invalid session ID

2024-04-08 Thread zhenwei pi
("Cannot find a valid session id: %" PRIu64 "", session_id); +return -VIRTIO_CRYPTO_INVSESS; +} session = builtin->sessions[session_id]; if (session->cipher) { -- zhenwei pi

Re: [PATCH-for-8.2 v2] backends/cryptodev: Do not ignore throttle/backends Errors

2023-11-20 Thread zhenwei pi
Looks good to me. Thanks! Reviewed-by: zhenwei pi On 11/20/23 23:04, Philippe Mathieu-Daudé wrote: Both cryptodev_backend_set_throttle() and CryptoDevBackendClass::init() can set their Error** argument. Do not ignore them, return early on failure. Use the ERRP_GUARD() macro as suggested in

Re: Re: [PULL 22/22] cryptodev: Handle unexpected request to avoid crash

2023-08-03 Thread zhenwei pi
On 8/4/23 12:35, Michael Tokarev wrote: 04.08.2023 01:21, Michael S. Tsirkin wrote: From: zhenwei pi Generally guest side should discover which services the device is able to offer, then do requests on device. However it's also possible to break this rule in a guest. Handle unexp

[PATCH 2/2] cryptodev: Handle unexpected request to avoid crash

2023-08-02 Thread zhenwei pi
7;) Cc: Gonglei Cc: Mauro Matteo Cascella Cc: Xiao Lei Cc: Yongkang Jia Reported-by: Yiming Tao Signed-off-by: zhenwei pi --- backends/cryptodev.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 7d29517843..4d183f7237 100644

[PATCH 0/2] CEV fixes for virtio-crypto

2023-08-02 Thread zhenwei pi
Hi Michael, Lei, Yiming Tao, Yongkang Jia, Xiao Lei(from Zhejiang University) reported issuses and CVEs in the past days. This series fixes a CVE and a BUG for virtio-crypto/cryptodev. Zhenwei Pi (2): virtio-crypto: verify src&dst buffer length for sym request cryptodev: Handle unexpe

[PATCH 1/2] virtio-crypto: verify src&dst buffer length for sym request

2023-08-02 Thread zhenwei pi
changes of error message) in qemu-devel. Fixes: CVE-2023-3180 Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler") Cc: Gonglei Cc: Mauro Matteo Cascella Cc: Yiming Tao Signed-off-by: zhenwei pi --- hw/virtio/virtio-crypto.c | 5 + 1 file changed, 5 insertions(+) di

[PATCH v5 3/9] throttle: support read-only and write-only

2023-07-27 Thread zhenwei pi
direction in throttle, this reduces memory, and uplayer does not need a dummy callback any more. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- util/throttle.c | 42 -- 1 file changed, 28 insertions(+), 14 deletions

[PATCH v5 2/9] test-throttle: use enum ThrottleDirection

2023-07-27 Thread zhenwei pi
Use enum ThrottleDirection instead in the throttle test codes. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-throttle.c b/tests/unit

[PATCH v5 7/9] throttle: use THROTTLE_MAX/ARRAY_SIZE for hard code

2023-07-27 Thread zhenwei pi
into static variables. Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- util/throttle.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/throttle.c b/util/throttle.c index 7d3eb6032f..9582899da3 100644 --- a/util/throttle.c +++ b/util/throttle.c

[PATCH v5 0/9] Misc fixes for throttle

2023-07-27 Thread zhenwei pi
7; to 'ThrottleType' - add assertion to throttle_schedule_timer v1: - introduce enum ThrottleTimerType instead of timers[0], timer[1]... - support read-only and write-only for throttle - adapt related test codes - cryptodev uses a write-only throttle timer Zhenwei Pi (9): throttle: i

[PATCH v5 4/9] test-throttle: test read only and write only

2023-07-27 Thread zhenwei pi
Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index a60b5fe22e..5547837a58

[PATCH v5 5/9] cryptodev: use NULL throttle timer cb for read direction

2023-07-27 Thread zhenwei pi
27; tag is no longer needed. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- backends/cryptodev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 7d29517843..5cfa25c61c 100644 ---

[PATCH v5 8/9] fsdev: Use ThrottleDirection instread of bool is_write

2023-07-27 Thread zhenwei pi
'bool is_write' style is obsolete from throttle framework, adapt fsdev to the new style. Cc: Greg Kurz Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- fsdev/qemu-fsdev-throttle.c | 14 +++--- fsdev/qemu-fsdev-throttle.h | 4 ++-- hw/9pfs/cofile.c|

Re: Re: [PATCH v4 9/9] block/throttle-groups: Use ThrottleDirection instread of bool is_write

2023-07-27 Thread zhenwei pi
On 7/28/23 00:12, Hanna Czenczek wrote: On 24.07.23 12:09, zhenwei pi wrote: 'bool is_write' style is obsolete from throttle framework, adapt block throttle groups to the new style. Use a simple python script to test the new style:   #!/usr/bin/python3 import subprocess import ran

[PATCH v5 9/9] block/throttle-groups: Use ThrottleDirection instread of bool is_write

2023-07-27 Thread zhenwei pi
'virsh blkdeviotune jammy vda --read-bytes-sec ', \ 'virsh blkdeviotune jammy vda --read-iops-sec '] for loop in range(1, 1000): time.sleep(random.randrange(3, 5)) command = commands[random.randrange(0, 3)] + str(random.randrange(0, 100)) subprocess.run(co

[PATCH v5 6/9] throttle: use enum ThrottleDirection instead of bool is_write

2023-07-27 Thread zhenwei pi
enum ThrottleDirection is already there, use ThrottleDirection instead of 'bool is_write' for throttle API, also modify related codes from block, fsdev, cryptodev and tests. Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- backends/cryptodev.c| 9 + bloc

[PATCH v5 1/9] throttle: introduce enum ThrottleDirection

2023-07-27 Thread zhenwei pi
Use enum ThrottleDirection instead of number index. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- include/qemu/throttle.h | 11 --- util/throttle.c | 16 +--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a

[PATCH v4 4/9] test-throttle: test read only and write only

2023-07-24 Thread zhenwei pi
Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index a60b5fe22e..5547837a58

[PATCH v4 8/9] fsdev: Use ThrottleDirection instread of bool is_write

2023-07-24 Thread zhenwei pi
'bool is_write' style is obsolete from throttle framework, adapt fsdev to the new style. Cc: Greg Kurz Signed-off-by: zhenwei pi --- fsdev/qemu-fsdev-throttle.c | 14 +++--- fsdev/qemu-fsdev-throttle.h | 4 ++-- hw/9pfs/cofile.c| 4 ++-- 3 files changed, 11

[PATCH v4 3/9] throttle: support read-only and write-only

2023-07-24 Thread zhenwei pi
direction in throttle, this reduces memory, and uplayer does not need a dummy callback any more. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- util/throttle.c | 42 -- 1 file changed, 28 insertions(+), 14 deletions

[PATCH v4 9/9] block/throttle-groups: Use ThrottleDirection instread of bool is_write

2023-07-24 Thread zhenwei pi
command = commands[random.randrange(0, 3)] + str(random.randrange(0, 100)) subprocess.run(command, shell=True, check=True) This works fine. Signed-off-by: zhenwei pi --- block/throttle-groups.c | 105 block/throttle.c| 8 +--

[PATCH v4 7/9] throttle: use THROTTLE_MAX/ARRAY_SIZE for hard code

2023-07-24 Thread zhenwei pi
into static variables. Signed-off-by: zhenwei pi --- util/throttle.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/throttle.c b/util/throttle.c index 9a37209bb8..9baa6b8a3a 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -142,7 +142,8 @@ int64_t

[PATCH v4 6/9] throttle: use enum ThrottleDirection instead of bool is_write

2023-07-24 Thread zhenwei pi
enum ThrottleDirection is already there, use ThrottleDirection instead of 'bool is_write' for throttle API, also modify related codes from block, fsdev, cryptodev and tests. Signed-off-by: zhenwei pi --- backends/cryptodev.c| 9 + block/throttle-groups.c | 6 +++

[PATCH v4 2/9] test-throttle: use enum ThrottleDirection

2023-07-24 Thread zhenwei pi
Use enum ThrottleDirection instead in the throttle test codes. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-throttle.c b/tests/unit

[PATCH v4 1/9] throttle: introduce enum ThrottleDirection

2023-07-24 Thread zhenwei pi
Use enum ThrottleDirection instead of number index. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Signed-off-by: zhenwei pi --- include/qemu/throttle.h | 11 --- util/throttle.c | 16 +--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a

[PATCH v4 5/9] cryptodev: use NULL throttle timer cb for read direction

2023-07-24 Thread zhenwei pi
27; tag is no longer needed. Reviewed-by: Alberto Garcia Reviewed-by: Hanna Czenczek Cc: Gonglei Signed-off-by: zhenwei pi --- backends/cryptodev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 7d29517843..5cfa25c61c 10

[PATCH v4 0/9] Misc fixes for throttle

2023-07-24 Thread zhenwei pi
leTimerType instead of timers[0], timer[1]... - support read-only and write-only for throttle - adapt related test codes - cryptodev uses a write-only throttle timer Zhenwei Pi (9): throttle: introduce enum ThrottleDirection test-throttle: use enum ThrottleDirection throttle: support read-only an

PING: [PATCH v3 0/6] Misc fixes for throttle

2023-07-20 Thread zhenwei pi
Hi Kevin, Hanna, Patch 1 -> patch 5 of this series are already reviewed by Alberto(these affects throttle framework only), the patch 6 affects qemu block layer, would you please review this(in the further step, merge this series if this is acceptable)? On 7/13/23 14:41, zhenwei pi wr

[PATCH v3 3/6] throttle: support read-only and write-only

2023-07-12 Thread zhenwei pi
direction in throttle, this reduces memory, and uplayer does not need a dummy callback any more. Reviewed-by: Alberto Garcia Signed-off-by: zhenwei pi --- util/throttle.c | 32 ++-- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/util/throttle.c b/util

[PATCH v3 4/6] test-throttle: test read only and write only

2023-07-12 Thread zhenwei pi
Reviewed-by: Alberto Garcia Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index a60b5fe22e..5547837a58 100644 --- a/tests/unit/test

[PATCH v3 2/6] test-throttle: use enum ThrottleType

2023-07-12 Thread zhenwei pi
Use enum ThrottleType instead in the throttle test codes. Reviewed-by: Alberto Garcia Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index 7adb5e6652

[PATCH v3 1/6] throttle: introduce enum ThrottleType

2023-07-12 Thread zhenwei pi
Use enum ThrottleType instead of number index. Reviewed-by: Alberto Garcia Signed-off-by: zhenwei pi --- include/qemu/throttle.h | 11 --- util/throttle.c | 16 +--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/qemu/throttle.h b/include

[PATCH v3 0/6] Misc fixes for throttle

2023-07-12 Thread zhenwei pi
TimerType instead of timers[0], timer[1]... - support read-only and write-only for throttle - adapt related test codes - cryptodev uses a write-only throttle timer Zhenwei Pi (6): throttle: introduce enum ThrottleType test-throttle: use enum ThrottleType throttle: support read-only and wri

[PATCH v3 6/6] throttle: use enum ThrottleType instead of bool is_write

2023-07-12 Thread zhenwei pi
enum ThrottleType is already there, use ThrottleType instead of 'bool is_write' for throttle API, also modify related codes from block, fsdev, cryptodev and tests. Signed-off-by: zhenwei pi --- backends/cryptodev.c| 9 + block/throttle-groups.c | 6 -- fsdev/

[PATCH v3 5/6] cryptodev: use NULL throttle timer cb for read direction

2023-07-12 Thread zhenwei pi
Operations on a crytpodev are considered as *write* only, the callback of read direction is never invoked. Use NULL instead of an unreachable path(cryptodev_backend_throttle_timer_cb on read direction). Reviewed-by: Alberto Garcia Signed-off-by: zhenwei pi --- backends/cryptodev.c | 3 +-- 1

PING: [PATCH v2 0/5] Misc fixes for throttle

2023-07-10 Thread zhenwei pi
Hi, This series has been reviewed by Alberto, can someone review / merge this? On 6/27/23 15:24, zhenwei pi wrote: v1 -> v2: - rename 'ThrottleTimerType' to 'ThrottleType' - add assertion to throttle_schedule_timer Something remained: - 'bool is_write' is n

[PATCH v2 5/5] cryptodev: use NULL throttle timer cb for read direction

2023-06-27 Thread zhenwei pi
Operations on a crytpodev are considered as *write* only, the callback of read direction is never invoked. Use NULL instead of an unreachable path(cryptodev_backend_throttle_timer_cb on read direction). Signed-off-by: zhenwei pi --- backends/cryptodev.c | 3 +-- 1 file changed, 1 insertion

[PATCH v2 4/5] test-throttle: test read only and write only

2023-06-27 Thread zhenwei pi
Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index a60b5fe22e..5547837a58 100644 --- a/tests/unit/test-throttle.c +++ b/tests/unit/test

[PATCH v2 0/5] Misc fixes for throttle

2023-06-27 Thread zhenwei pi
other subsystems in this series, do this work in a followup series after there patches apply. v1: - introduce enum ThrottleTimerType instead of timers[0], timer[1]... - support read-only and write-only for throttle - adapt related test codes - cryptodev uses a write-only throttle timer

[PATCH v2 3/5] throttle: support read-only and write-only

2023-06-27 Thread zhenwei pi
direction in throttle, this reduces memory, and uplayer does not need a dummy callback any more. Signed-off-by: zhenwei pi --- util/throttle.c | 32 ++-- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/util/throttle.c b/util/throttle.c index 5642e61763

[PATCH v2 1/5] throttle: introduce enum ThrottleType

2023-06-27 Thread zhenwei pi
Use enum ThrottleType instead of number index. Signed-off-by: zhenwei pi --- include/qemu/throttle.h | 11 --- util/throttle.c | 16 +--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h index

[PATCH v2 2/5] test-throttle: use enum ThrottleType

2023-06-27 Thread zhenwei pi
Use enum ThrottleType instead in the throttle test codes. Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index 7adb5e6652..a60b5fe22e 100644 --- a/tests

Re: Re: [PATCH 3/5] throttle: support read-only and write-only

2023-06-26 Thread zhenwei pi
On 6/27/23 05:38, Alberto Garcia wrote: On Sun 25 Jun 2023 04:56:29 PM +08, zhenwei pi wrote: void throttle_timers_attach_aio_context(ThrottleTimers *tt, AioContext *new_context) { -tt->timers[THROTTLE_TIMER_READ] = -aio_timer_

Re: Re: [PATCH 1/5] throttle: introduce enum ThrottleTimerType

2023-06-26 Thread zhenwei pi
On 6/27/23 05:24, Alberto Garcia wrote: On Sun 25 Jun 2023 04:56:27 PM +08, zhenwei pi wrote: Use enum ThrottleTimerType instead of number index. +typedef enum { +THROTTLE_TIMER_READ = 0, +THROTTLE_TIMER_WRITE, +THROTTLE_TIMER_MAX +} ThrottleTimerType; If you're doing t

[PATCH 2/5] test-throttle: use enum ThrottleTimerType

2023-06-25 Thread zhenwei pi
Use enum ThrottleTimerType instead in the throttle test codes. Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index 7adb5e6652..5fc2de4d47 100644 --- a

[PATCH 5/5] cryptodev: use NULL throttle timer cb for read direction

2023-06-25 Thread zhenwei pi
Operations on a crytpodev are considered as *write* only, the callback of read direction is never invoked. Use NULL instead of an unreachable path(cryptodev_backend_throttle_timer_cb on read direction). Signed-off-by: zhenwei pi --- backends/cryptodev.c | 3 +-- 1 file changed, 1 insertion

[PATCH 1/5] throttle: introduce enum ThrottleTimerType

2023-06-25 Thread zhenwei pi
Use enum ThrottleTimerType instead of number index. Signed-off-by: zhenwei pi --- include/qemu/throttle.h | 12 +--- util/throttle.c | 16 +--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h index

[PATCH 4/5] test-throttle: test read only and write only

2023-06-25 Thread zhenwei pi
Signed-off-by: zhenwei pi --- tests/unit/test-throttle.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c index 5fc2de4d47..d7973980d1 100644 --- a/tests/unit/test-throttle.c +++ b/tests/unit/test

[PATCH 3/5] throttle: support read-only and write-only

2023-06-25 Thread zhenwei pi
direction in throttle, this reduces memory, and uplayer does not need a dummy callback any more. Signed-off-by: zhenwei pi --- util/throttle.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/util/throttle.c b/util/throttle.c index c1cc24831c..01faee783c

[PATCH 0/5] Misc fixes for throttle

2023-06-25 Thread zhenwei pi
Hi, v1: - introduce enum ThrottleTimerType instead of timers[0], timer[1]... - support read-only and write-only for throttle - adapt related test codes - cryptodev uses a write-only throttle timer Zhenwei Pi (5): throttle: introduce enum ThrottleTimerType test-throttle: use enum

Re: [PATCH] cryptodev: Handle unexpected request to avoid crash

2023-06-24 Thread zhenwei pi
Hi Michael Could you please apply this patch? On 5/26/23 11:38, Lei He wrote: On Apr 27, 2023, at 16:05, zhenwei pi wrote: Generally guest side should discover which services the device is able to offer, then do requests on device. However it's also possible to break this rule in a

Re: Re: [PATCH] cryptodev: fix memory leak during stats query

2023-05-26 Thread zhenwei pi
On 5/3/23 20:59, Peter Maydell wrote: On Wed, 3 May 2023 at 12:54, zhenwei pi wrote: object_get_canonical_path already returns newly allocated memory, this means no additional g_strdup required. Remove g_strdup to avoid memory leak. Fixes: Coverity CID 1508074 Fixes: f2b901098 ("cryp

Re: [PATCH] cryptodev-vhost-user: add asymmetric crypto support

2023-05-15 Thread zhenwei pi
on.op_code = backend_info->op_code; +msg.payload.session.session_id = backend_info->session_id; ret = vhost_user_write(dev, &msg, NULL, 0); if (ret < 0) { error_report("vhost_user_write() return %d, create session failed", -- zhenwei pi

Re: [PATCH v2] virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request

2023-05-09 Thread zhenwei pi
LGTM. Thanks! Reviewed-by: zhenwei pi On 5/9/23 15:53, Mauro Matteo Cascella wrote: Ensure op_info is not NULL in case of QCRYPTODEV_BACKEND_ALG_SYM algtype. Fixes: 0e660a6f90a ("crypto: Introduce RSA algorithm") Signed-off-by: Mauro Matteo Cascella Reported-by: Yiming Tao --- v2:

Re: RE: [PATCH] virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request

2023-05-08 Thread zhenwei pi
roduced by commit 0e660a6f90a, which changed the semantic meaning of request-> flag. Regards, -Gonglei Hi Mauro Agree with Lei, could you please change the Fixes as Lei suggested? -- zhenwei pi

[PATCH] cryptodev: fix memory leak during stats query

2023-05-03 Thread zhenwei pi
object_get_canonical_path already returns newly allocated memory, this means no additional g_strdup required. Remove g_strdup to avoid memory leak. Fixes: Coverity CID 1508074 Fixes: f2b901098 ("cryptodev: Support query-stats QMP command") Cc: Peter Maydell Signed-off-by:

Re: Re: [PULL 11/73] cryptodev: Support query-stats QMP command

2023-05-02 Thread zhenwei pi
On 5/3/23 01:03, Peter Maydell wrote: On Wed, 8 Mar 2023 at 01:11, Michael S. Tsirkin wrote: From: zhenwei pi Now we can use "query-stats" QMP command to query statistics of crypto devices. (Originally this was designed to show statistics by '{"execute": &q

[PATCH] cryptodev: Handle unexpected request to avoid crash

2023-04-27 Thread zhenwei pi
7;) Cc: Gonglei Cc: Mauro Matteo Cascella Cc: Xiao Lei Cc: Yongkang Jia Reported-by: Yiming Tao Signed-off-by: zhenwei pi --- backends/cryptodev.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 94ca393cee..d3fe92d8c0 100644

Re: [PATCH 16/16] qapi storage-daemon/qapi: Fix documentation section structure

2023-04-04 Thread zhenwei pi
Looks good to me, thanks! Acked-by: zhenwei pi On 4/4/23 19:59, Markus Armbruster wrote: In the QEMU QMP Reference Manual, subsection "Block core (VM unrelated)" is empty. Its contents is at the end of subsection "Background jobs" instead. That's because qapi/job

Re: Re: [PATCH v6 09/12] cryptodev: Account statistics

2023-03-02 Thread zhenwei pi
On 3/1/23 19:05, Daniel P. Berrangé wrote: On Wed, Mar 01, 2023 at 06:58:44PM +0800, zhenwei pi wrote: Account OPS/BPS for crypto device, this will be used for 'query-stats' QEMU monitor command and QoS in the next step. Note that a crypto device may support symmetric mode, asymm

Re: Re: [PATCH v5 07/12] hmp: add cryptodev info command

2023-03-01 Thread zhenwei pi
On 3/1/23 18:47, Dr. David Alan Gilbert wrote: * zhenwei pi (pizhen...@bytedance.com) wrote: Example of this command: # virsh qemu-monitor-command vm --hmp info cryptodev cryptodev1: service=[akcipher|mac|hash|cipher] queue 0: type=builtin cryptodev0: service=[akcipher] queue 0

[PATCH v6 10/12] cryptodev: support QoS

2023-03-01 Thread zhenwei pi
qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \ throttle-ops 100 or cancel limitation: virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \ throttle-ops 0 Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi --- backends/cry

[PATCH v6 08/12] cryptodev: Use CryptoDevBackendOpInfo for operation

2023-03-01 Thread zhenwei pi
.c in the next step. (In theory, VirtIOCryptoReq is a private structure used by virtio-crypto only) Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi --- backends/cryptodev-builtin.c | 9 +++-- backends/cryptodev-lkcf.c| 9 +++-- backends/cryptodev.c

[PATCH v6 06/12] cryptodev-builtin: Detect akcipher capability

2023-03-01 Thread zhenwei pi
Rather than exposing akcipher service/RSA algorithm to virtio crypto device unconditionally, detect akcipher capability from akcipher crypto framework. This avoids unsuccessful requests. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi --- backends/cryptodev-builtin.c | 18

[PATCH v6 04/12] cryptodev: Introduce server type in QAPI

2023-03-01 Thread zhenwei pi
Introduce cryptodev service type in cryptodev.json, then apply this to related codes. Now we can remove VIRTIO_CRYPTO_SERVICE_xxx dependence from QEMU cryptodev. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi --- backends/cryptodev-builtin.c| 8 backends/cryptodev

[PATCH v6 09/12] cryptodev: Account statistics

2023-03-01 Thread zhenwei pi
pto device. Signed-off-by: zhenwei pi --- backends/cryptodev.c | 68 +++--- include/sysemu/cryptodev.h | 49 +++ 2 files changed, 112 insertions(+), 5 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index

[PATCH v6 07/12] hmp: add cryptodev info command

2023-03-01 Thread zhenwei pi
/backends/cryptodev-hmp-cmds.c b/backends/cryptodev-hmp-cmds.c new file mode 100644 index 00..4f7220bb13 --- /dev/null +++ b/backends/cryptodev-hmp-cmds.c @@ -0,0 +1,54 @@ +/* + * HMP commands related to cryptodev + * + * Copyright (c) 2023 Bytedance.Inc + * + * Authors: + *zhenwei pi

[PATCH v6 03/12] cryptodev: Introduce cryptodev alg type in QAPI

2023-03-01 Thread zhenwei pi
['sym', 'asym']} Then we can keep 'CRYPTODEV_BACKEND_ALG_SYM' and avoid lots of changes. 2, changes in this patch(with prefix 'QCRYPTODEV_BACKEND_ALG'). To avoid breaking the rule of QAPI, use 2 here. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei

[PATCH v6 02/12] cryptodev: Remove 'name' & 'model' fields

2023-03-01 Thread zhenwei pi
We have already used qapi to generate crypto device types, this allows to convert type to a string 'model', so the 'model' field is not needed. And the 'name' field is not used by any backend driver, drop it. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenw

[PATCH v6 05/12] cryptodev: Introduce 'query-cryptodev' QMP command

2023-03-01 Thread zhenwei pi
"id": "cryptodev0", "client": [ { "queue": 0, "type": "lkcf" } ] } ], "id": "libvirt-417" } Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi --- b

[PATCH v6 11/12] cryptodev: Support query-stats QMP command

2023-03-01 Thread zhenwei pi
ts": [ { "name": "asym-verify-bytes", "value": 0 }, ... { "name": "sym-decrypt-bytes", "value": 5376 }, ... ], "qom-path": "/o

[PATCH v6 01/12] cryptodev: Introduce cryptodev.json

2023-03-01 Thread zhenwei pi
: Daniel P. Berrangé Signed-off-by: zhenwei pi --- MAINTAINERS | 1 + backends/cryptodev-builtin.c| 2 +- backends/cryptodev-lkcf.c | 2 +- backends/cryptodev-vhost-user.c | 4 ++-- backends/cryptodev-vhost.c | 4 ++-- include/sysemu/cryptodev.h |

[PATCH v6 12/12] MAINTAINERS: add myself as the maintainer for cryptodev

2023-03-01 Thread zhenwei pi
I developed the akcipher service, QoS setting, QMP/HMP commands and statistics accounting for crypto device. Making myself as the maintainer for QEMU's cryptodev. Cc: Gonglei Signed-off-by: zhenwei pi --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTA

[PATCH v6 00/12] Refactor cryptodev

2023-03-01 Thread zhenwei pi
y. - support cryptodev QoS settings(BPS&OPS), both QEMU command line and QMP command works fine. - add myself as the maintainer for cryptodev. v1: - introduce cryptodev.json to describe the attributes of crypto device, then drop duplicated type declare, remove some virtio relate

Re: Re: [PATCH v5 09/12] cryptodev: Account statistics

2023-03-01 Thread zhenwei pi
On 3/1/23 17:44, Daniel P. Berrangé wrote: On Wed, Mar 01, 2023 at 10:51:21AM +0800, zhenwei pi wrote: Account OPS/BPS for crypto device, this will be used for 'query-stats' QEMU monitor command and QoS in the next step. Note that a crypto device may support symmetric mode, asymm

Re: Re: [PATCH v4 11/12] cryptodev: Support query-stats QMP command

2023-02-28 Thread zhenwei pi
, Michael S. Tsirkin wrote: On Sun, Jan 29, 2023 at 10:57:46AM +0800, zhenwei pi wrote: Now we can use "query-stats" QMP command to query statistics of crypto devices. (Originally this was designed to show statistics by '{"execute": "query-cryptodev"}'.

[PATCH v5 05/12] cryptodev: Introduce 'query-cryptodev' QMP command

2023-02-28 Thread zhenwei pi
ot;hash", "cipher" ], "id": "cryptodev1", "client": [ { "queue": 0, "type": "builtin" } ] }, { "service": [ "akcipher" ], &

  1   2   3   4   >