Re: [Qemu-block] Virtio-BLK/SCSI write requests and data payload checksums

2019-01-11 Thread Peter Lieven
> Am 11.01.2019 um 08:14 schrieb Vadim Rozenfeld : > >> On Thu, 2019-01-10 at 14:57 +0100, Peter Lieven wrote: >>> Am 18.12.18 um 15:45 schrieb Peter Lieven: Am 18.12.18 um 14:15 schrieb Vadim Rozenfeld: Peter, I must be missing something here, but what exactly the problem i

Re: [Qemu-block] [PATCH v3 0/6] include: Auto-generate the sizes lookup table

2019-01-11 Thread Kevin Wolf
Am 10.01.2019 um 20:18 hat Eric Blake geschrieben: > Patches speak louder than words. This is my counter-proposal to > Leonid's thread on how best to respresent the S_*iB macros in units.h, > where my proposal is that we don't need them at all. (hence my subject > line, even though it is completel

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
11.01.2019 10:54, Vladimir Sementsov-Ogievskiy wrote: > 10.01.2019 23:51, Eric Blake wrote: >> On 1/10/19 7:20 AM, Vladimir Sementsov-Ogievskiy wrote: >>> drv_co_block_status digs bs->file for additional, more accurate search >>> for hole inside region, reported as DATA by bs since 5daa74a6ebc. >>

Re: [Qemu-block] [PATCH v3 2/6] block: Take advantage of QemuOpt default integers

2019-01-11 Thread Kevin Wolf
Am 10.01.2019 um 20:18 hat Eric Blake geschrieben: > Instead of defining an integer to a default string value (where we > have to be careful how we spelled the integer because of the use of > stringify), populate a default integer value instead. > > Drop a useless stringify(0); a missing default i

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Kevin Wolf
Am 10.01.2019 um 14:20 hat Vladimir Sementsov-Ogievskiy geschrieben: > drv_co_block_status digs bs->file for additional, more accurate search > for hole inside region, reported as DATA by bs since 5daa74a6ebc. > > This accuracy is not free: assume we have qcow2 disk. Actually, qcow2 > knows, where

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
11.01.2019 13:41, Kevin Wolf wrote: > Am 10.01.2019 um 14:20 hat Vladimir Sementsov-Ogievskiy geschrieben: >> drv_co_block_status digs bs->file for additional, more accurate search >> for hole inside region, reported as DATA by bs since 5daa74a6ebc. >> >> This accuracy is not free: assume we have q

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Kevin Wolf
Am 11.01.2019 um 12:40 hat Vladimir Sementsov-Ogievskiy geschrieben: > 11.01.2019 13:41, Kevin Wolf wrote: > > Am 10.01.2019 um 14:20 hat Vladimir Sementsov-Ogievskiy geschrieben: > >> drv_co_block_status digs bs->file for additional, more accurate search > >> for hole inside region, reported as DA

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
11.01.2019 15:21, Kevin Wolf wrote: > Am 11.01.2019 um 12:40 hat Vladimir Sementsov-Ogievskiy geschrieben: >> 11.01.2019 13:41, Kevin Wolf wrote: >>> Am 10.01.2019 um 14:20 hat Vladimir Sementsov-Ogievskiy geschrieben: drv_co_block_status digs bs->file for additional, more accurate search

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Kevin Wolf
Am 11.01.2019 um 13:59 hat Vladimir Sementsov-Ogievskiy geschrieben: > 11.01.2019 15:21, Kevin Wolf wrote: > > Am 11.01.2019 um 12:40 hat Vladimir Sementsov-Ogievskiy geschrieben: > >> 11.01.2019 13:41, Kevin Wolf wrote: > >>> Am 10.01.2019 um 14:20 hat Vladimir Sementsov-Ogievskiy geschrieben: > >

Re: [Qemu-block] [PATCH] throttle-groups: fix restart coroutine iothread race

2019-01-11 Thread Kevin Wolf
Am 11.01.2019 um 14:19 hat Alberto Garcia geschrieben: > On Wed 09 Jan 2019 04:34:10 PM CET, Alberto Garcia wrote: > > On Wed 09 Jan 2019 12:01:44 PM CET, Stefan Hajnoczi wrote: > >> The following QMP command leads to a crash when iothreads are used: > >> > >> { 'execute': 'device_del', 'argument

Re: [Qemu-block] [PATCH] throttle-groups: fix restart coroutine iothread race

2019-01-11 Thread Alberto Garcia
On Wed 09 Jan 2019 04:34:10 PM CET, Alberto Garcia wrote: > On Wed 09 Jan 2019 12:01:44 PM CET, Stefan Hajnoczi wrote: >> The following QMP command leads to a crash when iothreads are used: >> >> { 'execute': 'device_del', 'arguments': {'id': 'data'} } > > How did you reproduce this? Do you have

Re: [Qemu-block] [Qemu-devel] [PATCH 0/6] Acquire the AioContext during _realize()

2019-01-11 Thread Markus Armbruster
For what it's worth, this series seems to fix assertion failures related to AioContext acquire/release I've seen.

Re: [Qemu-block] [PATCH] throttle-groups: fix restart coroutine iothread race

2019-01-11 Thread Alberto Garcia
On Fri 11 Jan 2019 02:24:16 PM CET, Kevin Wolf wrote: >> >> The following QMP command leads to a crash when iothreads are used: >> >> >> >> { 'execute': 'device_del', 'arguments': {'id': 'data'} } >> > >> > How did you reproduce this? Do you have a test case? >> >> Ok, I finally reproduced it, t

Re: [Qemu-block] [PATCH v3 1/6] qemu-option: Allow integer defaults

2019-01-11 Thread Leonid Bloch
On 1/10/19 9:18 PM, Eric Blake wrote: > Set the framework up for declaring integer options with an integer > default, instead of our current insane approach of requiring the > default value to be given as a string (which then has to be reparsed > at every use that wants a number). git grep '[^.]de

[Qemu-block] [RFC PATCH 15/15] ui/console: Add "ui/pixelformat.h" to declare PixelFormat

2019-01-11 Thread Philippe Mathieu-Daudé
PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". Create the new header "ui/pixelformat.h" to declare this structure, and remove the forward declaration from "qemu/typedefs.h". Signed-off-by: Philippe Mathieu-Daudé --- RFC because "ui/console.h" has on license, so I added a defaul

[Qemu-block] [PATCH 11/15] audio: Remove AudioState from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring AudioState already include "audio_int.h". To clean "qemu/typedefs.h", move the declaration to "audio_int.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- audio/audio_int.h | 4 ++-- include/qemu/typedefs.h | 1 - 2 files changed, 2 insertion

[Qemu-block] [PATCH 12/15] ui/console: Remove MouseTransformInfo from qemu/typedefs.h

2019-01-11 Thread Philippe Mathieu-Daudé
MouseTransformInfo is only used in "ui/console.h", there is no need to expose it via "qemu/typedefs.h". Move the declaration to "ui/console.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/devices.h| 1 + include/qemu/typedefs.h | 1 - include/ui/c

[Qemu-block] [PATCH 13/15] ui/console: Remove QemuDmaBuf from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring QemuDmaBuf already include "ui/console.h". To clean "qemu/typedefs.h", move the declaration to "ui/console.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/typedefs.h | 1 - include/ui/console.h| 4 ++-- 2 files changed, 2 inserti

[Qemu-block] [PATCH 10/15] range: Remove Range from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Range is only used in "hw/pci-host/q35.h" in the MCHPCIState, and in "hw/pci/pci.h" by pci_bus_get_w64_range(). Let them include "qemu/range.h" directly to simplify "qemu/typedefs.h". To clean "qemu/typedefs.h", move the declaration to "qemu/range.h" (removing the forward declaration). Signed-of

[Qemu-block] [PATCH 07/15] hw/bt: Remove HCIInfo from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring HCIInfo already include "sysemu/bt.h". To clean "qemu/typedefs.h", move the declaration to "sysemu/bt.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/typedefs.h | 1 - include/sysemu/bt.h | 4 ++-- 2 files changed, 2 insertions(+

[Qemu-block] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé There are only three files requiring this typedef, let them include "hw/ssi/ssi.h" directly to simplify "qemu/typedefs.h". To clean "qemu/typedefs.h", move the forward declaration to "hw/ssi/ssi.h". Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/strongarm.h

[Qemu-block] [PATCH 08/15] hw/char/serial: Remove SerialState from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring SerialState already include "hw/char/serial.h". To clean "qemu/typedefs.h", move the declaration to "hw/char/serial.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/char/serial.h | 4 ++-- include/qemu/typedefs.h | 1 - 2 files changed

[Qemu-block] [PATCH 09/15] hw/i386: Remove PCMachineClass from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring PCMachineClass already include "hw/i386/pc.h". To clean "qemu/typedefs.h", move the declaration to "hw/i386/pc.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h| 4 ++-- include/qemu/typedefs.h | 1 - 2 files changed, 2 ins

[Qemu-block] [PATCH 14/15] ui/console: Remove DisplayState/DisplaySurface from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring DisplayState/DisplaySurface already include "ui/console.h". To clean "qemu/typedefs.h", move the declarations to "ui/console.h" (removing DisplaySurface forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/typedefs.h | 2 -- include/ui/console.h| 6 ++

[Qemu-block] [PATCH 06/15] hw/i2c/smbus: Remove SMBusDevice from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
Files requiring SMBusDevice already include "hw/i2c/smbus.h". To clean "qemu/typedefs.h", move the forward declaration to "hw/i2c/smbus.h". Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i2c/smbus.h | 2 ++ include/qemu/typedefs.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) d

[Qemu-block] [PATCH RESEND 00/15] typedefs: Remove scarcely used declarations

2019-01-11 Thread Philippe Mathieu-Daudé
Hi, Since this file became a hot topic [*], I took previous cleanups from last year and continue to clean it. Regards, Phil. [*] "HACKING: Clarify the paragraph about typedefs" https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02132.html [*] "Fix duplicated typedefs to be able to compile

[Qemu-block] [PATCH 04/15] hw/ide/ahci: Remove AllwinnerAHCIState from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé Files requiring AllwinnerAHCIState already include "hw/ide/ahci.h". To clean "qemu/typedefs.h", move the declaration to "hw/ide/ahci.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 4 ++-- include/qemu/typ

[Qemu-block] [PATCH 02/15] hw/pcmcia: Remove PCMCIACardState from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé There is only one file requiring this typedef (hw/arm/pxa.h), let it include "hw/pcmcia.h" directly to simplify "qemu/typedefs.h". To clean "qemu/typedefs.h", move the declaration to "hw/pcmcia.h" (removing the forward declaration). Signed-off-by: Philippe Mathieu-D

[Qemu-block] [PATCH 05/15] hw/nvram/fw_cfg: Remove various typedefs from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
There are only three files requiring these typedefs, let them include "hw/nvram/fw_cfg.h" directly to simplify "qemu/typedefs.h". To clean "qemu/typedefs.h", move the forward declarations to "hw/nvram/fw_cfg.h". Signed-off-by: Philippe Mathieu-Daudé --- include/hw/acpi/vmgenid.h | 1 + include/

[Qemu-block] [PATCH 01/15] hw/input/ps2: Remove PS2State from "qemu/typedefs.h"

2019-01-11 Thread Philippe Mathieu-Daudé
PS2State is only used in "hw/input/ps2.h", there is no need to expose it via "qemu/typedefs.h". To clean "qemu/typedefs.h", move the forward declaration to "hw/input/ps2.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- include/hw/input/ps2.h | 2 ++ include/qemu/typedefs

[Qemu-block] [PATCH 00/33] typedefs: Remove scarcely used declarations

2019-01-11 Thread Philippe Mathieu-Daudé
Hi, Since this file became a hot topic [*], I took previous cleanups from last year and continue to clean it. Regards, Phil. [*] "HACKING: Clarify the paragraph about typedefs" https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02132.html [*] "Fix duplicated typedefs to be able to compile

Re: [Qemu-block] [PATCH] throttle-groups: fix restart coroutine iothread race

2019-01-11 Thread Paolo Bonzini
On 09/01/19 12:01, Stefan Hajnoczi wrote: > g_free(data); > + > +tgm->restart_pending--; > +aio_wait_kick(); > } > > static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool > is_write) > @@ -430,6 +433,8 @@ static void > throttle_group_restart_queue(ThrottleGroupM

Re: [Qemu-block] [PATCH v3 1/3] blkdebug: fix one shot rule processing

2019-01-11 Thread Max Reitz
On 12.11.18 08:06, Marc Olson wrote: > If 'once' is specified, the rule should execute just once, regardless if > it is supposed to return an error or not. Take the example where you > want the first IO to an LBA to succeed, but subsequent IOs to fail. You > could either use state transitions, or c

Re: [Qemu-block] [PATCH 00/33] typedefs: Remove scarcely used declarations

2019-01-11 Thread Philippe Mathieu-Daudé
On 1/11/19 3:04 PM, Philippe Mathieu-Daudé wrote: > Hi, > > Since this file became a hot topic [*], I took previous cleanups > from last year and continue to clean it. > > Regards, > > Phil. > > [*] "HACKING: Clarify the paragraph about typedefs" > https://lists.gnu.org/archive/html/qemu-devel/

Re: [Qemu-block] [PATCH v3 2/3] blkdebug: Extend rule check for additional types

2019-01-11 Thread Max Reitz
On 12.11.18 08:06, Marc Olson wrote: > Break out the more common parts of the BlkdebugRule struct, and make > rule_check() more explicit about operating only on error injection types > so that additional rule types can be added in the future. > > Signed-off-by: Marc Olson > --- > block/blkdebug.

Re: [Qemu-block] [PATCH v3 3/3] blkdebug: Add latency injection rule type

2019-01-11 Thread Max Reitz
On 12.11.18 08:06, Marc Olson wrote: > Add a new rule type for blkdebug that instead of returning an error, can > inject latency to an IO. > > Signed-off-by: Marc Olson > --- > block/blkdebug.c | 79 > +++--- > docs/devel/blkdebug.txt| 35 ++

Re: [Qemu-block] [PATCH 2/6] block: Acquire the AioContext in scsi_*_realize()

2019-01-11 Thread Kevin Wolf
Am 10.01.2019 um 16:03 hat Alberto Garcia geschrieben: > This fixes the following crash: > > { "execute": "blockdev-add", > "arguments": {"driver": "null-co", "node-name": "hd0"}} > { "execute": "object-add", > "arguments": {"qom-type": "iothread", "id": "iothread0"}} > { "execute": "x-blockde

Re: [Qemu-block] [PATCH 2/6] block: Acquire the AioContext in scsi_*_realize()

2019-01-11 Thread Alberto Garcia
On Fri 11 Jan 2019 04:02:13 PM CET, Kevin Wolf wrote: >> @@ -2568,7 +2579,10 @@ static void scsi_block_realize(SCSIDevice *dev, Error >> **errp) >> } >> >> /* check we are using a driver managing SG_IO (version 3 and after) */ >> +ctx = blk_get_aio_context(s->qdev.conf.blk); >> +

Re: [Qemu-block] [PATCH 0/6] Acquire the AioContext during _realize()

2019-01-11 Thread Kevin Wolf
Am 10.01.2019 um 16:03 hat Alberto Garcia geschrieben: > As discussed yesterday, this series acquires the AioContext in the > _realize() functions of several devices before making use of their > block backends. This fixes at least a couple of crashes (in virtio-blk > and scsi). Apart from the inco

Re: [Qemu-block] [PATCH 0/6] Acquire the AioContext during _realize()

2019-01-11 Thread Alberto Garcia
On Fri 11 Jan 2019 04:09:17 PM CET, Kevin Wolf wrote: > Am 10.01.2019 um 16:03 hat Alberto Garcia geschrieben: >> As discussed yesterday, this series acquires the AioContext in the >> _realize() functions of several devices before making use of their >> block backends. This fixes at least a couple

Re: [Qemu-block] [PATCH 2/6] block: Acquire the AioContext in scsi_*_realize()

2019-01-11 Thread Kevin Wolf
Am 11.01.2019 um 16:05 hat Alberto Garcia geschrieben: > On Fri 11 Jan 2019 04:02:13 PM CET, Kevin Wolf wrote: > >> @@ -2568,7 +2579,10 @@ static void scsi_block_realize(SCSIDevice *dev, > >> Error **errp) > >> } > >> > >> /* check we are using a driver managing SG_IO (version 3 and af

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/1] include: Auto-generate the sizes lookup table

2019-01-11 Thread Eric Blake
On 1/11/19 1:50 AM, Markus Armbruster wrote: >>> We have 54 of them. I count six uses: >>> >>> block/qcow2.h:#define QCOW_MAX_REFTABLE_SIZE S_8MiB >>> block/qcow2.h:#define QCOW_MAX_L1_SIZE S_32MiB >>> block/qcow2.h:#define DEFAULT_L2_CACHE_MAX_SIZE S_32MiB >>> block/qcow2.h:#

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Eric Blake
On 1/11/19 1:54 AM, Vladimir Sementsov-Ogievskiy wrote: >> >> How much performance can we buy back without any knobs at all, if we >> just taught posix-file.c to cache lseek() results? That is, when >> visiting a file sequentially, if lseek(fd, 0, SEEK_HOLE) returns EOF on >> our first block stat

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Eric Blake
On 1/11/19 10:02 AM, Eric Blake wrote: > Even a dumb most-recent use cache will speed this up: both the second > and third queries above can be avoided because we know that both 0x4 > and 0x3 the second query at 0x4 can be skipped (0x4 is > between our most recent lseek at 0x2

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
11.01.2019 16:15, Kevin Wolf wrote: > Am 11.01.2019 um 13:59 hat Vladimir Sementsov-Ogievskiy geschrieben: >> 11.01.2019 15:21, Kevin Wolf wrote: >>> Am 11.01.2019 um 12:40 hat Vladimir Sementsov-Ogievskiy geschrieben: 11.01.2019 13:41, Kevin Wolf wrote: > Am 10.01.2019 um 14:20 hat Vladim

Re: [Qemu-block] [PATCH v3 1/6] qemu-option: Allow integer defaults

2019-01-11 Thread Eric Blake
On 1/11/19 8:14 AM, Leonid Bloch wrote: > On 1/10/19 9:18 PM, Eric Blake wrote: >> Set the framework up for declaring integer options with an integer >> default, instead of our current insane approach of requiring the >> default value to be given as a string (which then has to be reparsed >> at eve

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
11.01.2019 19:02, Eric Blake wrote: > On 1/11/19 1:54 AM, Vladimir Sementsov-Ogievskiy wrote: > >>> >>> How much performance can we buy back without any knobs at all, if we >>> just taught posix-file.c to cache lseek() results? That is, when >>> visiting a file sequentially, if lseek(fd, 0, SEEK_

Re: [Qemu-block] [PATCH 05/15] hw/nvram/fw_cfg: Remove various typedefs from "qemu/typedefs.h"

2019-01-11 Thread Laszlo Ersek
On 01/11/19 15:08, Philippe Mathieu-Daudé wrote: > There are only three files requiring these typedefs, let them > include "hw/nvram/fw_cfg.h" directly to simplify "qemu/typedefs.h". > > To clean "qemu/typedefs.h", move the forward declarations > to "hw/nvram/fw_cfg.h". > > Signed-off-by: Philipp

Re: [Qemu-block] [PATCH v3 2/6] block: Take advantage of QemuOpt default integers

2019-01-11 Thread Eric Blake
On 1/11/19 4:38 AM, Kevin Wolf wrote: > Am 10.01.2019 um 20:18 hat Eric Blake geschrieben: >> Instead of defining an integer to a default string value (where we >> have to be careful how we spelled the integer because of the use of >> stringify), populate a default integer value instead. >> >> Drop

[Qemu-block] [PATCH] qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol

2019-01-11 Thread Philippe Mathieu-Daudé
The use of a variable named 'exp' prevents includes to import . Rename it to avoid: qemu-nbd.c:64:19: error: ‘exp’ redeclared as different kind of symbol static NBDExport *exp; ^~~ In file included from /usr/include/features.h:428, from /usr/include/

Re: [Qemu-block] [PATCH] qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol

2019-01-11 Thread Philippe Mathieu-Daudé
Cc'ing qemu-triv...@nongnu.org On Fri, Jan 11, 2019 at 5:35 PM Philippe Mathieu-Daudé wrote: > > The use of a variable named 'exp' prevents includes to import . > > Rename it to avoid: > > qemu-nbd.c:64:19: error: ‘exp’ redeclared as different kind of symbol >static NBDExport *exp; >

[Qemu-block] [PATCH] scsi-generic: avoid possible out-of-bounds access to r->buf

2019-01-11 Thread Paolo Bonzini
Whenever the allocation length of a SCSI request is shorter than the size of the VPD page list, page_idx is used blindly to index into r->buf. Even though the stores in the insertion sort are protected against overflows, the same is not true of the reads and the final store of 0xb0. This basical

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Eric Blake
On 1/11/19 10:09 AM, Vladimir Sementsov-Ogievskiy wrote: I suggested one: Pass large contiguous allocated ranges to the protocol driver, but just assume that the allocation status is correct in the format layer if they are small. >>> >>> So, for fully allocated image, we will call l

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Eric Blake
On 1/11/19 10:22 AM, Vladimir Sementsov-Ogievskiy wrote: >> Even a dumb most-recent use cache will speed this up: both the second >> and third queries above can be avoided because we know that both 0x4 >> and 0x3 the second query at 0x4 can be skipped (0x4 is >> between our most re

Re: [Qemu-block] [PATCH] qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol

2019-01-11 Thread Eric Blake
On 1/11/19 10:35 AM, Philippe Mathieu-Daudé wrote: > The use of a variable named 'exp' prevents includes to import . > > Rename it to avoid: > > qemu-nbd.c:64:19: error: ‘exp’ redeclared as different kind of symbol >static NBDExport *exp; > ^~~ > In file included from

Re: [Qemu-block] [PATCH] block: don't probe zeroes in bs->file by default on block_status

2019-01-11 Thread Vladimir Sementsov-Ogievskiy
On 11.01.2019 17:04, Eric Blake wrote: > On 1/11/19 10:09 AM, Vladimir Sementsov-Ogievskiy wrote: > > I suggested one: Pass large contiguous allocated ranges to the protocol > driver, but just assume that the allocation status is correct in the > format layer if they are small.

Re: [Qemu-block] [RFC PATCH 15/15] ui/console: Add "ui/pixelformat.h" to declare PixelFormat

2019-01-11 Thread Paolo Bonzini
On 11/01/19 15:08, Philippe Mathieu-Daudé wrote: > PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". ui/console.h already includes ui/qemu-pixman.h, just move it there? Paolo > Create the new header "ui/pixelformat.h" to declare this structure, > and remove the forward declaration

Re: [Qemu-block] [PATCH v6 01/11] blockdev: abort transactions in reverse order

2019-01-11 Thread Eric Blake
On 12/21/18 3:35 AM, John Snow wrote: > Presently, we abort transactions in the same order they were processed in. > Bitmap commands, though, attempt to restore backup data structures on abort. > > That's not valid, they need to be aborted in reverse chronological order. > > Replace the QSIMPLEQ

Re: [Qemu-block] [PATCH v3 1/6] qemu-option: Allow integer defaults

2019-01-11 Thread Leonid Bloch
On 1/11/19 6:23 PM, Eric Blake wrote: > On 1/11/19 8:14 AM, Leonid Bloch wrote: >> On 1/10/19 9:18 PM, Eric Blake wrote: >>> Set the framework up for declaring integer options with an integer >>> default, instead of our current insane approach of requiring the >>> default value to be given as a str

[Qemu-block] [PATCH 1/1] block: Eliminate the S_1KiB, S_2KiB, ... macros

2019-01-11 Thread Markus Armbruster
We define 54 macros for the powers of two >= 1024. We use six, in six macro definitions. Four of them could just as well use the common MiB macro, so do that. The remaining two can't, because they get passed to stringify. Replace the macro by the literal number there. Slightly harder to read in

[Qemu-block] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros

2019-01-11 Thread Markus Armbruster
Back in September, Leonid Block added a whole bunch of macros (commit 540b8492618) to improve readability of qcow2.h a bit (commit b6a95c6d100). He later used them to fix the "vdi" driver's parameter cluster_size's default value (commit 3dd5b8f4718). He has now proposed a further patch[1] to auto

Re: [Qemu-block] [PATCH 1/1] block: Eliminate the S_1KiB, S_2KiB, ... macros

2019-01-11 Thread Eric Blake
On 1/11/19 1:14 PM, Markus Armbruster wrote: > We define 54 macros for the powers of two >= 1024. We use six, in six > macro definitions. Four of them could just as well use the common MiB > macro, so do that. The remaining two can't, because they get passed > to stringify. Replace the macro by

Re: [Qemu-block] [PATCH v6 01/11] blockdev: abort transactions in reverse order

2019-01-11 Thread Eric Blake
On 1/11/19 11:52 AM, Eric Blake wrote: > On 12/21/18 3:35 AM, John Snow wrote: >> Presently, we abort transactions in the same order they were processed in. >> Bitmap commands, though, attempt to restore backup data structures on abort. >> >> That's not valid, they need to be aborted in reverse chr

[Qemu-block] [PATCH v3 1/8] nbd: Add some error case testing to iotests 223

2019-01-11 Thread Eric Blake
Testing success paths is important, but it's also nice to highlight expected failure handling, to show that we don't crash, and so that upcoming tests that change behavior can demonstrate the resulting effects on error paths. Add the following errors: Attempting to export without a running server

[Qemu-block] [PATCH v3 2/8] nbd: Forbid nbd-server-stop when server is not running

2019-01-11 Thread Eric Blake
Since we already forbid other nbd-server commands when not in the right state, it is unlikely that any caller was relying on a second stop to behave as a silent no-op. Update iotest 223 to show the improved behavior. Signed-off-by: Eric Blake --- v3: new patch --- blockdev-nbd.c |

[Qemu-block] [PATCH v3 0/8] Promote x-nbd-server-add-bitmap to stable

2019-01-11 Thread Eric Blake
Or rather, move its functionality into nbd-server-add. And as a side effect, teach qemu-nbd how to export a persistent bitmap without having to go through a qemu process and several QMP commands. Based-on: <20181221093529.23855-1-js...@redhat.com> [jsnow: 0/11 bitmaps: remove x- prefix from QMP a

[Qemu-block] [PATCH v3 7/8] nbd: Merge nbd_export_bitmap into nbd_export_new

2019-01-11 Thread Eric Blake
We only have one caller that wants to export a bitmap name, which it does right after creation of the export. But there is still a brief window of time where an NBD client could see the export but not the dirty bitmap, which a robust client would have to interpret as meaning the entire image should

[Qemu-block] [PATCH v3 6/8] nbd: Remove x-nbd-server-add-bitmap

2019-01-11 Thread Eric Blake
Now that nbd-server-add can do the same functionality (well, other than making the exported bitmap name different than the underlying bitamp - but we argued that was not essential, since it is just as easy to create a new non-persistent bitmap with the desired name), we no longer need the experimen

[Qemu-block] [PATCH v3 3/8] nbd: Only require disabled bitmap for read-only exports

2019-01-11 Thread Eric Blake
Our initial implementation of x-nbd-server-add-bitmap put in a restriction because of incremental backups: in that usage, we are exporting one qcow2 file (the temporary overlay target of a blockdev-backup sync:none job) and a dirty bitmap owned by a second qcow2 file (the source of the blockdev-bac

[Qemu-block] [PATCH v3 4/8] nbd: Merge nbd_export_set_name into nbd_export_new

2019-01-11 Thread Eric Blake
The existing NBD code had a weird split where nbd_export_new() created an export but did not add it to the list of exported names until a later nbd_export_set_name() came along and grabbed a second reference on the object; later, the first call to nbd_export_close() drops the second reference while

[Qemu-block] [PATCH v3 8/8] qemu-nbd: Add --bitmap=NAME option

2019-01-11 Thread Eric Blake
Having to fire up qemu, then use QMP commands for nbd-server-start and nbd-server-add, just to expose a persistent dirty bitmap, is rather tedious. Make it possible to expose a dirty bitmap using just qemu-nbd (of course, for now this only works when qemu-nbd is visiting a BDS formatted as qcow2).

[Qemu-block] [PATCH v3 5/8] nbd: Allow bitmap export during QMP nbd-server-add

2019-01-11 Thread Eric Blake
With the experimental x-nbd-server-add-bitmap command, there was a window of time where an NBD client could see the export but not the associated dirty bitmap, which can cause a client that planned on using the dirty bitmap to be forced to treat the entire image as dirty as a safety fallback. Furt

Re: [Qemu-block] [Qemu-devel] [PATCH v3 0/8] Promote x-nbd-server-add-bitmap to stable

2019-01-11 Thread Eric Blake
On 1/11/19 1:47 PM, Eric Blake wrote: > Or rather, move its functionality into nbd-server-add. And as > a side effect, teach qemu-nbd how to export a persistent bitmap > without having to go through a qemu process and several QMP > commands. > > Based-on: <20181221093529.23855-1-js...@redhat.com>

Re: [Qemu-block] [PATCH v2 07/22] qemu-nbd: Avoid strtol open-coding

2019-01-11 Thread Eric Blake
On 1/4/19 5:50 PM, Eric Blake wrote: >> hmm, as I understand, even if this compatibility exists, it's not a part >> of standard and nothing about off_t size in POSIX.. > > off_t allows you to run on older systems with 32-bit offsets and newer > systems with 64-bit offsets; but these days, even on