[PATCH] qcow2: Allow resize of images with internal snapshots

2020-04-22 Thread Eric Blake
We originally refused to allow resize of images with internal snapshots because the v2 image format did not require the tracking of snapshot size, making it impossible to safely revert to a snapshot with a different size than the current view of the image. But the snapshot size tracking was

Re: [RFC 0/3] 64bit block-layer part I

2020-04-22 Thread Eric Blake
On 4/22/20 1:24 PM, Vladimir Sementsov-Ogievskiy wrote: So, I think the simplest way is to add .bdrv_co_pwritev_zeros64 and .bdrv_co_pdiscard64 and update drivers one-by-one. If at some point all drivers updated - drop unused 32bit functions, and then drop "64" suffix from API. If not - we'll

Re: [RFC 0/3] 64bit block-layer part I

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
30.03.2020 17:18, Vladimir Sementsov-Ogievskiy wrote: Hi all! There is an idea to make NBD protocol extension to support 64bit write-zero/discard/block-status commands (commands, which doesn't transfer user data). It's needed to increase performance of zeroing large ranges (up to the whole

Re: [PATCH v4 20/30] qcow2: Add subcluster support to discard_in_l2_slice()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
22.04.2020 20:42, Alberto Garcia wrote: On Wed 22 Apr 2020 01:35:25 PM CEST, Vladimir Sementsov-Ogievskiy wrote: 17.03.2020 21:16, Alberto Garcia wrote: Two changes are needed in this function: 1) A full discard deallocates a cluster so we can skip the operation if it is already

Re: [PATCH v4 20/30] qcow2: Add subcluster support to discard_in_l2_slice()

2020-04-22 Thread Alberto Garcia
On Wed 22 Apr 2020 01:35:25 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > 17.03.2020 21:16, Alberto Garcia wrote: >> Two changes are needed in this function: >> >> 1) A full discard deallocates a cluster so we can skip the operation if >> it is already unallocated. With extended L2 entries

Re: [PATCH 2/3] block/io: convert generic io path to use int64_t parameters

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
22.04.2020 18:50, Stefan Hajnoczi wrote: On Mon, Mar 30, 2020 at 05:18:17PM +0300, Vladimir Sementsov-Ogievskiy wrote: @@ -875,9 +875,9 @@ static bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self } static int bdrv_check_byte_request(BlockDriverState *bs, int64_t

Re: [PATCH v4 00/18] nvme: factor out cmb/pmr setup

2020-04-22 Thread Maxim Levitsky
On Wed, 2020-04-22 at 13:01 +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Changes since v3 > > * Remove the addition of a new PROPERTIES macro in "nvme: move device > parameters to separate struct" (Philippe) > > * Add NVME_PMR_BIR constant and use it in PMR setup. > >

Re: Integration of qemu-img

2020-04-22 Thread Stefan Hajnoczi
On Thu, Apr 16, 2020 at 09:50:48AM +0200, Markus Armbruster wrote: > Cc: qemu-block > > writes: > > > Dear Sir or Madam, > > > > > > > > I am a PhD student at the Friedrich-Alexander-University Erlangen-Nürnberg > > in Bavaria Germany and I am currently working on an open-source forensic > >

Re: [PATCH v5 4/9] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Eric Blake
On 4/22/20 10:58 AM, Kevin Wolf wrote: @@ -4214,6 +4215,35 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, g_assert_not_reached(); } +if ((flags & BDRV_REQ_ZERO_WRITE) && offset > old_length) { +uint64_t zero_start =

Re: [PATCH 5/9] block/io: expand in_flight inc/dec section: simple cases

2020-04-22 Thread Stefan Hajnoczi
On Wed, Apr 22, 2020 at 04:47:07PM +0300, Vladimir Sementsov-Ogievskiy wrote: > 20.04.2020 19:22, Stefan Hajnoczi wrote: > > On Wed, Apr 08, 2020 at 12:30:47PM +0300, Vladimir Sementsov-Ogievskiy > > wrote: > > > It's safer to expand in_flight request to start before enter to > > > > Please

Re: [PATCH v5 4/9] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Kevin Wolf
Am 22.04.2020 um 17:33 hat Eric Blake geschrieben: > On 4/22/20 10:21 AM, Kevin Wolf wrote: > > If BDRV_REQ_ZERO_WRITE is set and we're extending the image, calling > > qcow2_cluster_zeroize() with flags=0 does the right thing: It doesn't > > undo any previous preallocation, but just adds the zero

Re: [RFC 0/3] 64bit block-layer part I

2020-04-22 Thread Stefan Hajnoczi
On Mon, Mar 30, 2020 at 05:18:15PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Hi all! > > There is an idea to make NBD protocol extension to support 64bit > write-zero/discard/block-status commands (commands, which doesn't > transfer user data). It's needed to increase performance of zeroing >

Re: [PATCH 2/3] block/io: convert generic io path to use int64_t parameters

2020-04-22 Thread Stefan Hajnoczi
On Mon, Mar 30, 2020 at 05:18:17PM +0300, Vladimir Sementsov-Ogievskiy wrote: > @@ -875,9 +875,9 @@ static bool coroutine_fn > bdrv_wait_serialising_requests(BdrvTrackedRequest *self > } > > static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, > -

Re: [PATCH 1/3] block: use int64_t as bytes type in tracked requests

2020-04-22 Thread Stefan Hajnoczi
On Mon, Mar 30, 2020 at 05:18:16PM +0300, Vladimir Sementsov-Ogievskiy wrote: > We are generally moving to int64_t for both offset and bytes paramaters > on all io paths. Convert tracked requests now. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > include/block/block_int.h | 4 ++-- >

Re: [PATCH v5 4/9] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Eric Blake
On 4/22/20 10:21 AM, Kevin Wolf wrote: If BDRV_REQ_ZERO_WRITE is set and we're extending the image, calling qcow2_cluster_zeroize() with flags=0 does the right thing: It doesn't undo any previous preallocation, but just adds the zero flag to all relevant L2 entries. If an external data file is

Re: [PATCH v5 5/9] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Eric Blake
On 4/22/20 10:21 AM, Kevin Wolf wrote: The raw format driver can simply forward the flag and let its bs->file child take care of actually providing the zeros. Signed-off-by: Kevin Wolf --- block/raw-format.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Eric Blake

[PATCH v5 8/9] iotests: Filter testfiles out in filter_img_info()

2020-04-22 Thread Kevin Wolf
We want to keep TEST_IMG for the full path of the main test image, but filter_testfiles() must be called for other test images before replacing other things like the image format because the test directory path could contain the format as a substring. Insert a filter_testfiles() call between

[PATCH v5 9/9] iotests: Test committing to short backing file

2020-04-22 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- tests/qemu-iotests/274 | 157 ++ tests/qemu-iotests/274.out | 260 + tests/qemu-iotests/group | 1 + 3 files changed, 418 insertions(+) create mode 100755 tests/qemu-iotests/274 create mode 100644

[PATCH v5 6/9] file-posix: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Kevin Wolf
For regular files, we always get BDRV_REQ_ZERO_WRITE behaviour from the OS, so we can advertise the flag and just ignore it. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/file-posix.c | 4 1 file changed, 4 insertions(+) diff

[PATCH v5 4/9] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Kevin Wolf
If BDRV_REQ_ZERO_WRITE is set and we're extending the image, calling qcow2_cluster_zeroize() with flags=0 does the right thing: It doesn't undo any previous preallocation, but just adds the zero flag to all relevant L2 entries. If an external data file is in use, a write_zeroes request to the data

[PATCH v5 7/9] block: truncate: Don't make backing file data visible

2020-04-22 Thread Kevin Wolf
When extending the size of an image that has a backing file larger than its old size, make sure that the backing file data doesn't become visible in the guest, but the added area is properly zeroed out. Consider the following scenario where the overlay is shorter than its backing file:

[PATCH v5 3/9] block-backend: Add flags to blk_truncate()

2020-04-22 Thread Kevin Wolf
Now that node level interface bdrv_truncate() supports passing request flags to the block driver, expose this on the BlockBackend level, too. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- include/sysemu/block-backend.h | 2 +- block.c

[PATCH v5 2/9] block: Add flags to bdrv(_co)_truncate()

2020-04-22 Thread Kevin Wolf
Now that block drivers can support flags for .bdrv_co_truncate, expose the parameter in the node level interfaces bdrv_co_truncate() and bdrv_truncate(). Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- include/block/block.h | 5 +++--

[PATCH v5 5/9] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate

2020-04-22 Thread Kevin Wolf
The raw format driver can simply forward the flag and let its bs->file child take care of actually providing the zeros. Signed-off-by: Kevin Wolf --- block/raw-format.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/raw-format.c b/block/raw-format.c index

[PATCH v5 1/9] block: Add flags to BlockDriver.bdrv_co_truncate()

2020-04-22 Thread Kevin Wolf
This adds a new BdrvRequestFlags parameter to the .bdrv_co_truncate() driver callbacks, and a supported_truncate_flags field in BlockDriverState that allows drivers to advertise support for request flags in the context of truncate. For now, we always pass 0 and no drivers declare support for any

[PATCH v5 0/9] block: Fix resize (extending) of short overlays

2020-04-22 Thread Kevin Wolf
v5: - Fixed file-win32 [Patchew] - Fixed zeroing in qcow2 for unaligned requests + tests [Vladimir] - Made raw-format code more consistent [Eric] - Leave output for existing iotests cases unchanged [Vladimir] v4: - Rewrote the series to move the actual zeroing to the block drivers so that error

Re: [RFC 0/3] 64bit block-layer part I

2020-04-22 Thread Eric Blake
On 4/22/20 9:29 AM, Vladimir Sementsov-Ogievskiy wrote: Any thoughts here? I need to resend to update some more functions as patchew said. Is it OK in general? Or should we instead convert everything to uint64_t ? I definitely prefer int64_t as our base (off_t is signed as well, making 63

Re: [RFC 0/3] 64bit block-layer part I

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
Any thoughts here? I need to resend to update some more functions as patchew said. Is it OK in general? Or should we instead convert everything to uint64_t ? 30.03.2020 17:18, Vladimir Sementsov-Ogievskiy wrote: Hi all! There is an idea to make NBD protocol extension to support 64bit

Re: [PATCH v2 0/6] block-copy: use aio-task-pool

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
ping :) 25.03.2020 16:46, Vladimir Sementsov-Ogievskiy wrote: Hi all! This is the next step of improving block-copy: use aio task pool. Async copying loop has better performance than linear, which is shown in original series (was "[RFC 00/24] backup performance: block_status + async", so this

Re: [PATCH 5/9] block/io: expand in_flight inc/dec section: simple cases

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
20.04.2020 19:22, Stefan Hajnoczi wrote: On Wed, Apr 08, 2020 at 12:30:47PM +0300, Vladimir Sementsov-Ogievskiy wrote: It's safer to expand in_flight request to start before enter to Please explain what exeactly "safer" means. If I understand correctly this is just a refactoring and does not

[PATCH v3 5/9] hw/ide/sii3112: Remove dead assignment

2020-04-22 Thread Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer: CC hw/ide/sii3112.o hw/ide/sii3112.c:204:9: warning: Value stored to 'val' is never read val = 0; ^ ~ Fixes: a9dd6604 Reported-by: Clang Static Analyzer Reviewed-by: BALATON Zoltan Acked-by: John Snow

[PATCH v3 2/9] blockdev: Remove dead assignment

2020-04-22 Thread Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer: CC blockdev.o blockdev.c:2744:5: warning: Value stored to 'ret' is never read ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp); ^ ~~~ Reported-by: Clang

[PATCH v3 1/9] block: Avoid dead assignment

2020-04-22 Thread Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer: block.c:3167:5: warning: Value stored to 'ret' is never read ret = bdrv_fill_options(, filename, , _err); ^ ~ Fixes: 462f5bcf6 Reported-by: Clang Static Analyzer

Re: [RFC v2] nbd/proto: introduce extended request and 64bit commands

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
18.03.2020 16:10, Vladimir Sementsov-Ogievskiy wrote: 18.03.2020 15:22, Eric Blake wrote: On 3/18/20 3:04 AM, Wouter Verhelst wrote: On Wed, Mar 18, 2020 at 09:19:45AM +0300, Vladimir Sementsov-Ogievskiy wrote: OK, understand. Reasonable thing, agreed. I'll resend. Hmm. But we can't read in

Re: [PATCH v3 06/10] iotests: add testfinder.py

2020-04-22 Thread Kevin Wolf
Am 22.04.2020 um 14:49 hat Vladimir Sementsov-Ogievskiy geschrieben: > 22.04.2020 14:53, Kevin Wolf wrote: > > Am 22.04.2020 um 07:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > > > 21.04.2020 19:56, Kevin Wolf wrote: > > > > Am 21.04.2020 um 09:35 hat Vladimir Sementsov-Ogievskiy geschrieben:

Re: [PATCH v4 19/30] qcow2: Add subcluster support to zero_in_l2_slice()

2020-04-22 Thread Alberto Garcia
On Wed 22 Apr 2020 01:06:42 PM CEST, Vladimir Sementsov-Ogievskiy wrote: >> @@ -1897,7 +1897,7 @@ static int zero_in_l2_slice(BlockDriverState *bs, >> uint64_t offset, > > As I see, function is not prepared to handle unaligned offset. Worth > add an assertion while being here? The only caller

Re: [PATCH v3 06/10] iotests: add testfinder.py

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
22.04.2020 14:53, Kevin Wolf wrote: Am 22.04.2020 um 07:35 hat Vladimir Sementsov-Ogievskiy geschrieben: 21.04.2020 19:56, Kevin Wolf wrote: Am 21.04.2020 um 09:35 hat Vladimir Sementsov-Ogievskiy geschrieben: Add python script with new logic of searching for tests: Current ./check behavior:

Re: [PATCH v4 22/30] qcow2: Fix offset calculation in handle_dependencies()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: l2meta_cow_start() and l2meta_cow_end() are not necessarily cluster-aligned if the image has subclusters, so update the calculation of old_start and old_end to guarantee that no two requests try to write on the same cluster. Signed-off-by: Alberto Garcia

Re: [PATCH v4 18/30] qcow2: Add subcluster support to qcow2_get_host_offset()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
22.04.2020 14:54, Alberto Garcia wrote: On Wed 22 Apr 2020 10:07:30 AM CEST, Vladimir Sementsov-Ogievskiy wrote: +static int count_contiguous_subclusters(BlockDriverState *bs, int nb_clusters, +unsigned sc_index, uint64_t *l2_slice, +

Re: [PATCH v4 21/30] qcow2: Add subcluster support to check_refcounts_l2()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: Setting the QCOW_OFLAG_ZERO bit of the L2 entry is forbidden if an image has subclusters. Instead, the individual 'all zeroes' bits must be used. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Patch itself seems correct.. Still, would be good

Re: [PATCH v4 18/30] qcow2: Add subcluster support to qcow2_get_host_offset()

2020-04-22 Thread Alberto Garcia
On Wed 22 Apr 2020 10:07:30 AM CEST, Vladimir Sementsov-Ogievskiy wrote: >> +static int count_contiguous_subclusters(BlockDriverState *bs, int >> nb_clusters, >> +unsigned sc_index, uint64_t >> *l2_slice, >> +int

Re: [PATCH v3 06/10] iotests: add testfinder.py

2020-04-22 Thread Kevin Wolf
Am 22.04.2020 um 07:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > 21.04.2020 19:56, Kevin Wolf wrote: > > Am 21.04.2020 um 09:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > > > Add python script with new logic of searching for tests: > > > > > > Current ./check behavior: > > > - tests

Re: [PATCH v4 20/30] qcow2: Add subcluster support to discard_in_l2_slice()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: Two changes are needed in this function: 1) A full discard deallocates a cluster so we can skip the operation if it is already unallocated. With extended L2 entries however if any of the subclusters has the 'all zeroes' bit set then we have to

Re: [PATCH] vfio-helpers: Free QEMUVFIOState in qemu_vfio_close()

2020-04-22 Thread Philippe Mathieu-Daudé
Hi Michal, On 4/22/20 12:30 PM, Michal Privoznik wrote: The qemu_vfio_open_pci() allocates this QEMUVFIOState structure but free counterpart is missing. Since we already have qemu_vfio_close() which does cleanup of the state, it looks like a perfect place to free the structure too. However, to

Re: [PATCH v4 19/30] qcow2: Add subcluster support to zero_in_l2_slice()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: Setting the QCOW_OFLAG_ZERO bit of the L2 entry is forbidden if an image has subclusters. Instead, the individual 'all zeroes' bits must be used. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz anyway: Reviewed-by: Vladimir Sementsov-Ogievskiy

[PATCH v4 17/18] nvme: do cmb/pmr init as part of pci init

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b0b3d3ffb75f..6454f3810e5b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1523,6 +1523,12 @@

[PATCH v4 15/18] nvme: factor out cmb setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 43 --- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2e65a780f4f0..bd255a5c711a 100644 --- a/hw/block/nvme.c +++

[PATCH v4 05/18] nvme: use constants in identify

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Keith Busch --- hw/block/nvme.c | 8 include/block/nvme.h | 8 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v4 02/18] nvme: rename trace events to pci_nvme

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Change the prefix of all nvme device related trace events to 'pci_nvme' to not clash with trace events from the nvme block driver. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c

[PATCH v4 11/18] nvme: factor out block backend setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v4 13/18] nvme: factor out namespace setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 46 ++ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v4 16/18] nvme: factor out pmr setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 95 ++--- 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index bd255a5c711a..b0b3d3ffb75f 100644 --- a/hw/block/nvme.c +++

[PATCH v4 18/18] nvme: factor out controller identify setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 49 ++--- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v4 12/18] nvme: add namespace helpers

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Introduce some small helpers to make the next patches easier on the eye. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 3 +-- hw/block/nvme.h | 17 + 2 files

[PATCH v4 09/18] nvme: factor out property/constraint checks

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 48 ++-- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v4 08/18] nvme: remove redundant cmbloc/cmbsz members

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 7 ++- hw/block/nvme.h | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v4 14/18] nvme: factor out pci setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v4 07/18] nvme: add max_ioqpairs device parameter

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen The num_queues device paramater has a slightly confusing meaning because it accounts for the admin queue pair which is not really optional. Secondly, it is really a maximum value of queues allowed. Add a new max_ioqpairs parameter that only accounts for I/O queue pairs, but

[PATCH v4 00/18] nvme: factor out cmb/pmr setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Changes since v3 * Remove the addition of a new PROPERTIES macro in "nvme: move device parameters to separate struct" (Philippe) * Add NVME_PMR_BIR constant and use it in PMR setup. * Split "nvme: factor out cmb/pmr setup" into - "nvme: factor out cmb

[PATCH v4 06/18] nvme: refactor nvme_addr_read

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Pull the controller memory buffer check to its own function. The check will be used on its own in later patches. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 16

[PATCH v4 01/18] nvme: fix pci doorbell size calculation

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen The size of the BAR is 0x1000 (main registers) + 8 bytes for each queue. Currently, the size of the BAR is calculated like so: n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); Since the 'num_queues' parameter already accounts for the admin queue, this should

[PATCH v4 10/18] nvme: factor out device state setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v4 04/18] nvme: move device parameters to separate struct

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 49 ++--- hw/block/nvme.h

[PATCH v4 03/18] nvme: remove superfluous breaks

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Keith Busch --- hw/block/nvme.c | 4 1

[PATCH] vfio-helpers: Free QEMUVFIOState in qemu_vfio_close()

2020-04-22 Thread Michal Privoznik
The qemu_vfio_open_pci() allocates this QEMUVFIOState structure but free counterpart is missing. Since we already have qemu_vfio_close() which does cleanup of the state, it looks like a perfect place to free the structure too. However, to avoid confusing rename the function to make it explicit

Re: [PATCH v3 12/16] nvme: add namespace helpers

2020-04-22 Thread Maxim Levitsky
On Wed, 2020-04-22 at 09:09 +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Introduce some small helpers to make the next patches easier on the eye. > > Signed-off-by: Klaus Jensen > Reviewed-by: Philippe Mathieu-Daudé > Reviewed-by: Maxim Levitsky > Reviewed-by: Keith Busch > --- >

Re: [PATCH v3 04/16] nvme: move device parameters to separate struct

2020-04-22 Thread Maxim Levitsky
On Wed, 2020-04-22 at 09:09 +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Move device configuration parameters to separate struct to make it > explicit what is configurable and what is set internally. > > Signed-off-by: Klaus Jensen > Signed-off-by: Klaus Jensen > --- > hw/block/nvme.c

Re: [PATCH v3 15/16] nvme: factor out cmb/pmr setup

2020-04-22 Thread Philippe Mathieu-Daudé
On 4/22/20 9:09 AM, Klaus Jensen wrote: From: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 146 ++-- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

Re: [PATCH v4 18/30] qcow2: Add subcluster support to qcow2_get_host_offset()

2020-04-22 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: The logic of this function remains pretty much the same, except that it uses count_contiguous_subclusters(), which combines the logic of count_contiguous_clusters() / count_contiguous_clusters_unallocated() and checks individual subclusters.

Re: [PATCH v3 04/16] nvme: move device parameters to separate struct

2020-04-22 Thread Philippe Mathieu-Daudé
On 4/22/20 9:09 AM, Klaus Jensen wrote: From: Klaus Jensen Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 49

[PATCH v3 15/16] nvme: factor out cmb/pmr setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 146 ++-- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5dddb97a7394..bc4f6b20045b 100644 --- a/hw/block/nvme.c +++

[PATCH v3 16/16] nvme: factor out controller identify setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 50 ++--- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v3 13/16] nvme: factor out namespace setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 46 ++ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v3 10/16] nvme: factor out device state setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v3 12/16] nvme: add namespace helpers

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Introduce some small helpers to make the next patches easier on the eye. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 3 +-- hw/block/nvme.h | 17 + 2 files

[PATCH v3 00/16] nvme: refactoring and cleanups

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Changes since v2 * Rebased on block-next (Kevin) This caused "nvme: move device parameters to separate struct" and "nvme: factor out cmb/pmr setup" to change a bit too much for me to feel its fair to keep the Reviewed-by's, so please re-review. *

[PATCH v3 09/16] nvme: factor out property/constraint checks

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 48 ++-- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v3 02/16] nvme: rename trace events to pci_nvme

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Change the prefix of all nvme device related trace events to 'pci_nvme' to not clash with trace events from the nvme block driver. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c

[PATCH v3 14/16] nvme: factor out pci setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v3 11/16] nvme: factor out block backend setup

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v3 05/16] nvme: use constants in identify

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Keith Busch --- hw/block/nvme.c | 8 include/block/nvme.h | 8 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c

[PATCH v3 06/16] nvme: refactor nvme_addr_read

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Pull the controller memory buffer check to its own function. The check will be used on its own in later patches. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch --- hw/block/nvme.c | 16

[PATCH v3 01/16] nvme: fix pci doorbell size calculation

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen The size of the BAR is 0x1000 (main registers) + 8 bytes for each queue. Currently, the size of the BAR is calculated like so: n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); Since the 'num_queues' parameter already accounts for the admin queue, this should

[PATCH v3 04/16] nvme: move device parameters to separate struct

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 49 - hw/block/nvme.h

[PATCH v3 07/16] nvme: add max_ioqpairs device parameter

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen The num_queues device paramater has a slightly confusing meaning because it accounts for the admin queue pair which is not really optional. Secondly, it is really a maximum value of queues allowed. Add a new max_ioqpairs parameter that only accounts for I/O queue pairs, but

[PATCH v3 03/16] nvme: remove superfluous breaks

2020-04-22 Thread Klaus Jensen
From: Klaus Jensen These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Keith Busch --- hw/block/nvme.c | 4 1

Re: [PATCH v2 00/16] nvme: refactoring and cleanups

2020-04-22 Thread Klaus Birkelund Jensen
On Apr 21 19:24, Maxim Levitsky wrote: > Should I also review the V7 series or I should wait for V8 which will > not include these cleanups? Hi Maxim, Just wait for another series - I don't think I will post a v8, I will chop op the series into smaller ones instead. Most patches will hopefully