Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor()

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 22:10, Peter Maydell wrote: >> > The series looks good, but I'd prefer (especially for patch 4 which is >> > in a fast path) if pow2ceil and pow2floor were made inline. > Yeah, I was wondering if I was going to be asked to do that. > Note that qemu_fls() is/was *not* inline, though,

Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor()

2015-07-23 Thread Peter Maydell
On 23 July 2015 at 17:54, Paolo Bonzini wrote: > > > On 23/07/2015 13:08, Peter Maydell wrote: >> We have a qemu_fls() function which is just a silly wrapper >> around clz32() and which is used in only a handful of places >> in the codebase. It turns out that all of those are really >> trying to r

Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor()

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 13:08, Peter Maydell wrote: > We have a qemu_fls() function which is just a silly wrapper > around clz32() and which is used in only a handful of places > in the codebase. It turns out that all of those are really > trying to round up or down to a power of 2, which is something > we

Re: [Qemu-block] [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Markus Armbruster
Stefan Hajnoczi writes: > v3: > * Fix Patch 2 commit description because the mention of raw-posix.c ignored >Windows [Markus] > * Drop #ifdef CONFIG_LINUX_AIO from qemu-nbd.c No fishy uses of CONFIG_LINUX_AIO left. Series Reviewed-by: Markus Armbruster

Re: [Qemu-block] [PATCH RFC] virtio: set any_layout in virtio core

2015-07-23 Thread Michael S. Tsirkin
On Thu, Jul 23, 2015 at 04:14:36PM +0800, Jason Wang wrote: > > > On 07/22/2015 05:36 PM, Michael S. Tsirkin wrote: > > Virtio 1 requires this, > > I think you mean transitional not virtio 1? > > > and all devices are clean by now, > > so let's do it! > > > > Exceptions: > > - virtio-blk >

Re: [Qemu-block] [Qemu-devel] [PATCH RFC] virtio: set any_layout in virtio core

2015-07-23 Thread Michael S. Tsirkin
On Thu, Jul 23, 2015 at 12:15:22PM +0200, Christian Borntraeger wrote: > Am 22.07.2015 um 11:36 schrieb Michael S. Tsirkin: > > Virtio 1 requires this, and all devices are clean by now, > > so let's do it! > > > > Exceptions: > > - virtio-blk > > - compat machine types > > Is this targett

[Qemu-block] [PATCH v3 3/3] qemu-nbd: always compile in --aio=MODE option

2015-07-23 Thread Stefan Hajnoczi
The --aio=MODE option enables Linux AIO or Windows overlapped I/O. The #ifdef CONFIG_LINUX_AIO was a layering violation that also prevented Windows overlapped I/O from being used. Now that raw-posix.c prints an error when Linux AIO has not been compiled in, we can unconditionally compile the opti

[Qemu-block] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

2015-07-23 Thread Stefan Hajnoczi
raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without libaio. Print a deprecation warning if -drive aio=native is used with a binary that does not support li

[Qemu-block] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Stefan Hajnoczi
v3: * Fix Patch 2 commit description because the mention of raw-posix.c ignored Windows [Markus] * Drop #ifdef CONFIG_LINUX_AIO from qemu-nbd.c v2: * Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's business [Kevin] * Print the warning in the same way as the aio=native,cach

[Qemu-block] [PATCH v3 2/3] blockdev: always compile in -drive aio= parsing

2015-07-23 Thread Stefan Hajnoczi
CONFIG_LINUX_AIO is an implementation detail of raw-posix.c. Don't mention CONFIG_LINUX_AIO in blockdev.c. Let block drivers decide what to do with BDRV_O_NATIVE_AIO. They may print an error if it is unsupported. Signed-off-by: Stefan Hajnoczi --- blockdev.c | 2 -- 1 file changed, 2 deletion

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/2] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Stefan Hajnoczi
On Thu, Jul 23, 2015 at 10:03:32AM +0200, Markus Armbruster wrote: > Stefan Hajnoczi writes: > > > v2: > > * Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's business > >[Kevin] > > * Print the warning in the same way as the aio=native,cache.direct=off > >deprecation warni

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

2015-07-23 Thread Kevin Wolf
Am 23.07.2015 um 12:09 hat Christian Borntraeger geschrieben: > Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi: > > raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable. > > It is confusing when aio=native performance is identical to aio=threads > > because the binary was acciden

Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane

2015-07-23 Thread Fam Zheng
On Thu, 07/23 10:15, Paolo Bonzini wrote: > > > On 23/07/2015 08:32, Fam Zheng wrote: > > > > What is realized in this series is similar except the "disable, poll, > > enable" > > method, instead the bit mask of interesting client types is passed to > > aio_poll() (to be exact, passed to aio_po

[Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor()

2015-07-23 Thread Peter Maydell
We have a qemu_fls() function which is just a silly wrapper around clz32() and which is used in only a handful of places in the codebase. It turns out that all of those are really trying to round up or down to a power of 2, which is something we have utility functions for. This series replaces all

[Qemu-block] [PATCH 2/5] hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation

2015-07-23 Thread Peter Maydell
Use the utility function pow2ceil() for rounding up to the next largest power of 2, rather than inline calculation. Signed-off-by: Peter Maydell --- hw/virtio/virtio-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index

[Qemu-block] [PATCH 4/5] exec.c: Use pow2floor() rather than hand-calculation

2015-07-23 Thread Peter Maydell
Use pow2floor() to round down to the nearest power of 2, rather than an inline calculation. Signed-off-by: Peter Maydell --- exec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exec.c b/exec.c index 7d60e15..4710e2d 100644 --- a/exec.c +++ b/exec.c @@ -2371,9 +2371,7 @@

[Qemu-block] [PATCH 1/5] hw/pci: Use pow2ceil() rather than hand-calculation

2015-07-23 Thread Peter Maydell
A couple of places in hw/pci use an inline calculation to round a size up to the next largest power of 2. We have a utility routine for this, so use it. (The behaviour of the old code is different if the size value is 0 -- it would leave it as 0 rather than rounding up to 1, but in both cases we k

[Qemu-block] [PATCH 5/5] Remove unused qemu_fls function

2015-07-23 Thread Peter Maydell
Nothing uses qemu_fls() any more, so delete it. Signed-off-by: Peter Maydell --- include/qemu-common.h | 1 - util/cutils.c | 5 - 2 files changed, 6 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 237d654..bc6f8f8 100644 --- a/include/qemu-common.h +++

Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor()

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 13:08, Peter Maydell wrote: > We have a qemu_fls() function which is just a silly wrapper > around clz32() and which is used in only a handful of places > in the codebase. It turns out that all of those are really > trying to round up or down to a power of 2, which is something > we

[Qemu-block] [PATCH 3/5] hw/block/nvme.c: Use pow2ceil() rather than hand-calculation

2015-07-23 Thread Peter Maydell
Use pow2ceil() to round up to the next power of 2, rather than an inline calculation. Signed-off-by: Peter Maydell --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 40d4880..5da41b2 100644 --- a/hw/block/nvme.c +++ b/h

Re: [Qemu-block] [Qemu-devel] [PATCH RFC] virtio: set any_layout in virtio core

2015-07-23 Thread Cornelia Huck
On Wed, 22 Jul 2015 12:36:22 +0300 "Michael S. Tsirkin" wrote: > Virtio 1 requires this, and all devices are clean by now, > so let's do it! > > Exceptions: > - virtio-blk > - compat machine types > > Signed-off-by: Michael S. Tsirkin > --- > > Untested - consider this pseudo-code - i

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

2015-07-23 Thread Denis V. Lunev
On 07/23/2015 01:09 PM, Christian Borntraeger wrote: Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi: raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without

Re: [Qemu-block] [Qemu-devel] [PATCH RFC] virtio: set any_layout in virtio core

2015-07-23 Thread Christian Borntraeger
Am 22.07.2015 um 11:36 schrieb Michael S. Tsirkin: > Virtio 1 requires this, and all devices are clean by now, > so let's do it! > > Exceptions: > - virtio-blk > - compat machine types Is this targetted for 2.4 or 2.5? Pushing all the 1.0 stuff in 2.4 while in hard freeze seems a bit dang

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

2015-07-23 Thread Christian Borntraeger
Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi: > raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable. > It is confusing when aio=native performance is identical to aio=threads > because the binary was accidentally built without libaio. > > Print a deprecation warning if -drive

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/2] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 10:03, Markus Armbruster wrote: > >> > v2: >> > * Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's business >> >[Kevin] >> > * Print the warning in the same way as the aio=native,cache.direct=off >> >deprecation warning [Kevin] >> > >> > Open question: what

[Qemu-block] [RFC PATCH 07/11] aio: Mark ctx->notifier's client type as "context"

2015-07-23 Thread Fam Zheng
It is important to include this for any blocking poll, on the other hand it is also OK to exclude it otherwise. Signed-off-by: Fam Zheng --- aio-posix.c | 3 +++ aio-win32.c | 3 +++ async.c | 4 ++-- include/block/aio.h | 1 + 4 files changed, 9 insertions(+), 2 dele

[Qemu-block] [RFC PATCH 05/11] block: Mark fd handlers as "protocol"

2015-07-23 Thread Fam Zheng
The "protocol" type includes all the fd handlers and event notifiers used by block layer, especially those that should be polled in a nested event loop. Signed-off-by: Fam Zheng --- block/curl.c| 8 block/iscsi.c | 4 ++-- block/linux-aio.c | 4 ++-- block/nbd-client.

[Qemu-block] [RFC PATCH 06/11] nbd: Mark fd handlers client type as "nbd server"

2015-07-23 Thread Fam Zheng
So we could distinguish it from "protocol" to avoid handling in nested aio polls. Signed-off-by: Fam Zheng --- include/block/aio.h | 1 + nbd.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/block/aio.h b/include/block/aio.h index 1895a74..088f9ce

[Qemu-block] [RFC PATCH 09/11] block: Introduce bdrv_aio_poll

2015-07-23 Thread Fam Zheng
This call is introduced simply as a wrapper of aio_poll, but it makes it is easy to change the polled client types. Signed-off-by: Fam Zheng --- block/io.c| 5 + include/block/block.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/block/io.c b/block/io.c index d4bc83b..fb

Re: [Qemu-block] [PATCH RFC] virtio: set any_layout in virtio core

2015-07-23 Thread Jason Wang
On 07/22/2015 05:36 PM, Michael S. Tsirkin wrote: > Virtio 1 requires this, I think you mean transitional not virtio 1? > and all devices are clean by now, > so let's do it! > > Exceptions: > - virtio-blk > - compat machine types > > Signed-off-by: Michael S. Tsirkin > --- > > Unteste

[Qemu-block] [RFC PATCH 10/11] block: Replace nested aio_poll with bdrv_aio_poll

2015-07-23 Thread Fam Zheng
Just a manual search and replace. No semantic change here. Signed-off-by: Fam Zheng --- block.c | 2 +- block/curl.c | 2 +- block/io.c| 18 +- block/nfs.c | 2 +- block/qed-table.c | 8 blockjob.c| 2 +- qemu-img.c| 2 +

[Qemu-block] [RFC PATCH 03/11] aio-posix: Introduce aio_poll_clients

2015-07-23 Thread Fam Zheng
This new API will allow limiting the scope of polled fds. The parameter client_mask is a bit mask of the polled client types. Signed-off-by: Fam Zheng --- aio-posix.c | 19 ++- include/block/aio.h | 11 ++- 2 files changed, 24 insertions(+), 6 deletions(-) diff -

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/2] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Markus Armbruster
Stefan Hajnoczi writes: > v2: > * Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's business >[Kevin] > * Print the warning in the same way as the aio=native,cache.direct=off >deprecation warning [Kevin] > > Open question: what about the Windows case? We now pass the > FIL

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/2] block: warn about aio=native if libaio is unavailable

2015-07-23 Thread Kevin Wolf
Am 23.07.2015 um 10:08 hat Paolo Bonzini geschrieben: > > > On 23/07/2015 10:03, Markus Armbruster wrote: > > > >> > v2: > >> > * Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's > >> > business > >> >[Kevin] > >> > * Print the warning in the same way as the aio=native,cache

Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 08:32, Fam Zheng wrote: > > What is realized in this series is similar except the "disable, poll, enable" > method, instead the bit mask of interesting client types is passed to > aio_poll() (to be exact, passed to aio_poll_clients()). That is because, > aio_poll may release the Ai

Re: [Qemu-block] [Qemu-devel] [PATCH 0/1] A couple of problems with BlockDriverState's children list

2015-07-23 Thread Kevin Wolf
Am 23.07.2015 um 08:47 hat Markus Armbruster geschrieben: > Alberto Garcia writes: > > > I've been debugging a couple of problems related to the recently > > merged bdrv_reopen() overhaul code. > > > > 1. bs->children is not updated correctly > > > > The p

Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/2] blockdev: always compile in -drive aio= parsing

2015-07-23 Thread Markus Armbruster
Stefan Hajnoczi writes: > CONFIG_LINUX_AIO is an implementation detail of raw-posix.c. Don't > mention CONFIG_LINUX_AIO in blockdev.c. Let raw-posix.c decide what to To be precise: "raw-posix.c or raw-win32.c", or maybe "the block driver". > do with BDRV_O_NATIVE_AIO if CONFIG_LINUX_AIO is no