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

2021-04-19 Thread Kevin Wolf
Am 19.04.2021 um 19:12 hat Peter Lieven geschrieben: > > > Von meinem iPhone gesendet > > > Am 19.04.2021 um 14:31 schrieb Kevin Wolf : > > > > Am 19.04.2021 um 11:13 hat Peter Lieven geschrieben: > >> > >> > Am 19.04.2021 um 10:36 schrieb Peter Lieven : > >>> > >>> > >>> > Am 1

Re: [PATCH 03/14] hw/block/nvme: rename __nvme_select_ns_iocs

2021-04-19 Thread Thomas Huth
On 19/04/2021 21.27, Klaus Jensen wrote: From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 47 +++ 1 file changed, 23 insertions(+),

Re: [PATCH 02/14] hw/block/nvme: rename __nvme_advance_zone_wp

2021-04-19 Thread Thomas Huth
On 19/04/2021 21.27, Klaus Jensen wrote: From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvm

Re: [PATCH 01/14] hw/block/nvme: rename __nvme_zrm_open

2021-04-19 Thread Thomas Huth
On 19/04/2021 21.27, Klaus Jensen wrote: From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) I think it wou

Re: [for-6.1 0/4] virtio: Improve boot time of virtio-scsi-pci and virtio-blk-pci

2021-04-19 Thread Michael S. Tsirkin
On Wed, Apr 07, 2021 at 04:34:57PM +0200, Greg Kurz wrote: > Now that virtio-scsi-pci and virtio-blk-pci map 1 virtqueue per vCPU, > a serious slow down may be observed on setups with a big enough number > of vCPUs. > > Exemple with a pseries guest on a bi-POWER9 socket system (128 HW threads): >

[PATCH 09/14] hw/block/nvme: add metadata offset helper

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Add an nvme_moff() helper. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 7 ++- hw/block/nvme-dif.c | 4 ++-- hw/block/nvme-ns.c | 2 +- hw/block/nvme.c | 12 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/block/nvme.h b/

[PATCH 12/14] hw/block/nvme: remove irrelevant zone resource checks

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen It is not an error to report more active/open zones supported than the number of zones in the namespace. Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 13 - 1 file changed, 13 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 84f6026

[PATCH 08/14] hw/block/nvme: cache lba and ms sizes

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen There is no need to look up the lba size and metadata size in the LBA Format structure everytime we want to use it. And we use it a lot. Cache the values in the NvmeNamespace and update them if the namespace is formatted. Signed-off-by: Klaus Jensen --- hw/block/nvme.h

[PATCH 10/14] hw/block/nvme: streamline namespace array indexing

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Streamline namespace array indexing such that both the subsystem and controller namespaces arrays are 1-indexed. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 4 ++-- hw/block/nvme.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.h

[PATCH 06/14] hw/block/nvme: remove non-shared defines from header file

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Remove non-shared defines from the shared header. Signed-off-by: Klaus Jensen --- hw/block/nvme.h| 2 -- hw/block/nvme-ns.c | 1 + hw/block/nvme.c| 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index d9374d3e33e

[PATCH 07/14] hw/block/nvme: replace nvme_ns_status

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen The inline nvme_ns_status() helper only has a single call site. Remove it from the header file and inline it for real. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 5 - hw/block/nvme.c | 15 --- 2 files changed, 8 insertions(+), 12 deletions(-) diff --

[PATCH 04/14] hw/block/nvme: consolidate header files

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen In preparation for moving the nvme device into its own subtree, merge the header files into one. Also add missing copyright notice and add list of authors with substantial contributions. Signed-off-by: Klaus Jensen --- hw/block/nvme-dif.h| 63 --- hw/block/nvme-ns.

[PATCH 05/14] hw/block/nvme: cleanup includes

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Clean up includes. Signed-off-by: Klaus Jensen --- hw/block/nvme-dif.c| 7 +++ hw/block/nvme-ns.c | 11 ++- hw/block/nvme-subsys.c | 12 +--- hw/block/nvme.c| 22 +- 4 files changed, 15 insertions(+), 37 deletions(-)

[PATCH 03/14] hw/block/nvme: rename __nvme_select_ns_iocs

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 47 +++ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/hw/block/nvme.c

[PATCH 00/14] hw(/block/)nvme: spring cleaning

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen This series consists of various clean up patches. The final patch moves nvme emulation from hw/block to hw/nvme. Klaus Jensen (14): hw/block/nvme: rename __nvme_zrm_open hw/block/nvme: rename __nvme_advance_zone_wp hw/block/nvme: rename __nvme_select_ns_iocs hw/block/

[PATCH 14/14] hw/nvme: move nvme emulation out of hw/block

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen With the introduction of the nvme-subsystem device we are really cluttering up the hw/block directory. As suggested by Philippe previously, move the nvme emulation to hw/nvme. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Klaus Jensen --- meson.build

[PATCH 11/14] hw/block/nvme: remove num_namespaces member

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen The NvmeCtrl num_namespaces member is just an indirection for the NVME_MAX_NAMESPACES constant. Remove the indirection. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 1 - hw/block/nvme.c | 30 +++--- 2 files changed, 15 insertions(+), 16 deletio

[PATCH 13/14] hw/block/nvme: move zoned constraints checks

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Validation of the max_active and max_open zoned parameters are independent of any other state, so move them to the early nvme_ns_check_constraints parameter checks. Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 52 +- 1 file

[PATCH 01/14] hw/block/nvme: rename __nvme_zrm_open

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 624a143

[PATCH 02/14] hw/block/nvme: rename __nvme_advance_zone_wp

2021-04-19 Thread Klaus Jensen
From: Klaus Jensen Get rid of the (reserved) double underscore use. Cc: Philippe Mathieu-Daudé Cc: Thomas Huth Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 002c0672b397..d1b

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

2021-04-19 Thread Peter Lieven
Von meinem iPhone gesendet > Am 19.04.2021 um 14:31 schrieb Kevin Wolf : > > Am 19.04.2021 um 11:13 hat Peter Lieven geschrieben: >> >> Am 19.04.2021 um 10:36 schrieb Peter Lieven : >>> >>> >>> Am 15.04.2021 um 17:22 schrieb Kevin Wolf : Peter, three years ago you ch

Re: [for-6.1 0/4] virtio: Improve boot time of virtio-scsi-pci and virtio-blk-pci

2021-04-19 Thread Greg Kurz
Ping ? On Wed, 7 Apr 2021 16:34:57 +0200 Greg Kurz wrote: > Now that virtio-scsi-pci and virtio-blk-pci map 1 virtqueue per vCPU, > a serious slow down may be observed on setups with a big enough number > of vCPUs. > > Exemple with a pseries guest on a bi-POWER9 socket system (128 HW threads):

Re: [PATCH] block/file-posix: Fix problem with fallocate(PUNCH_HOLE) on GPFS

2021-04-19 Thread Kevin Wolf
Am 19.04.2021 um 07:06 hat Thomas Huth geschrieben: > On 16/04/2021 22.34, Nir Soffer wrote: > > On Fri, Apr 16, 2021 at 8:23 AM Thomas Huth wrote: > > > > > > A customer reported that running > > > > > > qemu-img convert -t none -O qcow2 -f qcow2 input.qcow2 output.qcow2 > > > > > > fails fo

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

2021-04-19 Thread Kevin Wolf
Am 19.04.2021 um 11:13 hat Peter Lieven geschrieben: > > > > Am 19.04.2021 um 10:36 schrieb Peter Lieven : > > > > > > > >> Am 15.04.2021 um 17:22 schrieb Kevin Wolf : > >> > >> Peter, three years ago you changed 'qemu-img convert' to sacrifice some > >> sparsification in order to get aligned

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

2021-04-19 Thread Kevin Wolf
Am 19.04.2021 um 10:36 hat Peter Lieven geschrieben: > > > > Am 15.04.2021 um 17:22 schrieb Kevin Wolf : > > > > Peter, three years ago you changed 'qemu-img convert' to sacrifice some > > sparsification in order to get aligned requests on the target image. At > > the time, I thought the impact

Re: [PATCH] hw/block/nvme: fix io-command set profile feature

2021-04-19 Thread Klaus Jensen
On Apr 19 16:18, Gollu Appalanaidu wrote: Currently IO Command Set Profile feaure is supported, but feature support flag not set and this feature is changable add support for that. Remove filling default value of feature in CQE CDW0 with zero, since it fallbacks to default case and it is zero in

[PATCH] hw/block/nvme: fix io-command set profile feature

2021-04-19 Thread Gollu Appalanaidu
Currently IO Command Set Profile feaure is supported, but feature support flag not set and this feature is changable add support for that. Remove filling default value of feature in CQE CDW0 with zero, since it fallbacks to default case and it is zero initialized, if feature default value not set

Re: [PATCH v3 21/33] qemu-socket: pass monitor link to socket_get_fd directly

2021-04-19 Thread Vladimir Sementsov-Ogievskiy
19.04.2021 12:34, Daniel P. Berrangé wrote: On Fri, Apr 16, 2021 at 11:08:59AM +0300, Vladimir Sementsov-Ogievskiy wrote: Detecting monitor by current coroutine works bad when we are not in coroutine context. And that's exactly so in nbd reconnect code, where qio_channel_socket_connect_sync() is

[PATCH v2 6/7] hw/block/pflash_cfi02: Remove pflash_setup_mappings()

2021-04-19 Thread Philippe Mathieu-Daudé
All boards calling pflash_cfi02_register() use nb_mappings=1, which does not do any mapping: $ git grep -wl pflash_cfi02_register hw/ hw/arm/xilinx_zynq.c hw/block/pflash_cfi02.c hw/lm32/lm32_boards.c hw/ppc/ppc405_boards.c hw/sh4/r2d.c We can remove this now unneeded code. Reviewed-

[PATCH v2 5/7] hw/arm/digic: Map flash using memory_region_add_subregion_aliased()

2021-04-19 Thread Philippe Mathieu-Daudé
Instead of using a device specific feature for mapping the flash memory multiple times over a wider region, use the generic memory_region_add_subregion_aliased() helper. There is no change in the memory layout. * before: $ qemu-system-arm -M canon-a1100 -S -monitor stdio QEMU 5.2.90 monitor

[PATCH v2 7/7] hw/block/pflash_cfi02: Simplify pflash_cfi02_register() prototype

2021-04-19 Thread Philippe Mathieu-Daudé
The previous commit removed the mapping code from TYPE_PFLASH_CFI02. pflash_cfi02_register() doesn't use the 'nb_mappings' argument anymore. Simply remove it to simplify. Reviewed-by: David Gibson Signed-off-by: Philippe Mathieu-Daudé --- include/hw/block/flash.h | 1 - hw/arm/digic_boards.c

[PATCH v2 4/7] hw/arm/digic: Open-code pflash_cfi02_register() call

2021-04-19 Thread Philippe Mathieu-Daudé
To be able to manually map the flash region on the main memory (in the next commit), first expand the pflash_cfi02_register in place. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/digic_boards.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/h

[PATCH v2 3/7] hw/arm/musicpal: Map flash using memory_region_add_subregion_aliased()

2021-04-19 Thread Philippe Mathieu-Daudé
Instead of using a device specific feature for mapping the flash memory multiple times over a wider region, use the generic memory_region_add_subregion_aliased() helper. There is no change in the memory layout: - before: (qemu) info mtree fe00- (prio 0, i/o): pfla

[PATCH v2 2/7] hw/arm/musicpal: Open-code pflash_cfi02_register() call

2021-04-19 Thread Philippe Mathieu-Daudé
To be able to manually map the flash region on the main memory (in the next commit), first expand the pflash_cfi02_register in place. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/musicpal.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/hw/ar

[RFC PATCH v2 1/7] hw/misc: Add device to help managing aliased memory regions

2021-04-19 Thread Philippe Mathieu-Daudé
// TODO explain here how buses work? when some address lines are // not bound we get memory aliasing, high addresses are masked. // etc... Add a helper to manage this use case easily. For example a having @span_size = @region_size / 4 we get such mapping: ^---^ |

[PATCH v2 0/7] hw/misc: Add memory_region_add_subregion_aliased() helper [pflash part]

2021-04-19 Thread Philippe Mathieu-Daudé
Hi, This series introduce the memory_region_add_subregion_aliased() helper which basically create a device which maps a subregion multiple times. Since v1: - Split series in 2, keeping the I/O regions (showed with the q800 machine) part for 2nd part - Added R-b tags Examples are easier, so hav

Re: [PATCH v3 21/33] qemu-socket: pass monitor link to socket_get_fd directly

2021-04-19 Thread Daniel P . Berrangé
On Fri, Apr 16, 2021 at 11:08:59AM +0300, Vladimir Sementsov-Ogievskiy wrote: > Detecting monitor by current coroutine works bad when we are not in > coroutine context. And that's exactly so in nbd reconnect code, where > qio_channel_socket_connect_sync() is called from thread. > > Add a possibili

Re: [PATCH-for-6.1 0/2] hw/block/pflash_cfi02: Do not create aliases when not necessary

2021-04-19 Thread Philippe Mathieu-Daudé
On 3/25/21 1:09 PM, Philippe Mathieu-Daudé wrote: > Simplify memory layout when no pflash_cfi02 mapping requested. > Philippe Mathieu-Daud=C3=A9 (2): > hw/block/pflash_cfi02: Set romd mode in pflash_cfi02_realize() > hw/block/pflash_cfi02: Do not create aliases when not necessary Thanks, seri

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

2021-04-19 Thread Peter Lieven
> Am 19.04.2021 um 10:36 schrieb Peter Lieven : > > > >> Am 15.04.2021 um 17:22 schrieb Kevin Wolf : >> >> Peter, three years ago you changed 'qemu-img convert' to sacrifice some >> sparsification in order to get aligned requests on the target image. At >> the time, I thought the impact would

[PATCH v2 6/8] block: do not acquire AioContext in check_to_replace_node

2021-04-19 Thread Emanuele Giuseppe Esposito
Make the (only) caller do it. Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block.c | 22 +- blockdev.c| 7 ++- include/block/block.h | 1 + 3 files changed, 12 insertions(+), 18 delet

[PATCH v2 7/8] block/replication: do not acquire AioContext

2021-04-19 Thread Emanuele Giuseppe Esposito
Replication functions are mostly called when the BDS is quiescent and does not have any pending I/O. They do not need to synchronize on anything since BDS and BB are now thread-safe. Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block/replication.c | 54 ++-

[PATCH v2 8/8] block: do not take AioContext around reopen

2021-04-19 Thread Emanuele Giuseppe Esposito
Reopen needs to handle AioContext carefully due to calling bdrv_drain_all_begin/end. By not taking AioContext around calls to bdrv_reopen_multiple, we can drop the function's release/acquire pair and the AioContext argument too. Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Espos

[PATCH v2 5/8] block: add a few more notes on locking

2021-04-19 Thread Emanuele Giuseppe Esposito
Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- include/block/block_int.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index a1aad5ad2d..67a0777e12 100644 ---

[PATCH v2 3/8] util: use RCU accessors for notifiers

2021-04-19 Thread Emanuele Giuseppe Esposito
Note that calling rcu_read_lock() is left to the caller. In fact, if the notifier is really only used within the BQL, it's unnecessary. Even outside the BQL, RCU accessors can also be used with any API that has the same contract as synchronize_rcu, i.e. it stops until all concurrent readers compl

[PATCH v2 4/8] block: make before-write notifiers thread-safe

2021-04-19 Thread Emanuele Giuseppe Esposito
Reads access the list in RCU style, so be careful to avoid use-after-free scenarios in the backup block job. Apart from this, all that's needed is protecting updates with a mutex. Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block.c

[PATCH v2 2/8] block: protect write threshold QMP commands from concurrent requests

2021-04-19 Thread Emanuele Giuseppe Esposito
For simplicity, use bdrv_drained_begin/end to avoid concurrent writes to the write threshold, or reading it while it is being set. qmp_block_set_write_threshold is protected by the BQL. Reviewed-by: Stefan Hajnoczi Co-developed-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- bl

[PATCH v2 0/8] Block layer thread-safety, continued

2021-04-19 Thread Emanuele Giuseppe Esposito
This and the following serie of patches are based on Paolo's v1 patches sent in 2017[*]. They have been ported to the current QEMU version, but the goal remains the same: - make the block layer thread-safe (patches 1-5), and - remove aio_context_acquire/release (patches 6-8). [*] = https://lists.

[PATCH v2 1/8] block: prepare write threshold code for thread safety

2021-04-19 Thread Emanuele Giuseppe Esposito
Reviewed-by: Stefan Hajnoczi Co-developed-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block/write-threshold.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/block/write-threshold.c b/block/write-threshold.c index 85b78dc2a9

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

2021-04-19 Thread Peter Lieven
> Am 15.04.2021 um 17:22 schrieb Kevin Wolf : > > Peter, three years ago you changed 'qemu-img convert' to sacrifice some > sparsification in order to get aligned requests on the target image. At > the time, I thought the impact would be small, but it turns out that > this can end up wasting gi