Re: [PATCH] hw/scsi/megasas: Simplify using the ldst API

2021-12-17 Thread Richard Henderson
On 12/17/21 3:15 PM, Philippe Mathieu-Daudé wrote: -cdb[3] = (len >> 8) & 0xff; -cdb[4] = (len & 0xff); +stw_be_p([2], len); Wrong offset. Otherwise, Reviewed-by: Richard Henderson r~

[PATCH] hw/scsi/megasas: Simplify using the ldst API

2021-12-17 Thread Philippe Mathieu-Daudé
This code is easier to review using the load/store API. Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/megasas.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 619b66ef0f3..066f30e3f22 100644 ---

[PATCH v2 2/2] qemu-img: make is_allocated_sectors() more efficient

2021-12-17 Thread Vladimir Sementsov-Ogievskiy
Consider the case when the whole buffer is zero and end is unaligned. If i <= tail, we return 1 and do one unaligned WRITE, RMW happens. If i > tail, we do on aligned WRITE_ZERO (or skip if target is zeroed) and again one unaligned WRITE, RMW happens. Let's do better: don't fragment the

[PATCH v2 0/2] qemu-img convert: Fix sparseness detection

2021-12-17 Thread Vladimir Sementsov-Ogievskiy
Hi all! 01: only update test output rebasing on master 02: replaced with my proposed solution. Kevin Wolf (1): iotests: Test qemu-img convert of zeroed data cluster Vladimir Sementsov-Ogievskiy (1): qemu-img: make is_allocated_sectors() more efficient qemu-img.c | 23

[PATCH v2 1/2] iotests: Test qemu-img convert of zeroed data cluster

2021-12-17 Thread Vladimir Sementsov-Ogievskiy
From: Kevin Wolf This demonstrates what happens when the block status changes in sub-min_sparse granularity, but all of the parts are zeroed out. The alignment logic in is_allocated_sectors() prevents that the target image remains fully sparse as expected, but turns it into a data cluster of

Re: [PATCH v5 28/31] block.c: assert BQL lock held in bdrv_co_invalidate_cache

2021-12-17 Thread Emanuele Giuseppe Esposito
On 17/12/2021 12:04, Hanna Reitz wrote: On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: bdrv_co_invalidate_cache is special: it is an I/O function, I still don’t believe it is, but well. (Yes, it is called by a test in an iothread, but I believe we’ve seen that the tests simply

Re: [PATCH v2 25/25] python: rename qemu.aqmp to qemu.qmp

2021-12-17 Thread John Snow
On Fri, Dec 17, 2021, 2:40 AM Vladimir Sementsov-Ogievskiy < vsement...@virtuozzo.com> wrote: > 17.12.2021 00:10, John Snow wrote: > > > > > > On Thu, Dec 16, 2021 at 6:41 AM Vladimir Sementsov-Ogievskiy < > vsement...@virtuozzo.com > wrote: > > > > 15.12.2021

Re: [PATCH v5 22/31] block_int-common.h: assertion in the callers of BlockDriver function pointers

2021-12-17 Thread Hanna Reitz
On 17.12.21 16:53, Emanuele Giuseppe Esposito wrote: On 16/12/2021 19:43, Hanna Reitz wrote: On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi ---   block.c    | 18 ++   block/create.c | 10

Re: [PATCH v5 22/31] block_int-common.h: assertion in the callers of BlockDriver function pointers

2021-12-17 Thread Emanuele Giuseppe Esposito
On 16/12/2021 19:43, Hanna Reitz wrote: On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi ---   block.c    | 18 ++   block/create.c | 10 ++   2 files changed, 28 insertions(+) [...]

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Daniel P . Berrangé
On Fri, Dec 17, 2021 at 02:53:05PM +, Alex Bennée wrote: > > Daniel P. Berrangé writes: > > > On Thu, Dec 16, 2021 at 02:11:37PM +, Alex Bennée wrote: > >> > >> Philippe Mathieu-Daudé writes: > >> > >> > When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 > >> > (Fedora 34

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Alex Bennée
Daniel P. Berrangé writes: > On Thu, Dec 16, 2021 at 02:11:37PM +, Alex Bennée wrote: >> >> Philippe Mathieu-Daudé writes: >> >> > When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 >> > (Fedora 34 provides GLib 2.68.1) we get: >> > >> > hw/virtio/virtio-crypto.c:245:24:

Re: [RFC PATCH 2/2] qemu-img convert: Fix sparseness detection

2021-12-17 Thread Peter Lieven
Am 04.12.21 um 00:04 schrieb Vladimir Sementsov-Ogievskiy: > 03.12.2021 14:17, Peter Lieven wrote: >> Am 19.05.21 um 18:48 schrieb Kevin Wolf: >>> Am 19.05.2021 um 15:24 hat Peter Lieven geschrieben: Am 20.04.21 um 18:52 schrieb Vladimir Sementsov-Ogievskiy: > 20.04.2021 18:04, Kevin Wolf

Re: [PATCH v5 30/31] crypto: delegate permission functions to JobDriver .pre_run

2021-12-17 Thread Hanna Reitz
On 17.12.21 13:29, Hanna Reitz wrote: On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: block_crypto_amend_options_generic_luks uses the block layer permission API, therefore it should be called with the BQL held. However, the same function is being called ib two BlockDriver s/ ib / by /

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Daniel P . Berrangé
On Thu, Dec 16, 2021 at 02:11:37PM +, Alex Bennée wrote: > > Philippe Mathieu-Daudé writes: > > > When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 > > (Fedora 34 provides GLib 2.68.1) we get: > > > > hw/virtio/virtio-crypto.c:245:24: error: 'g_memdup' is deprecated: Use > >

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Daniel P . Berrangé
On Fri, Dec 17, 2021 at 11:10:31AM +, Alex Bennée wrote: > > Philippe Mathieu-Daudé writes: > > > On 12/16/21 15:11, Alex Bennée wrote: > >> Philippe Mathieu-Daudé writes: > >> > >>> When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 > >>> (Fedora 34 provides GLib 2.68.1) we

Re: [PATCH v5 30/31] crypto: delegate permission functions to JobDriver .pre_run

2021-12-17 Thread Hanna Reitz
On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: block_crypto_amend_options_generic_luks uses the block layer permission API, therefore it should be called with the BQL held. However, the same function is being called ib two BlockDriver s/ ib / by / callbacks: bdrv_amend_options (under

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Alex Bennée
Laurent Vivier writes: > Alex, > > I've added this patch to my trivial patches branch, do you want I drop > it? No - the patch itself is fine. I would like to fix up the consistency later if we can agree on what it should be. -- Alex Bennée

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Laurent Vivier
Alex, I've added this patch to my trivial patches branch, do you want I drop it? Thanks, Laurent On 17/12/2021 12:10, Alex Bennée wrote: Philippe Mathieu-Daudé writes: On 12/16/21 15:11, Alex Bennée wrote: Philippe Mathieu-Daudé writes: When experimenting raising

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Alex Bennée
Philippe Mathieu-Daudé writes: > On 12/16/21 15:11, Alex Bennée wrote: >> Philippe Mathieu-Daudé writes: >> >>> When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 >>> (Fedora 34 provides GLib 2.68.1) we get: >>> >>> hw/virtio/virtio-crypto.c:245:24: error: 'g_memdup' is

Re: [PATCH v5 28/31] block.c: assert BQL lock held in bdrv_co_invalidate_cache

2021-12-17 Thread Hanna Reitz
On 24.11.21 07:44, Emanuele Giuseppe Esposito wrote: bdrv_co_invalidate_cache is special: it is an I/O function, I still don’t believe it is, but well. (Yes, it is called by a test in an iothread, but I believe we’ve seen that the tests simply sometimes test things that shouldn’t be

Re: [PATCH v3 00/28] glib: Replace g_memdup() by g_memdup2()

2021-12-17 Thread Laurent Vivier
Le 15/12/2021 à 17:54, Philippe Mathieu-Daudé a écrit : Hi Laurent, On 9/3/21 19:44, Philippe Mathieu-Daudé wrote: This series provides the safely equivalent g_memdup2() wrapper, and replace all g_memdup() calls by it. Philippe Mathieu-Daudé (28): hw/hyperv/vmbus: Remove unused

Re: [PATCH v3 28/28] checkpatch: Do not allow deprecated g_memdup()

2021-12-17 Thread Laurent Vivier
Le 03/09/2021 à 19:45, Philippe Mathieu-Daudé a écrit : g_memdup() is insecure and as been deprecated in GLib 2.68. QEMU provides the safely equivalent g_memdup2() wrapper. Do not allow more g_memdup() calls in the repository, provide a hint to use g_memdup2(). Signed-off-by: Philippe

Re: [PATCH v3 24/28] tests/qtest: Replace g_memdup() by g_memdup2()

2021-12-17 Thread Laurent Vivier
Le 03/09/2021 à 19:45, Philippe Mathieu-Daudé a écrit : Per https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538 The old API took the size of the memory to duplicate as a guint, whereas most memory functions take memory sizes as a gsize. This made it easy

Re: [PATCH v3 02/28] glib-compat: Introduce g_memdup2() wrapper

2021-12-17 Thread Laurent Vivier
Le 03/09/2021 à 19:44, Philippe Mathieu-Daudé a écrit : When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68 (Fedora 34 provides GLib 2.68.1) we get: hw/virtio/virtio-crypto.c:245:24: error: 'g_memdup' is deprecated: Use 'g_memdup2' instead [-Werror,-Wdeprecated-declarations] ...

Re: [PATCH-for-6.2 0/2] hw/scsi/megasas: Avoid overflowing the SGL buffer

2021-12-17 Thread Paolo Bonzini
On 11/19/21 21:11, Philippe Mathieu-Daudé wrote: Fix issue #521 reported by Alex some months ago: https://gitlab.com/qemu-project/qemu/-/issues/521 Philippe Mathieu-Daudé (2): hw/scsi/megasas: Fails command if SGL buffer overflows tests/qtest/fuzz-megasas-test: Add test for GitLab issue