Re: [Qemu-devel] [PATCH 1/1] Add vhost-pci-blk driver

2018-11-05 Thread Maxim Levitsky
have this functionality because till now it was limited to iscsi, and thus qemu just passed to the kernel, the wwpn of the device. Best regards, Maxim Levitsky

[Qemu-devel] [PATCH 3/5] block/nvme: support larger that 512 bytes sector devices

2019-04-15 Thread Maxim Levitsky
Currently the driver hardcodes the sector size to 512, and doesn't check the underlying device Signed-off-by: Maxim Levitsky --- block/nvme.c | 40 +++- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index

[Qemu-devel] [PATCH 0/5] Few fixes for userspace NVME driver

2019-04-15 Thread Maxim Levitsky
of fixes sitting in my queue from the period when I developed the nvme-mdev driver. Best regards, Maxim Levitsky Maxim Levitsky (5): block/nvme: don't flip CQ phase bits block/nvme: fix doorbell stride block/nvme: support larger that 512 bytes sector devices block/nvme: add support

[Qemu-devel] [PATCH 5/5] block/nvme: add support for discard

2019-04-15 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 81 ++ block/trace-events | 2 ++ 2 files changed, 83 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 5121e809f0..386c2508b7 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -110,6

[Qemu-devel] [PATCH 1/5] block/nvme: don't flip CQ phase bits

2019-04-15 Thread Maxim Levitsky
Phase bits are only set by the hardware to indicate new completions and not by the device driver. Signed-off-by: Maxim Levitsky --- block/nvme.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 0684bbd077..2d208000df 100644 --- a/block/nvme.c +++ b/block

[Qemu-devel] [PATCH 2/5] block/nvme: fix doorbell stride

2019-04-15 Thread Maxim Levitsky
Fix the math involving non standard doorbell stride Signed-off-by: Maxim Levitsky --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 2d208000df..208242cf1f 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -216,7 +216,7 @@ static

[Qemu-devel] [PATCH 4/5] block/nvme: add support for write zeros

2019-04-15 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 69 +++- block/trace-events | 1 + include/block/nvme.h | 17 ++- 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 0d9b521760..5121e809f0

Re: [Qemu-devel] [Qemu-block] [PATCH 0/5] Few fixes for userspace NVME driver

2019-04-17 Thread Maxim Levitsky
On Tue, 2019-04-16 at 15:50 +0200, Paolo Bonzini wrote: > On 15/04/19 15:57, Maxim Levitsky wrote: > > > > > > Hi! > > These are few assorted fixes and features for the userspace > > nvme driver. > > > > Tested that on my laptop with my Samsung X5 th

[Qemu-devel] [PATCH v2 5/5] block/nvme: add support for discard

2019-04-17 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 80 ++ block/trace-events | 2 ++ 2 files changed, 82 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 35b925899f..b83912c627 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -110,6

[Qemu-devel] [PATCH v2 3/5] block/nvme: support larger that 512 bytes sector devices

2019-04-17 Thread Maxim Levitsky
Currently the driver hardcodes the sector size to 512, and doesn't check the underlying device Also fail if underlying nvme device is formatted with metadata as this needs special support. Signed-off-by: Maxim Levitsky --- block/nvme.c | 40 +++- 1 file

[Qemu-devel] [PATCH v2 4/5] block/nvme: add support for write zeros

2019-04-17 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 69 +++- block/trace-events | 1 + include/block/nvme.h | 19 +++- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 0b1da54574..35b925899f

[Qemu-devel] [PATCH v2 0/5] Few fixes for userspace NVME driver

2019-04-17 Thread Maxim Levitsky
-mdev driver. Best regards, Maxim Levitsky Maxim Levitsky (5): block/nvme: don't flip CQ phase bits block/nvme: fix doorbell stride block/nvme: support larger that 512 bytes sector devices block/nvme: add support for write zeros block/nvme: add support for discard block/nvme.c

[Qemu-devel] [PATCH v2 2/5] block/nvme: fix doorbell stride

2019-04-17 Thread Maxim Levitsky
Fix the math involving non standard doorbell stride Signed-off-by: Maxim Levitsky --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 2d208000df..208242cf1f 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -216,7 +216,7 @@ static

[Qemu-devel] [PATCH v2 1/5] block/nvme: don't flip CQ phase bits

2019-04-17 Thread Maxim Levitsky
Phase bits are only set by the hardware to indicate new completions and not by the device driver. Signed-off-by: Maxim Levitsky --- block/nvme.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 0684bbd077..2d208000df 100644 --- a/block/nvme.c +++ b/block

Re: [Qemu-devel] Question about the vfio device interrupt

2019-05-15 Thread Maxim Levitsky
dea is that first few bar accesses should ack the interrupt and thus avoid flood but some interrupts could still happen (one per bar access) Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v2 0/5] Few fixes for userspace NVME driver

2019-06-03 Thread Maxim Levitsky
On Wed, 2019-04-17 at 22:53 +0300, Maxim Levitsky wrote: > Hi! > These are few assorted fixes and features for the userspace > nvme driver. > > Tested that on my laptop with my Samsung X5 thunderbolt drive, which > happens to have 4K sectors, support for discard and write zero

Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/5] block/nvme: don't flip CQ phase bits

2019-06-05 Thread Maxim Levitsky
On Mon, 2019-06-03 at 18:25 -0400, John Snow wrote: > > On 4/17/19 3:53 PM, Maxim Levitsky wrote: > > Phase bits are only set by the hardware to indicate new completions > > and not by the device driver. > > > > Signed-off-by: Maxim Levitsky > > --- > >

Re: [Qemu-devel] [PATCH v2 5/5] block/nvme: add support for discard

2019-06-06 Thread Maxim Levitsky
On Thu, 2019-06-06 at 11:19 +0800, Fam Zheng wrote: > On Wed, 04/17 22:53, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > block/nvme.c | 80 ++ > > block/trace-events | 2 ++ > >

Re: [Qemu-devel] [Qemu-block] [PATCH v4 2/9] qapi/block-core: add option for io_uring

2019-06-06 Thread Maxim Levitsky
n be made when existing siblings use '_' (not > the case here), or to match how the thing is commonly spelled outside > QEMU. Up to the subject matter experts; I just want to make sure it's > not accidental I agree with that. Other than that, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH v4 1/9] configure: permit use of io_uring

2019-06-06 Thread Maxim Levitsky
o "Linux io_uring support $linux_io_uring" > echo "ATTR/XATTR support $attr" > echo "Install blobs $blobs" > echo "KVM support $kvm" > @@ -6876,6 +6898,11 @@ fi > if test "$linux_aio" = "yes" ; then >echo "CONFIG_LINUX_AIO=y" >> $config_host_mak > fi > +if test "$linux_io_uring" = "yes" ; then > + echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak > + echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak > + echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak > +fi > if test "$attr" = "yes" ; then >echo "CONFIG_ATTR=y" >> $config_host_mak > fi Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH v4 3/9] block/block: add BDRV flag for io_uring

2019-06-06 Thread Maxim Levitsky
need that flag. Lot of code could be removed when someday we will remove the -drive interface. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH 0/5] Few fixes for userspace NVME driver

2019-06-02 Thread Maxim Levitsky
On Mon, 2019-04-15 at 16:57 +0300, Maxim Levitsky wrote: > CC: Fam Zheng > CC: Kevin Wolf > CC: Max Reitz > CC: qemu-devel@nongnu.org > > > Hi! > These are few assorted fixes and features for the userspace > nvme driver. > > Tested that on my laptop wit

Re: [Qemu-devel] [Qemu-block] [PATCH] nvme: do not advertise support for unsupported arbitration mechanism

2019-06-15 Thread Maxim Levitsky
and I haven't noticed it. Just checked again to be sure. To be honest, after some quick look, that driver doesn' even really support the regular Round-Robin as it uses a timer to process a specific queue, kicked up by a doorbell write :-) Acked-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/5] block/nvme: don't flip CQ phase bits

2019-06-11 Thread Maxim Levitsky
On Fri, 2019-06-07 at 15:28 -0400, John Snow wrote: > > On 6/7/19 7:08 AM, Paolo Bonzini wrote: > > On 06/06/19 23:23, John Snow wrote: > > > So: This looks right; does this fix a bug that can be observed? Do we > > > have any regression tests for block/NVMe? > > > > I don't think it fixes a

Re: [Qemu-devel] [PATCH v5 04/12] block/io_uring: implements interfaces for io_uring

2019-06-17 Thread Maxim Levitsky
to this AioContext */ > struct LinuxAioState *aio_get_linux_aio(AioContext *ctx); > > +/* Setup the LuringState bound to this AioContext */ > +struct LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp); > + > +/* Return the LuringState bound to this AioContext */ > +struct LuringState *aio_get_linux_io_uring(AioContext *ctx); > /** > * aio_timer_new_with_attrs: > * @ctx: the aio context > diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h > index 0cb7cc74a2..71d7d1395f 100644 > --- a/include/block/raw-aio.h > +++ b/include/block/raw-aio.h > @@ -55,6 +55,18 @@ void laio_attach_aio_context(LinuxAioState *s, AioContext > *new_context); > void laio_io_plug(BlockDriverState *bs, LinuxAioState *s); > void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s); > #endif > +/* io_uring.c - Linux io_uring implementation */ > +#ifdef CONFIG_LINUX_IO_URING > +typedef struct LuringState LuringState; > +LuringState *luring_init(Error **errp); > +void luring_cleanup(LuringState *s); > +int coroutine_fn luring_co_submit(BlockDriverState *bs, LuringState *s, int > fd, > +uint64_t offset, QEMUIOVector *qiov, int > type); > +void luring_detach_aio_context(LuringState *s, AioContext *old_context); > +void luring_attach_aio_context(LuringState *s, AioContext *new_context); > +void luring_io_plug(BlockDriverState *bs, LuringState *s); > +void luring_io_unplug(BlockDriverState *bs, LuringState *s); > +#endif > > #ifdef _WIN32 > typedef struct QEMUWin32AIOState QEMUWin32AIOState; I plan on this or next week to do some benchmarks of the code and I will share the results as soon as I do them. Please pardon me if I made some mistakes in the review because most of the qemu is new for me, so I don't yet know well most of the stuff here. Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 05/12] stubs: add stubs for io_uring interface

2019-06-17 Thread Maxim Levitsky
t(); > +} > + > +void luring_cleanup(LuringState *s) > +{ > +abort(); > +} I do wonder if there is any value in these stubs (and linux aio stubs as well) since any attempt to use this will abort the test, even basic aio initialization. I am not yet familiar with qemu unit tests, so I won't yet put ack on this patch. Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 07/12] blockdev: accept io_uring as option

2019-06-17 Thread Maxim Levitsky
AIO implementation (threads, native, io_uring)", > },{ > .name = BDRV_OPT_CACHE_WB, > .type = QEMU_OPT_BOOL, Nitpick: Maybe we should rename the native to libaio (accept both but give an deprication warning)? Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 10/12] block/io_uring: adds userspace completion polling

2019-06-17 Thread Maxim Levitsky
; > +if (io_uring_peek_cqe(>ring, ) == 0) { > > +if (!cqes) { > > +qemu_luring_process_completions_and_submit(s); > > +return true; > > +} > > Is this logic inverted? We have a completion when cqes != NULL. This indeed looks inverted to me. Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 08/12] block/file-posix.c: extend to use io_uring

2019-06-17 Thread Maxim Levitsky
rState *bs) > static void raw_aio_attach_aio_context(BlockDriverState *bs, > AioContext *new_context) > { > +BDRVRawState __attribute__((unused)) *s = bs->opaque; > #ifdef CONFIG_LINUX_AIO > - BDRVRawState *s = bs->opaque; &g

Re: [Qemu-devel] [PATCH v5 06/12] util/async: add aio interfaces for io_uring

2019-06-17 Thread Maxim Levitsky
> #ifdef CONFIG_LINUX_AIO > ctx->linux_aio = NULL; > #endif > + > +#ifdef CONFIG_LINUX_IO_URING > +ctx->linux_io_uring = NULL; > +#endif > + > ctx->thread_pool = NULL; > qemu_rec_mutex_init(>lock); > timerlistgroup_init(>tlg, aio_timerlist_notify, ctx); Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 12/12] qemu-iotests/087: checks for io_uring

2019-06-17 Thread Maxim Levitsky
> +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": > "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} > + > + This is kind of wrong copy happened here: The "aio=native without O_DIRECT" test is a negative test trying to enable libaio support without O_DIRECT, which qemu check and fails on. The io_uring can be enabled without O_DIRECT, thus negative test doesn't make sense, but rather a positive test which not only enables this but actually does some IO in this mode to see that it works is needed IMHO. > === Encrypted image QCow === > > Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encryption=on > encrypt.key-secret=sec0 Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v5 04/12] block/io_uring: implements interfaces for io_uring

2019-06-19 Thread Maxim Levitsky
On Wed, 2019-06-19 at 11:14 +0100, Stefan Hajnoczi wrote: > On Mon, Jun 17, 2019 at 03:26:50PM +0300, Maxim Levitsky wrote: > > On Mon, 2019-06-10 at 19:18 +0530, Aarushi Mehta wrote: > > > +if (!cqes) { > > > +break; > > > +}

Re: [Qemu-devel] [PATCH v5 07/12] blockdev: accept io_uring as option

2019-06-19 Thread Maxim Levitsky
On Wed, 2019-06-19 at 11:24 +0100, Stefan Hajnoczi wrote: > On Mon, Jun 17, 2019 at 04:01:45PM +0300, Maxim Levitsky wrote: > > On Mon, 2019-06-10 at 19:19 +0530, Aarushi Mehta wrote: > > > Signed-off-by: Aarushi Mehta > > > Reviewed-by: Stefan Hajnoczi >

[Qemu-devel] [PATCH v2 1/1] raw-posix.c - use max transfer length / max segement count only for SCSI passthrough

2019-07-04 Thread Maxim Levitsky
conversion) More info can be found at: https://bugzilla.redhat.com/show_bug.cgi?id=1647104 Signed-off-by: Maxim Levitsky Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- block/file-posix.c | 54 -- 1 file changed, 28 insertions(+), 26 deletions

[Qemu-devel] [PATCH v2 0/1] Don't obey the kernel block device max transfer len / max segments for raw block devices

2019-07-04 Thread Maxim Levitsky
hor of the code that added these limits, could you share your opinion on that? What was the reason besides SCSI passthrough? V2: * Manually tested to not break the scsi passthrough with a nested VM * As Eric suggested, refactored the area around the fstat. * Spelling/grammar fixes Best regards,

Re: [Qemu-devel] [PATCH 1/1] raw-posix.c - use max transfer length / max segemnt count only for SCSI passthrough

2019-07-03 Thread Maxim Levitsky
On Wed, 2019-07-03 at 09:50 -0500, Eric Blake wrote: > On 6/30/19 10:08 AM, Maxim Levitsky wrote: > > Regular block devices (/dev/sda*, /dev/nvme*, etc) interface is not limited > > The regular block device interface is > > or > > Regular block devices interfaces a

[Qemu-devel] [PATCH v3 0/6] Few fixes for userspace NVME driver

2019-07-03 Thread Maxim Levitsky
Compared to last submission, this series adds another patch, which implements support for image creation over the nvme drive like that: qemu-img create -f qcow2 nvme://:06:00.0/1 10G -o preallocation=metadata I also addressed the review comments. Best regards, Maxim Levitsky Maxim

[Qemu-devel] [PATCH v3 6/6] block/nvme: add support for discard

2019-07-03 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 81 ++ block/trace-events | 2 ++ 2 files changed, 83 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 02e0846643..f8bcf1ffb6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -111,6

[Qemu-devel] [PATCH v3 1/6] block/nvme: don't touch the completion entries

2019-07-03 Thread Maxim Levitsky
Completion entries are meant to be only read by the host and written by the device. The driver is supposed to scan the completions from the last point where it left, and until it sees a completion with non flipped phase bit. Signed-off-by: Maxim Levitsky --- block/nvme.c | 5 + 1 file

[Qemu-devel] [PATCH v3 2/6] block/nvme: fix doorbell stride

2019-07-03 Thread Maxim Levitsky
Fix the math involving non standard doorbell stride Signed-off-by: Maxim Levitsky --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 6d4e7f3d83..52798081b2 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -217,7 +217,7 @@ static

[Qemu-devel] [PATCH v4] block/nvme: add support for discard

2019-07-03 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 81 ++ block/trace-events | 2 ++ 2 files changed, 83 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 02e0846643..96a715dcc1 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -111,6

[Qemu-devel] [PATCH v3 3/6] block/nvme: support larger that 512 bytes sector devices

2019-07-03 Thread Maxim Levitsky
Currently the driver hardcodes the sector size to 512, and doesn't check the underlying device. Fix that. Also fail if underlying nvme device is formatted with metadata as this needs special support. Signed-off-by: Maxim Levitsky --- block/nvme.c | 45

[Qemu-devel] [PATCH v3 5/6] block/nvme: add support for write zeros

2019-07-03 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 69 +++- block/trace-events | 1 + include/block/nvme.h | 19 +++- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 152d27b07f..02e0846643

[Qemu-devel] [PATCH v3 4/6] block/nvme: add support for image creation

2019-07-03 Thread Maxim Levitsky
# create an empty qcow2 image $ qemu-img create -f qcow2 nvme://:06:00.0/1 10G -o preallocation=off Formatting 'nvme://:06:00.0/1', fmt=qcow2 size=10737418240 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16 Signed-off-by: Maxim Levitsky --- block/nvme.c | 108

Re: [Qemu-devel] [PATCH v2 1/1] raw-posix.c - use max transfer length / max segement count only for SCSI passthrough

2019-07-10 Thread Maxim Levitsky
On Thu, 2019-07-04 at 15:43 +0300, Maxim Levitsky wrote: > Regular kernel block devices (/dev/sda*, /dev/nvme*, etc) don't have > max segment size/max segment count hardware requirements exposed > to the userspace, but rather the kernel block layer > takes care to split the incom

Re: [Qemu-devel] [Qemu-block] [PATCH] nvme: Set number of queues later in nvme_init()

2019-07-10 Thread Maxim Levitsky
gt; /* Set up admin queue. */ > > s->queues = g_new(NVMeQueuePair *, 1); > > -s->nr_queues = 1; > > s->queues[0] = nvme_create_queue_pair(bs, 0, NVME_QUEUE_SIZE, errp); > > if (!s->queues[0]) { > > ret = -EINVAL; > > goto out; > > } > > +s->nr_queues = 1; > > QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000); > > s->regs->aqa = cpu_to_le32((NVME_QUEUE_SIZE << 16) | NVME_QUEUE_SIZE); > > s->regs->asq = cpu_to_le64(s->queues[0]->sq.iova); > > > > Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

[Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img

2019-07-10 Thread Maxim Levitsky
=1534951 Signed-off-by: Maxim Levitsky --- block/crypto.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index 8237424ae6..74b789d278 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -251,6 +251,7 @@ static int

[Qemu-devel] [PATCH v2] LUKS: support preallocation in qemu-img

2019-07-11 Thread Maxim Levitsky
preallocation=off and preallocation=metadata both allocate luks header only, and preallocation=falloc/full is passed to underlying file. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534951 Signed-off-by: Maxim Levitsky --- block/crypto.c | 25 ++--- 1 file changed

Re: [Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img

2019-07-11 Thread Maxim Levitsky
On Wed, 2019-07-10 at 23:52 +0200, Max Reitz wrote: > On 10.07.19 23:24, Max Reitz wrote: > > On 10.07.19 19:03, Maxim Levitsky wrote: > > > preallocation=off and preallocation=metadata > > > both allocate luks header only, and preallocation=falloc/full > &g

Re: [Qemu-devel] [PATCH] doc: Preallocation does not require writing zeroes

2019-07-11 Thread Maxim Levitsky
reallocation, and it looks like these are the only mentions that need to be fixed. So, thank you very much, and Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v2] LUKS: support preallocation in qemu-img

2019-07-11 Thread Maxim Levitsky
On Thu, 2019-07-11 at 15:43 +0200, Max Reitz wrote: > On 11.07.19 11:11, Maxim Levitsky wrote: > > preallocation=off and preallocation=metadata > > both allocate luks header only, and preallocation=falloc/full > > is passed to underlying file. > > > > F

[Qemu-devel] [PATCH v3] LUKS: support preallocation

2019-07-11 Thread Maxim Levitsky
preallocation=off and preallocation=metadata both allocate luks header only, and preallocation=falloc/full is passed to underlying file. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534951 Signed-off-by: Maxim Levitsky --- Note that QMP support was only compile tested, since I am still

Re: [Qemu-devel] [Qemu-block] [PATCH v3] LUKS: support preallocation

2019-07-14 Thread Maxim Levitsky
On Thu, 2019-07-11 at 18:27 +0200, Stefano Garzarella wrote: > On Thu, Jul 11, 2019 at 06:09:40PM +0300, Maxim Levitsky wrote: > > preallocation=off and preallocation=metadata > > both allocate luks header only, and preallocation=falloc/full > > is passed to underlying file.

Re: [Qemu-devel] [PATCH v3 2/6] block/nvme: fix doorbell stride

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 13:10 +0200, Max Reitz wrote: > On 05.07.19 13:09, Max Reitz wrote: > > On 03.07.19 17:59, Maxim Levitsky wrote: > > > Fix the math involving non standard doorbell stride > > > > > > Signed-off-by: Maxim Levitsky > > > --- > &

Re: [Qemu-devel] [PATCH v4] block/nvme: add support for discard

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 15:50 +0200, Max Reitz wrote: > On 03.07.19 18:07, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > block/nvme.c | 81 ++ > > block/trace-events | 2 ++ > > 2 files change

Re: [Qemu-devel] [PATCH v3 4/6] block/nvme: add support for image creation

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 14:09 +0200, Max Reitz wrote: > On 03.07.19 17:59, Maxim Levitsky wrote: > > Tesed on a nvme device like that: > > > > # create preallocated qcow2 image > > $ qemu-img create -f qcow2 nvme://:06:00.0/1 10G -o > > preallocation=metada

Re: [Qemu-devel] [PATCH v3 1/6] block/nvme: don't touch the completion entries

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 13:03 +0200, Max Reitz wrote: > On 03.07.19 17:59, Maxim Levitsky wrote: > > Completion entries are meant to be only read by the host and written by the > > device. > > The driver is supposed to scan the completions from the last point where it &g

Re: [Qemu-devel] [PATCH v3 3/6] block/nvme: support larger that 512 bytes sector devices

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 13:58 +0200, Max Reitz wrote: > On 03.07.19 17:59, Maxim Levitsky wrote: > > Currently the driver hardcodes the sector size to 512, > > and doesn't check the underlying device. Fix that. > > > > Also fail if underlying nvme device is formatted with

Re: [Qemu-devel] [PATCH v3 5/6] block/nvme: add support for write zeros

2019-07-07 Thread Maxim Levitsky
On Fri, 2019-07-05 at 15:33 +0200, Max Reitz wrote: > On 03.07.19 17:59, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > block/nvme.c | 69 +++- > > block/trace-events | 1 + > > include/bloc

Re: [Qemu-devel] [PATCH 0/1] RFC: don't obey the block device max transfer len / max segments for block devices

2019-07-02 Thread Maxim Levitsky
On Sun, 2019-06-30 at 18:08 +0300, Maxim Levitsky wrote: > It looks like Linux block devices, even in O_DIRECT mode don't have any user > visible > limit on transfer size / number of segments, which underlying block device > can have. > The block layer takes care of enforci

Re: [Qemu-devel] [Qemu-block] question:about introduce a new feature named “I/O hang”

2019-07-08 Thread Maxim Levitsky
uest wait forever for a request. Note that Linux's nvme driver does know how to retry failed requests, including these that timed out if that helps in any way. Best regards, Maxim Levitsky > > As you say your "hang" and retry logic sits in the block layer, what do > you

Re: [Qemu-devel] [Qemu-block] [PATCH v3] LUKS: support preallocation

2019-07-15 Thread Maxim Levitsky
On Mon, 2019-07-15 at 10:30 +0200, Stefano Garzarella wrote: > On Sun, Jul 14, 2019 at 05:51:51PM +0300, Maxim Levitsky wrote: > > On Thu, 2019-07-11 at 18:27 +0200, Stefano Garzarella wrote: > > > On Thu, Jul 11, 2019 at 06:09:40PM +0300, Maxim Levitsky wrote: > &g

Re: [Qemu-devel] [PATCH v4] LUKS: support preallocation

2019-07-16 Thread Maxim Levitsky
On Tue, 2019-07-16 at 14:41 +0200, Max Reitz wrote: > On 16.07.19 10:15, Maxim Levitsky wrote: > > preallocation=off and preallocation=metadata > > both allocate luks header only, and preallocation=falloc/full > > is passed to underlying file. > > > > F

Re: [Qemu-devel] [Qemu-block] [PATCH 5/7] file-posix: Drop hdev_co_create_opts()

2019-07-16 Thread Maxim Levitsky
drv_co_create_opts = hdev_co_create_opts, > -.create_opts = _create_opts, > .mutable_opts= mutable_opts, > .bdrv_co_invalidate_cache = raw_co_invalidate_cache, > > @@ -3659,8 +3594,6 @@ static BlockDriver bdrv_host_cdrom = { > .bdrv_reopen_prepare = raw_reopen_prepare, > .bdrv_reopen_commit = raw_reopen_commit, > .bdrv_reopen_abort = raw_reopen_abort, > -.bdrv_co_create_opts = hdev_co_create_opts, > -.create_opts= _create_opts, > .mutable_opts = mutable_opts, > > .bdrv_co_preadv = raw_co_preadv, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH 4/7] block: Generic file creation fallback

2019-07-16 Thread Maxim Levitsky
opts) { > -error_setg(errp, "Protocol driver '%s' does not support image > creation", > - proto_drv->format_name); > -return; > -} > - > create_opts = qemu_opts_append(create_opts, drv->create_opts); > -

Re: [Qemu-devel] [Qemu-block] [PATCH 3/7] block: Use blk_truncate_for_formatting()

2019-07-16 Thread Maxim Levitsky
rv_qed_co_create(BlockdevCreateOptions *opts, > l1_size = header.cluster_size * header.table_size; > > /* File must start empty and grow, check truncate is supported */ > -ret = blk_truncate(blk, 0, PREALLOC_MODE_OFF, errp); > +ret = blk_truncate_for_formatting(blk, 0, errp); > if (ret < 0) { > goto out; > } Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH 1/7] block/nbd: Fix hang in .bdrv_close()

2019-07-16 Thread Maxim Levitsky
ueue_wakeup) Since we instead do aio_poll, that never happens. The patch itself looks fine, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky > > Suggested-by: Kevin Wolf > Signed-off-by: Max Reitz > --- > block/nbd.c | 14 +- > 1 file changed, 13

Re: [Qemu-devel] [Qemu-block] [PATCH 6/7] iscsi: Drop iscsi_co_create_opts()

2019-07-16 Thread Maxim Levitsky
.bdrv_close = iscsi_close, > -.bdrv_co_create_opts= iscsi_co_create_opts, > -.create_opts= _create_opts, > .bdrv_reopen_prepare= iscsi_reopen_prepare, > .bdrv_reopen_commit = iscsi_reopen_commit, > .bdrv_co_invalidate_cache = iscsi_co_invalidate_cache, Well, in theory the original code did not zero the first sector, like what the generic code will do now, but this is OK due to the same reasons the original zeroing code was added. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH 2/7] block: Add blk_truncate_for_formatting()

2019-07-16 Thread Maxim Levitsky
size or it can accept truncate ending up in bigger file that it asked for. As we once discussed on IRC, the fact that truncate on a block device 'succeeds', despite not really beeing able to change the block device size, causes other issues, like not beeing able to use preallocation=full when c

[Qemu-devel] [PATCH v4 2/3] block/nvme: support larger that 512 bytes sector devices

2019-07-16 Thread Maxim Levitsky
Currently the driver hardcodes the sector size to 512, and doesn't check the underlying device. Fix that. Also fail if underlying nvme device is formatted with metadata as this needs special support. Signed-off-by: Maxim Levitsky --- block/nvme.c | 45

[Qemu-devel] [PATCH v4 3/3] block/nvme: don't touch the completion entries

2019-07-16 Thread Maxim Levitsky
Completion entries are meant to be only read by the host and written by the device. The driver is supposed to scan the completions from the last point where it left, and until it sees a completion with non flipped phase bit. Signed-off-by: Maxim Levitsky Reviewed-by: Max Reitz --- block

Re: [Qemu-devel] [H v5 0/3] Few bugfixes for userspace nvme driver

2019-07-16 Thread Maxim Levitsky
On Tue, 2019-07-16 at 19:29 +0300, Maxim Levitsky wrote: > This is reduced version of patch series for userspace nvme driver, > that only includes the bugfixes I made. > > Best regards, > Maxim Levitsky > > Maxim Levitsky (3): > block/nvme: fix doorbell stride

[Qemu-devel] [H v5 0/3] Few bugfixes for userspace nvme driver

2019-07-16 Thread Maxim Levitsky
This is reduced version of patch series for userspace nvme driver, that only includes the bugfixes I made. Best regards, Maxim Levitsky Maxim Levitsky (3): block/nvme: fix doorbell stride block/nvme: support larger that 512 bytes sector devices block/nvme: don't touch

[Qemu-devel] [PATCH v5] LUKS: support preallocation

2019-07-16 Thread Maxim Levitsky
preallocation=off and preallocation=metadata both allocate luks header only, and preallocation=falloc/full is passed to underlying file. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534951 Signed-off-by: Maxim Levitsky --- This is hopefully a revision without coding style violations

[Qemu-devel] [PATCH v4 1/3] block/nvme: fix doorbell stride

2019-07-16 Thread Maxim Levitsky
Fix the math involving non standard doorbell stride Signed-off-by: Maxim Levitsky Reviewed-by: Max Reitz --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 9896b7f7c6..82fdefccd6 100644 --- a/block/nvme.c +++ b/block/nvme.c

[Qemu-devel] [PATCH v4 0/3] Few bugfixes for userspace nvme driver

2019-07-16 Thread Maxim Levitsky
This is reduced version of patch series for userspace nvme driver, that only includes the bugfixes I made. Best regards, Maxim Levitsky Maxim Levitsky (3): block/nvme: fix doorbell stride block/nvme: support larger that 512 bytes sector devices block/nvme: don't touch

Re: [Qemu-devel] [Qemu-block] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow

2019-06-27 Thread Maxim Levitsky
ader.version == 3) { > +error_append_hint(errp, "Try the 'qcow2' driver instead."); > + } > + > ret = -ENOTSUP; > goto fail; > } Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [Qemu-block] [PATCH 2/2] qapi: deprecate implicit filters

2019-08-14 Thread Maxim Levitsky
ago; do we want to amend the QAPI > schema specification to allow commands to return with "Warning" strings, > or "Deprecated" stings to allow in-band deprecation notices for cases > like these? > > example: > > { "return": {}, > "deprecated": True, > "warning": "Omitting filter-node-name parameter is deprecated, it will > be required in the future" > } > > There's no "error" key, so this should be recognized as success by > compatible clients, but they'll definitely see the extra information. > > Part of my motivation is to facilitate a more aggressive deprecation of > legacy features by ensuring that we are able to rigorously notify users > through any means that they need to adjust their scripts. > > --js > This is a very good idea IMHO. Best regards, Maxim Levitsky

[Qemu-devel] [PATCH 09/13] qcrypto-luks: implement the encryption key management

2019-08-14 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 374 +++- 1 file changed, 373 insertions(+), 1 deletion(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 1997e92fe1..2c33643b52 100644 --- a/crypto/block-luks.c +++ b/crypto/block

[Qemu-devel] [PATCH 05/13] qcrypto-luks: clear the masterkey and password before freeing them always

2019-08-14 Thread Maxim Levitsky
While there are other places where these are still stored in memory, this is still one less key material area that can be sniffed with various side channel attacks Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 52 ++--- 1 file changed, 44

[Qemu-devel] [PATCH 12/13] qemu-img: implement key management

2019-08-14 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/crypto.c | 16 ++ block/crypto.h | 3 + qemu-img-cmds.hx | 13 + qemu-img.c | 140 +++ 4 files changed, 172 insertions(+) diff --git a/block/crypto.c b/block/crypto.c index 415b6db041

[Qemu-devel] [PATCH 10/13] block/crypto: implement the encryption key management

2019-08-14 Thread Maxim Levitsky
, we have it, and should use it instead. Signed-off-by: Maxim Levitsky --- block/crypto.c | 96 -- 1 file changed, 93 insertions(+), 3 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index 42a3f0898b..415b6db041 100644 --- a/block/crypto.c

[Qemu-devel] [PATCH 11/13] block/qcow2: implement the encryption key managment

2019-08-14 Thread Maxim Levitsky
This is the main purpose of the patchset, to enaable us to manage luks like header, embedded in the qcow2 image, which standard cryptosetup tools don't support. Signed-off-by: Maxim Levitsky --- block/qcow2.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/block

[Qemu-devel] [PATCH 13/13] iotests : add tests for encryption key management

2019-08-14 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- tests/qemu-iotests/257 | 197 ++ tests/qemu-iotests/257.out | 96 +++ tests/qemu-iotests/258 | 95 +++ tests/qemu-iotests/258.out | 30 + tests/qemu-iotests/259

Re: [Qemu-devel] [PATCH 00/13] RFC: luks/encrypted qcow2 key management

2019-08-15 Thread Maxim Levitsky
On Thu, 2019-08-15 at 16:18 +0200, Markus Armbruster wrote: > Kevin Wolf writes: > > > Am 14.08.2019 um 23:08 hat Eric Blake geschrieben: > > > On 8/14/19 3:22 PM, Maxim Levitsky wrote: > > > > > > > This is an issue that was raised today on I

Re: [Qemu-devel] [PATCH 00/13] RFC: luks/encrypted qcow2 key management

2019-08-15 Thread Maxim Levitsky
On Wed, 2019-08-14 at 16:08 -0500, Eric Blake wrote: > On 8/14/19 3:22 PM, Maxim Levitsky wrote: > > > This is an issue that was raised today on IRC with Kevin Wolf. Really thanks > > for the idea! > > > > We agreed that this new qmp interface should take the same

[Qemu-devel] [PATCH 00/13] RFC: luks/encrypted qcow2 key management

2019-08-14 Thread Maxim Levitsky
to add. Best regards, Maxim Levitsky Maxim Levitsky (13): block-crypto: misc refactoring qcrypto-luks: misc refactoring qcrypto-luks: refactoring: extract load/store/check/parse header functions qcrypto-luks: refactoring: simplify the math used for keyslot locations qcrypto

[Qemu-devel] [PATCH 01/13] block-crypto: misc refactoring

2019-08-14 Thread Maxim Levitsky
* rename the write_func to create_write_func, and init_func to create_init_func this is preparation for other write_func that will be used to update the encryption keys. No functional changes Signed-off-by: Maxim Levitsky --- block/crypto.c | 15 --- 1 file changed, 8

[Qemu-devel] [PATCH 06/13] qcrypto-luks: implement more rigorous header checking

2019-08-14 Thread Maxim Levitsky
Check that keyslots don't overlap with the data, and check that keyslots don't overlap with each other. (this is done using naive O(n^2) nested loops, but since there are just 8 keyslots, this doens't really matter. Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 42

[Qemu-devel] [PATCH 07/13] block: add manage-encryption command (qmp and blockdev)

2019-08-14 Thread Maxim Levitsky
BlockDriverState and not BdrvChild, for the ease of use from the qmp code. It is not expected that this function will be used by anything but qmp and qemu-img code Signed-off-by: Maxim Levitsky --- block/block-backend.c | 9 block/io.c | 24

[Qemu-devel] [PATCH 02/13] qcrypto-luks: misc refactoring

2019-08-14 Thread Maxim Levitsky
in the QCryptoBlockLUKS Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 213 ++-- 1 file changed, 105 insertions(+), 108 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 409ab50f20..48213abde7 100644 --- a/crypto/block-luks.c +++ b

[Qemu-devel] [PATCH 03/13] qcrypto-luks: refactoring: extract load/store/check/parse header functions

2019-08-14 Thread Maxim Levitsky
is no longer endian swapped in place, to prevent (mostly theoretical races I think) races where someone could see the header in the process of beeing byteswapped. Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 756 ++-- 1 file changed, 440

[Qemu-devel] [PATCH 08/13] qcrypto: add the plumbing for encryption management

2019-08-14 Thread Maxim Levitsky
This adds qcrypto_block_manage_encryption, which is thin wrapper around manage_encryption of the crypto driver which is also added Signed-off-by: Maxim Levitsky --- crypto/block.c | 29 + crypto/blockpriv.h | 9 + include/crypto/block.h | 27

[Qemu-devel] [PATCH 04/13] qcrypto-luks: refactoring: simplify the math used for keyslot locations

2019-08-14 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 64 +++-- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 6bb369f3b4..e1a4df94b7 100644 --- a/crypto/block-luks.c +++ b/crypto/block

Re: [Qemu-devel] [Qemu-block] [PATCH 02/13] qcrypto-luks: misc refactoring

2019-08-19 Thread Maxim Levitsky
On Thu, 2019-08-15 at 17:40 -0400, John Snow wrote: > > On 8/14/19 4:22 PM, Maxim Levitsky wrote: > > This is also a preparation for key read/write/erase functions > > > > This is a matter of taste and I am not usually reviewing LUKS patches > (So don't take me

Re: [Qemu-devel] [PATCH 00/13] RFC: luks/encrypted qcow2 key management

2019-08-19 Thread Maxim Levitsky
On Thu, 2019-08-15 at 10:00 -0500, Eric Blake wrote: > On 8/15/19 9:44 AM, Maxim Levitsky wrote: > > > > > > Does the idea of a union type with a default value for the > > > > > discriminator > > > > > help? Maybe we have a discrim

Re: [Qemu-devel] [PATCH 02/13] qcrypto-luks: misc refactoring

2019-08-21 Thread Maxim Levitsky
On Tue, 2019-08-20 at 19:36 +0200, Max Reitz wrote: > On 14.08.19 22:22, Maxim Levitsky wrote: > > This is also a preparation for key read/write/erase functions > > > > * use master key len from the header > > * prefer to use crypto params in the QCryptoBlockL

Re: [Qemu-devel] [PATCH 05/13] qcrypto-luks: clear the masterkey and password before freeing them always

2019-08-21 Thread Maxim Levitsky
On Tue, 2019-08-20 at 20:12 +0200, Max Reitz wrote: > On 14.08.19 22:22, Maxim Levitsky wrote: > > While there are other places where these are still stored in memory, > > this is still one less key material area that can be sniffed with > > various side channel attacks >

Re: [Qemu-devel] [PATCH 00/13] RFC: luks/encrypted qcow2 key management

2019-08-21 Thread Maxim Levitsky
On Tue, 2019-08-20 at 19:59 +0200, Max Reitz wrote: > On 14.08.19 22:22, Maxim Levitsky wrote: > > [...] > > > Testing. This was lightly tested with manual testing and with few iotests > > that I prepared. > > I haven't yet tested fully the write sharing behavior

Re: [Qemu-devel] [PATCH 01/13] block-crypto: misc refactoring

2019-08-21 Thread Maxim Levitsky
On Tue, 2019-08-20 at 18:38 +0200, Max Reitz wrote: > On 14.08.19 22:22, Maxim Levitsky wrote: > > * rename the write_func to create_write_func, > > and init_func to create_init_func > > this is preparation for other write_func that will > > be used to

  1   2   3   4   5   6   7   8   9   10   >