[Qemu-devel] [PATCH v4] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. And switch debug output to stderr. Signed-off-by: Zhou Jie Reviewed-by: Eric Blake --- v3 ->

Re: [Qemu-devel] [PATCH 04/11] aio: introduce aio_co_schedule

2016-04-28 Thread Fam Zheng
On Fri, 04/15 13:31, Paolo Bonzini wrote: > This provides the infrastructure to start a coroutine on a remote > AioContext. It will be used by CoMutex and CoQueue, so that > coroutines don't jump from one context to another when they > go to sleep on a mutex or waitqueue. > > aio_co_schedule is

Re: [Qemu-devel] Hang with migration multi-thread compression under high load

2016-04-28 Thread Li, Liang Z
> On Wed, Apr 27, 2016 at 03:20:23PM +0100, Daniel P. Berrange wrote: > > I've been testing various features of migration and have hit a problem > > with the multi-thread compression. It works fine when I have 2 or more > > threads, but if I tell it to only use a single thread, then it almost > >

Re: [Qemu-devel] [RFC PATCH V2 2/2] vhost: device IOTLB API

2016-04-28 Thread Jason Wang
On 04/29/2016 09:12 AM, Jason Wang wrote: > On 04/28/2016 10:43 PM, Michael S. Tsirkin wrote: >> > On Thu, Apr 28, 2016 at 02:37:16PM +0800, Jason Wang wrote: >>> >> >>> >> On 04/27/2016 07:45 PM, Michael S. Tsirkin wrote: >>> On Fri, Mar 25, 2016 at 10:34:34AM +0800, Jason Wang wrote:

[Qemu-devel] [PATCH v3 18/18] qapi: Add parameter to visit_end_*

2016-04-28 Thread Eric Blake
Rather than making the dealloc visitor track of stack of pointers remembered during visit_start_* in order to free them during visit_end_*, it's a lot easier to just make all callers pass the same pointer to visit_end_*. The generated code has access to the same pointer, while all other users are

[Qemu-devel] [PATCH v3 14/18] qemu-img: Use new JSON output formatter

2016-04-28 Thread Eric Blake
Now that we can pretty-print straight to JSON from a visitor, we can eliminate the temporary conversion into QObject inside qemu-img. The changes to qemu-iotests 043 expected output demonstrates the fact that output is now done in qapi declaration order, rather than QDict hash order.

[Qemu-devel] [PATCH v3 17/18] replay: Use new QAPI cloning

2016-04-28 Thread Eric Blake
Rather than rolling our own clone via an expensive conversion in and back out of QObject, use the generated QAPI version. Signed-off-by: Eric Blake --- v3: new patch --- replay/replay-input.c | 30 ++ 1 file changed, 2 insertions(+), 28

[Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefix()

2016-04-28 Thread Eric Blake
The next patch will add pretty indentation to the JSON visitor. But in order to support pretty output in the type_any() callback, we need to prefix every line of the QObject visitor by the current indentation in the JSON visitor. Hence, a new function qobject_to_json_pretty_indent(), and the old

[Qemu-devel] [PATCH v3 10/18] vmstate: Use new JSON output visitor

2016-04-28 Thread Eric Blake
Rather than using a QJSON object and converting the QString result to a char *, we can use the new JSON output visitor and get directly to a char *. The conversions are a bit tricky in place (in places, we have to copy an integer to an int64_t temporary to get the right pointer for

[Qemu-devel] [PATCH v3 11/18] qjson: Remove unused file

2016-04-28 Thread Eric Blake
Now that we have a JSON output visitor, and the previous patch fixed the only client of vmstate to use it, we no longer need the simpler QJSON object doing the same thing. Signed-off-by: Eric Blake --- v3: rebase to master v2: new patch --- include/qjson.h | 29

Re: [Qemu-devel] [PATCH] po/Makefile: call rm -f directly

2016-04-28 Thread Jan Vesely
On Sat, 2016-03-19 at 21:58 -0400, Jan Vesely wrote: > Default variables are undefined in rules.mak and this is what the > rest > of the build system uses. > Fixes make clean in ./po/ > > Signed-off-by: Jan Vesely > --- >  po/Makefile | 2 +- >  1 file changed, 1

[Qemu-devel] [PATCH v3 06/18] qapi: Add qstring_append_format()

2016-04-28 Thread Eric Blake
Back in commit 764c1ca (Nov 2009), we added qstring_append_int(). However, it did not see any use until commit 190c882 (Jan 2015). Furthermore, it has a rather limited use case - to print anything else, callers still have to format into a temporary buffer, unless we want to introduce an explosion

[Qemu-devel] [PATCH v3 15/18] qapi: Add new clone visitor

2016-04-28 Thread Eric Blake
We have a couple places in the code base that want to deep-clone one QAPI object into another, and they were resorting to serializing the struct out to QObject then reparsing it. A much more efficient version can be done by adding a new clone visitor. Note that we can only clone objects

[Qemu-devel] [PATCH v3 16/18] sockets: Use new QAPI cloning

2016-04-28 Thread Eric Blake
Rather than rolling our own clone via an expensive conversion in and back out of QObject, use the generated QAPI version. Signed-off-by: Eric Blake --- v3: new patch --- util/qemu-sockets.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff

[Qemu-devel] [PATCH v3 04/18] qapi: Factor out JSON number formatting

2016-04-28 Thread Eric Blake
Pull out a new qstring_append_json_number() helper, so that all JSON output producers can use a consistent style for printing floating point without duplicating code (since we are doing more data massaging than a simple printf format can handle). Address one FIXME by adding an Error parameter and

[Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-04-28 Thread Eric Blake
We have several places that want to go from qapi to JSON; right now, they have to create an intermediate QObject to do the work. That also has the drawback that the JSON formatting of a QDict will rearrange keys (according to a deterministic, but unpredictable, hash), when humans have an easier

[Qemu-devel] [PATCH v3 09/18] Revert "qjson: Simplify by using json-output-visitor"

2016-04-28 Thread Eric Blake
Showing two alternative approaches; revert approach 1 to go forward with approach 2 This reverts commit 7af47db0b00e982231399a81a3af490d84aee010. --- qjson.c | 61 +++-- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git

[Qemu-devel] [PATCH v3 01/18] qapi: Rename (one) qjson.h to qobject-json.h

2016-04-28 Thread Eric Blake
We have two different JSON visitors in the tree; and having both named 'qjson.h' can cause include confusion. Rename the qapi version. Why did I pick that one? A later patch plans on deleting the top-level qjson.c once we have a native JSON output visitor; we could have renamed that one for

[Qemu-devel] [PATCH v3 13/18] qapi: Support pretty printing in JSON output visitor

2016-04-28 Thread Eric Blake
Similar to pretty printing in the QObject visitor. The trickiest parts are the fact that during type_any(), we have to coordinate with QObject to also print pretty; and the fact that the testsuite now has to honor parameterization on whether pretty printing is enabled. Signed-off-by: Eric Blake

[Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping

2016-04-28 Thread Eric Blake
Pull out a new qstring_append_json_string() helper, so that all JSON output producers can use the same output escaping rules. While it appears that vmstate's use of the simpler qjson.c formatter is not currently encountering any string that needs escapes to be valid JSON, it is better to be safe

[Qemu-devel] [PATCH v3 00/18] Add qapi-to-JSON and clone visitors

2016-04-28 Thread Eric Blake
Prerequisites: + my qapi cleanups subset E v16: https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg04397.html Note that the series has a mutually exclusive choice: either patch 8, or patches 10-11. I still haven't gotten any feedback on which choice seems nicer. I wrote this series for

[Qemu-devel] [PATCH v3 08/18] qjson: Simplify by using json-output-visitor

2016-04-28 Thread Eric Blake
Instead of rolling our own limited JSON outputter, we can just wrap the more full-featured JSON output Visitor. This slightly changes the output (different spacing), but the result is still equivalent JSON contents. Signed-off-by: Eric Blake --- v3: rebase to master v2:

[Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate

2016-04-28 Thread Eric Blake
No need to create a temporary buffer, when we already have a function available for our needs. Signed-off-by: Eric Blake Reviewed-by: Fam Zheng --- v3: no change v2: no change --- qobject/json-parser.c | 7 +-- 1 file changed, 1 insertion(+), 6

[Qemu-devel] [PATCH v3 02/18] qapi: Improve use of qmp/types.h

2016-04-28 Thread Eric Blake
'qobject-json.h' is not a QObject subtype; include this file directly in .c files that are using it, rather than abusing qmp/types.h for that purpose. Meanwhile, for files that include a list of individual QObject subtypes, it's easier to just use qmp/types.h for that purpose. Signed-off-by:

[Qemu-devel] [PATCH] fix xen hvm direct kernel boot

2016-04-28 Thread Chunyan Liu
Since commit a1666142: acpi-build: make ROMs RAM blocks resizeable, xen HVM direct kernel boot failed. Xen HVM direct kernel boot will insert a linuxboot.bin or multiboot.bin to /genroms, before this commit, in acpi_setup, for rom linuxboot.bin/multiboot.bin, it only needs 0x2 size; after the

Re: [Qemu-devel] [PATCH v3] block: always compile-check debug prints

2016-04-28 Thread Eric Blake
On 04/28/2016 09:00 PM, Zhou Jie wrote: > Files with conditional debug statements should ensure that the printf is > always compiled. > This prevents bitrot of the format string of the debug statement. Still missing a sentence about the intentional change to use stderr. > > Signed-off-by: Zhou

[Qemu-devel] [PATCH] fix xen hvm direct kernel boot

2016-04-28 Thread Chunyan Liu
Since commit a1666142: acpi-build: make ROMs RAM blocks resizeable, xen HVM direct kernel boot failed. Xen HVM direct kernel boot will insert a linuxboot.bin or multiboot.bin to /genroms, before this commit, in acpi_setup, for rom linuxboot.bin/multiboot.bin, it only needs 0x2 size; after the

[Qemu-devel] [Bug 1576347] Re: Only one NVMe device is usable in Windows (10) guest

2016-04-28 Thread Tom Yan
I also tested WIndows installation ISOs instead as well. Windows 10 Enterprise 10586: qemu-system-x86_64 -enable-kvm -cpu host -smp cores=4 -m 4G -net bridge -net nic -full-screen -drive file=ovmf_x64.bin,format=raw,if=pflash -drive file=Downloads/10586.0.151029-1700

Re: [Qemu-devel] [PATCH] target-i386: add Skylake-Client cpu mode

2016-04-28 Thread Xiao Guangrong
No, i am afraid it is not a Skylake Client feature. On 04/29/2016 11:11 AM, Huang, Kai wrote: Hi Guangrong, How about also add SGX to Skylake? Thanks, -Kai On 4/27/2016 8:13 PM, Xiao Guangrong wrote: From: Eduardo Habkost Introduce Skylake-Client cpu mode which

Re: [Qemu-devel] [RFC PATCH v2 2/2] spapr: Memory hot-unplug support

2016-04-28 Thread David Gibson
On Tue, Apr 26, 2016 at 04:03:37PM -0500, Michael Roth wrote: > Quoting Igor Mammedov (2016-04-26 02:52:36) > > On Tue, 26 Apr 2016 10:39:23 +0530 > > Bharata B Rao wrote: > > > > > On Mon, Apr 25, 2016 at 11:20:50AM +0200, Igor Mammedov wrote: > > > > On Wed, 16 Mar

Re: [Qemu-devel] [RFC PATCH v2 2/2] spapr: Memory hot-unplug support

2016-04-28 Thread David Gibson
On Wed, Apr 27, 2016 at 03:37:05PM +0200, Igor Mammedov wrote: > On Tue, 26 Apr 2016 16:03:37 -0500 > Michael Roth wrote: > > > Quoting Igor Mammedov (2016-04-26 02:52:36) > > > On Tue, 26 Apr 2016 10:39:23 +0530 > > > Bharata B Rao wrote:

Re: [Qemu-devel] [PATCH v2 00/17] block: Convert .bdrv_read/write to .bdrv_preadv/pwritev

2016-04-28 Thread Fam Zheng
On Thu, 04/28 15:16, Kevin Wolf wrote: > This series introduces a new BlockDriver interface, which will hopefully be > the > final one, or at least good enough for another few years: > .bdrv_preadv/pwritev. > It is based on coroutines, vectored, has flags and uses a byte granularity. > This is

Re: [Qemu-devel] [PATCH v2 03/17] block: Support AIO drivers in bdrv_driver_preadv/pwritev()

2016-04-28 Thread Fam Zheng
On Fri, 04/29 09:22, Fam Zheng wrote: > > @@ -125,19 +119,13 @@ void bdrv_io_limits_update_group(BlockDriverState > > *bs, const char *group) > > > > void bdrv_setup_io_funcs(BlockDriver *bdrv) > > { > > -/* Block drivers without coroutine functions need emulation */ > > -if

[Qemu-devel] [Bug 1576347] Re: Only one NVMe device is usable in Windows (10) guest

2016-04-28 Thread Tom Yan
Apparently it works fine in Linux though: qemu-system-x86_64 -enable-kvm -cpu host -smp cores=4 -m 4G -net bridge -net nic -full-screen -drive file=ovmf_x64.bin,format=raw,if=pflash -drive file=Downloads/archlinux-2016.04.01-dual.iso,media=cdrom -drive

Re: [Qemu-devel] [PATCH v2 14/17] vpc: Implement .bdrv_co_preadv() interface

2016-04-28 Thread Fam Zheng
On Thu, 04/28 15:16, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > block/vpc.c | 79 > - > 1 file changed, 42 insertions(+), 37 deletions(-) > > diff --git a/block/vpc.c b/block/vpc.c > index 3e2ea69..0099a80

Re: [Qemu-devel] [PATCH v2 13/17] vmdk: Implement .bdrv_co_pwritev() interface

2016-04-28 Thread Fam Zheng
On Thu, 04/28 15:16, Kevin Wolf wrote: > +typedef struct VmdkWriteCompressedCo { > +BlockDriverState *bs; > +int64_t sector_num; > +const uint8_t *buf; > +int nb_sectors; > +int ret; > +} VmdkWriteCompressedCo; > + > +static void vmdk_co_write_compressed(void *opaque) > +{ > +

[Qemu-devel] [PATCH v3] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. Signed-off-by: Zhou Jie Reviewed-by: Eric Blake --- v1 -> v2: * Keep the user-visible

Re: [Qemu-devel] [PATCH 19/18] intel_iommu: Add support for Extended Interrupt Mode

2016-04-28 Thread Peter Xu
On Thu, Apr 28, 2016 at 11:30:23AM +0200, Jan Kiszka wrote: > As neither QEMU nor KVM support more than 255 CPUs so far, this is > simple: we only need to switch the destination ID translation in > vtd_remap_irq_get if EIME is set. > > Once CFI support is there, it will have to take EIM into

Re: [Qemu-devel] [PATCH v5 15/18] intel_iommu: introduce IEC notifiers

2016-04-28 Thread Peter Xu
On Thu, Apr 28, 2016 at 06:56:05PM +0300, David Kiarie wrote: [...] > I think AMD IOMMU could be a benefit greatly from the Intel IOMMU > cache implementation. There could be a few differences but I think > much of the code could be reused. The thing is, AMD IOMMU spec doesn't > mention anything

[Qemu-devel] [Bug 1576347] Re: Only one NVMe device is usable in Windows (10) guest

2016-04-28 Thread Tom Yan
"if=virtio" (which similarly has one controller per drive and has each controller occupies a pci slot as the nvme emulation) works fine: qemu-system-x86_64 -enable-kvm -cpu host -smp cores=4 -m 4G -net bridge -net nic -full-screen -drive file=ovmf_x64.bin,format=raw,if=pflash -drive

Re: [Qemu-devel] [PATCH v2 08/17] dmg: Implement .bdrv_co_preadv() interface

2016-04-28 Thread Eric Blake
On 04/28/2016 07:16 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > block/dmg.c | 40 +++- > 1 file changed, 23 insertions(+), 17 deletions(-) > > if (dmg_read_chunk(bs, sector_num + i) != 0) { > -return -1; >

Re: [Qemu-devel] [PATCH v2 07/17] cloop: Implement .bdrv_co_preadv() interface

2016-04-28 Thread Eric Blake
On 04/28/2016 07:16 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > block/cloop.c | 38 ++ > 1 file changed, 22 insertions(+), 16 deletions(-) > > for (i = 0; i < nb_sectors; i++) { > +void *data; > uint32_t

Re: [Qemu-devel] [PATCH v2] block: always compile-check debug prints

2016-04-28 Thread Eric Blake
On 04/28/2016 07:44 PM, Zhou Jie wrote: > Files with conditional debug statements should ensure that the printf is > always compiled. > This prevents bitrot of the format string of the debug statement. The commit message needs to mention... > > Signed-off-by: Zhou Jie

Re: [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization

2016-04-28 Thread Zhang Chen
On 04/29/2016 10:03 AM, Jason Wang wrote: On 04/28/2016 05:04 PM, Zhang Chen wrote: On 04/28/2016 04:17 PM, Jason Wang wrote: On 04/28/2016 03:55 PM, Zhang Chen wrote: On 04/28/2016 03:16 PM, Jason Wang wrote: On 04/28/2016 02:53 PM, Jason Wang wrote: +static void

Re: [Qemu-devel] [RFC PATCH V3 3/4] colo-compare: introduce packet comparison thread

2016-04-28 Thread Jason Wang
On 04/28/2016 06:31 PM, Zhang Chen wrote: >>> +/* >>> + * called from the compare thread on the primary >>> + * for compare connection >>> + */ >>> +static void colo_compare_connection(void *opaque, void *user_data) >>> +{ >>> +Connection *conn = opaque; >>> +Packet *pkt = NULL; >>> +

Re: [Qemu-devel] [RFC PATCH V3 2/4] colo-compare: track connection and enqueue packet

2016-04-28 Thread Jason Wang
On 04/28/2016 06:25 PM, Zhang Chen wrote: >>> +static Packet *packet_new(CompareState *s, const void *data, >>> + int size, ConnectionKey *key) >>> +{ >>> +Packet *pkt = g_slice_new(Packet); >>> + >>> +pkt->data = g_memdup(data, size); >>> +pkt->size =

Re: [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization

2016-04-28 Thread Jason Wang
On 04/28/2016 05:04 PM, Zhang Chen wrote: > > > On 04/28/2016 04:17 PM, Jason Wang wrote: >> >> On 04/28/2016 03:55 PM, Zhang Chen wrote: >>> >>> On 04/28/2016 03:16 PM, Jason Wang wrote: On 04/28/2016 02:53 PM, Jason Wang wrote: > +static void compare_set_outdev(Object *obj, const char

[Qemu-devel] [PATCH v2] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. Signed-off-by: Zhou Jie --- block/curl.c | 10 -- block/sheepdog.c | 13 - 2 files

Re: [Qemu-devel] Hang with migration multi-thread compression under high load

2016-04-28 Thread Li, Liang Z
> On Thu, Apr 28, 2016 at 03:27:39AM +, Li, Liang Z wrote: > > > I've been testing various features of migration and have hit a > > > problem with the multi-thread compression. It works fine when I have > > > 2 or more threads, but if I tell it to only use a single thread, > > > then it almost

Re: [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization

2016-04-28 Thread Zhang Chen
On 04/29/2016 04:55 AM, Eric Blake wrote: On 04/18/2016 05:11 AM, Zhang Chen wrote: s/initlization/initialization/ in the subject OK~ packet come from primary char indev will be send to outdev - packet come from secondary char dev will be drop Grammar suggestion: Packets coming from the

Re: [Qemu-devel] [PATCH v2 03/17] block: Support AIO drivers in bdrv_driver_preadv/pwritev()

2016-04-28 Thread Fam Zheng
On Thu, 04/28 15:16, Kevin Wolf wrote: > Instead of registering emulation functions as .bdrv_co_writev, just > directly check whether the function is there or not, and use the AIO > interface if it isn't. This makes the read/write functions more > consistent with how things are done in other

Re: [Qemu-devel] [PATCH v2 02/17] block: Introduce bdrv_driver_pwritev()

2016-04-28 Thread Fam Zheng
On Thu, 04/28 15:16, Kevin Wolf wrote: > This is a function that simply calls into the block driver for doing a > write, providing the byte granularity interface we want to eventually > have everywhere, and using whatever interface that driver supports. > > This one is a bit more interesting that

Re: [Qemu-devel] [RFC PATCH V2 2/2] vhost: device IOTLB API

2016-04-28 Thread Jason Wang
On 04/28/2016 10:43 PM, Michael S. Tsirkin wrote: > On Thu, Apr 28, 2016 at 02:37:16PM +0800, Jason Wang wrote: >> >> On 04/27/2016 07:45 PM, Michael S. Tsirkin wrote: >>> On Fri, Mar 25, 2016 at 10:34:34AM +0800, Jason Wang wrote: This patch tries to implement an device IOTLB for vhost.

Re: [Qemu-devel] [PATCH] configure: Check if struct fsxattr is available from linux header

2016-04-28 Thread Jan Vesely
On Tue, 2016-04-12 at 17:09 -0400, Jan Vesely wrote: > On Sat, 2016-03-19 at 21:18 -0400, Jan Vesely wrote: > > > > Fixes build with new linux headers. > > > > Signed-off-by: Jan Vesely > > --- > > linux-headers-4.5 and xfsprogs-3.2.4 in my case > > > >  configure | 18

[Qemu-devel] [PATCH v6 5/6] tcg: Rework tb_invalidated_flag

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov 'tb_invalidated_flag' was meant to catch two events: * some TB has been invalidated by tb_phys_invalidate(); * the whole translation buffer has been flushed by tb_flush(). Then it was checked: * in cpu_exec() to ensure that the last executed TB can

[Qemu-devel] [PATCH v6 4/6] tcg: Clean up from 'next_tb'

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov The value returned from tcg_qemu_tb_exec() is the value passed to the corresponding tcg_gen_exit_tb() at translation time of the last TB attempted to execute. It is a little confusing to store it in a variable named 'next_tb'. In fact, it is a

[Qemu-devel] [PATCH v6 3/6] cpu-exec: elide more icount code if CONFIG_USER_ONLY

2016-04-28 Thread Sergey Fedorov
From: Paolo Bonzini Signed-off-by: Paolo Bonzini [Alex Bennée: #ifndef replay code to match elided functions] Signed-off-by: Alex Bennée Signed-off-by: Sergey Fedorov --- cpu-exec.c | 8 1

[Qemu-devel] [PATCH v6 6/6] cpu-exec: Move TB chaining into tb_find_fast()

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Move tb_add_jump() call and surrounding code from cpu_exec() into tb_find_fast(). That simplifies cpu_exec() a little by hiding the direct chaining optimization details into tb_find_fast(). It also allows to move tb_lock()/tb_unlock() pair into

[Qemu-devel] [PATCH v6 0/6] tcg: Misc clean-up patches

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov This patch series consists of various general TCG clean-up patches extracted from Paolo's MTTCG tree [1] and Alex's MTTCG base enablement tree [2]. I also add here a patch from myself to rework tb_invalidated_flag based on the Paolo's "tcg: move

[Qemu-devel] [PATCH v6 1/6] tcg: code_bitmap is not used by user-mode emulation

2016-04-28 Thread Sergey Fedorov
From: Paolo Bonzini Signed-off-by: Paolo Bonzini [Sergey Fedorov: eliminate the field entirely in user-mode] Signed-off-by: Sergey Fedorov Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée

[Qemu-devel] [PATCH v6 2/6] tcg: reorganize tb_find_physical loop

2016-04-28 Thread Sergey Fedorov
From: Alex Bennée Put some comments and improve code structure. This should help reading the code. Signed-off-by: Alex Bennée [Sergey Fedorov: provide commit message; bring back resetting of tb_invalidated_flag] Signed-off-by: Sergey Fedorov

[Qemu-devel] [PATCH v16 19/24] qapi: Split visit_end_struct() into pieces

2016-04-28 Thread Eric Blake
As mentioned in previous patches, we want to call visit_end_struct() functions unconditionally, so that visitors can release resources tied up since the matching visit_start_struct() without also having to worry about error priority if more than one error occurs. Even though error_propagate() can

[Qemu-devel] [PATCH v16 24/24] qapi: Change visit_type_FOO() to no longer return partial objects

2016-04-28 Thread Eric Blake
Returning a partial object on error is an invitation for a careless caller to leak memory. We already fixed things in an earlier patch to guarantee NULL if visit_start fails ("qapi: Guarantee NULL obj on input visitor callback error"), but that does not help the case where visit_start succeeds

[Qemu-devel] [PATCH v16 15/24] qmp: Support explicit null during visits

2016-04-28 Thread Eric Blake
Implement the new type_null() callback for the qmp input and output visitors. While we don't yet have a use for this in QAPI input (the generator will need some tweaks first), some potential usages have already been discussed on the list. Meanwhile, the output visitor could already output explicit

[Qemu-devel] [PATCH v16 18/24] qmp: Tighten output visitor rules

2016-04-28 Thread Eric Blake
Tighten assertions in the QMP output visitor, so that: - qmp_output_get_qobject() can only be called after pairing a visit_end_* for every visit_start_* (rather than allowing it on a partially built object) - qmp_output_get_qobject() cannot be called unless at least one visit_type_* or

[Qemu-devel] [PATCH v16 14/24] qapi: Add visit_type_null() visitor

2016-04-28 Thread Eric Blake
Right now, qmp-output-visitor happens to produce a QNull result if nothing is actually visited between the creation of the visitor and the request for the resulting QObject. A stronger protocol would require that a QMP output visit MUST visit something. But to still be able to produce a JSON

[Qemu-devel] [PATCH v16 22/24] qapi: Fix string input visitor handling of invalid list

2016-04-28 Thread Eric Blake
As shown in the previous commit, the string input visitor was treating bogus input as an empty list rather than an error. Fix parse_str() to set errp, then the callers to exit early if an error was reported. Meanwhile, fix the testsuite to use the generated qapi_free_int16List() instead of

[Qemu-devel] [PATCH v16 12/24] qapi: Document visitor interfaces, add assertions

2016-04-28 Thread Eric Blake
The visitor interface for mapping between QObject/QemuOpts/string and QAPI is scandalously under-documented, making changes to visitor core, individual visitors, and users of visitors difficult to coordinate. Among other questions: when is it safe to pass NULL, vs. when a string must be provided;

[Qemu-devel] [PATCH v16 13/24] tests: Add check-qnull

2016-04-28 Thread Eric Blake
Add a new test, for checking reference counting of qnull(). As part of the new file, move a previous reference counting change added in commit a861564 to a more logical place. Note that while most of the check-q*.c leave visitor stuff to the test-qmp-*-visitor.c, in this case we actually want the

[Qemu-devel] [PATCH v16 23/24] qapi: Simplify semantics of visit_next_list()

2016-04-28 Thread Eric Blake
The semantics of the list visit are somewhat baroque, with the following pseudocode when FooList is used: start() for (prev = head; cur = next(prev); prev = ) { visit(>value) } Note that these semantics (advance before visit) requires that the first call to next() return the list head, while

[Qemu-devel] [PATCH v16 11/24] qmp-input: Refactor when list is advanced

2016-04-28 Thread Eric Blake
In the QMP input visitor, visiting a list traverses two objects: the QAPI GenericList of the caller (which gets advanced in visit_next_list() regardless of this patch), and the QList input that we are converting to QAPI. For consistency with QDict visits, we want to consume elements from the

[Qemu-devel] [PATCH v16 07/24] qmp-input: Don't consume input when checking has_member

2016-04-28 Thread Eric Blake
Commit e8316d7 mistakenly passed consume=true within qmp_input_optional() when checking if an optional member was present, but the mistake was silently ignored since the code happily let us extract a member more than once. Fix qmp_input_optional() to not consume anything, then tighten up the

[Qemu-devel] [PATCH v16 20/24] qapi: Don't pass NULL to printf in string input visitor

2016-04-28 Thread Eric Blake
Make sure the error message for visit_type_uint64() gracefully handles a NULL 'name' when called from the top level or a list context, as not all the world behaves like glibc in allowing NULL through a printf-family %s. Signed-off-by: Eric Blake --- v16: split off NULL

[Qemu-devel] [PATCH v16 21/24] tests/string-input-visitor: Add negative integer tests

2016-04-28 Thread Eric Blake
From: Markus Armbruster Add two negative tests, one for int and one for int16List. The latter exposes a bug: nonsensical input results in an empty list instead of an error. Signed-off-by: Markus Armbruster Message-Id:

[Qemu-devel] [PATCH v16 17/24] qmp: Add qmp_output_visitor_reset()

2016-04-28 Thread Eric Blake
Add a new qmp_output_visitor_reset(), to make it easier for a caller to reset all state while still reusing an existing visitor, regardless of whether the previous visit was successfully completed. Then use it in the testsuite. The tests needing patching were found by tightening asserts in the

[Qemu-devel] [PATCH v16 01/24] qapi-visit: Add visitor.type classification

2016-04-28 Thread Eric Blake
We have three classes of QAPI visitors: input, output, and dealloc. Currently, all implementations of these visitors have one thing in common based on their visitor type: the implementation used for the visit_type_enum() callback. But since we plan to add more such common behavior, in relation to

[Qemu-devel] [PATCH v16 06/24] qapi: Use strict QMP input visitor in more places

2016-04-28 Thread Eric Blake
The following uses of a QMP input visitor should be strict (that is, excess keys in QDict input should be flagged if not converted to QAPI): - Testsuite code unrelated to explicitly testing non-strict mode (test-qmp-commands, test-visitor-serialization); since we want more code to be strict by

[Qemu-devel] [PATCH v16 16/24] spapr_drc: Expose 'null' in qom-get when there is no fdt

2016-04-28 Thread Eric Blake
Now that the QMP output visitor supports an explicit null output, we should utilize it to make it easier to diagnose the difference between a missing fdt ('null') vs. a present-but-empty one ('{}'). (Note that this reverts the behavior of commit ab8bf1d, taking us back to the behavior of commit

[Qemu-devel] [PATCH v16 00/24] qapi visitor cleanups (post-introspection cleanups subset E)

2016-04-28 Thread Eric Blake
2.7 material; much less churn this time through, but enough that it was easier for me to repost than to make Markus do the touchups his review found. Based on master, with no prerequisite patches. Also available as a tag at this location: git fetch git://repo.or.cz/qemu/ericb.git

[Qemu-devel] [PATCH v16 02/24] qapi: Guarantee NULL obj on input visitor callback error

2016-04-28 Thread Eric Blake
Our existing input visitors were not very consistent on errors in a function taking 'TYPE **obj' (that is, start_struct(), start_alternate(), type_str(), and type_any(). next_list() is similar, except that since commit 08f9541, it can't fail). While all of them set '*obj' to allocated storage on

[Qemu-devel] [PATCH v16 10/24] qmp-input: Require struct push to visit members of top dict

2016-04-28 Thread Eric Blake
Don't embed the root of the visit into the stack of current containers being visited. That way, we no longer get confused on whether the first visit of a dictionary is to the dictionary itself or to one of the members of the dictionary, based on whether the caller passed name=NULL; and makes the

[Qemu-devel] [PATCH v16 04/24] qmp-input: Clean up stack handling

2016-04-28 Thread Eric Blake
Management of the top of stack was a bit verbose; creating a temporary variable and adding some comments makes the existing code more legible before the next few patches improve things. No semantic changes other than asserting that we are always visiting a QObject, and not a NULL value. In

[Qemu-devel] [PATCH v16 09/24] qom: Wrap prop visit in visit_start_struct

2016-04-28 Thread Eric Blake
The qmp-input visitor was allowing callers to play rather fast and loose: when visiting a QDict, you could grab members of the root dictionary without first pushing into the dict; the final such culprit was the QOM code for converting to and from object properties. But we are about to tighten the

[Qemu-devel] [PATCH v16 03/24] qmp: Drop dead command->type

2016-04-28 Thread Eric Blake
Ever since QMP was first added back in commit 43c20a43, we have never had any QmpCommandType other than QCT_NORMAL. It's pointless to carry around the cruft. Signed-off-by: Eric Blake --- v15: no change v14: no change v13: no change v12: new patch ---

[Qemu-devel] [PATCH v16 08/24] qapi-commands: Wrap argument visit in visit_start_struct

2016-04-28 Thread Eric Blake
The qmp-input visitor was allowing callers to play rather fast and loose: when visiting a QDict, you could grab members of the root dictionary without first pushing into the dict; among the culprit callers was the generated marshal code on the 'arguments' dictionary of a QMP command. But we are

[Qemu-devel] [PATCH v16 05/24] qapi: Consolidate QMP input visitor creation

2016-04-28 Thread Eric Blake
Rather than having two separate ways to create a QMP input visitor, where the safer approach has the more verbose name, it is better to consolidate things into a single function where the caller must explicitly choose whether to be strict or to ignore excess input. This patch is the strictly

[Qemu-devel] [PATCH v5 10/10] tcg: Allow goto_tb to any target PC in user mode

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov In user mode, there's only a static address translation, TBs are always invalidated properly and direct jumps are reset when mapping change. Thus the destination address is always valid for direct jumps and there's no need to restrict it to the pages

[Qemu-devel] [PATCH v5 04/10] tcg: Init TB's direct jumps before making it visible

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Initialize TB's direct jump list data fields and reset the jumps before tb_link_page() puts it into the physical hash table and the physical page list. So TB is completely initialized before it becomes visible. This is pure rearrangement of code to a

[Qemu-devel] [PATCH v5 09/10] tcg: Clean up direct block chaining safety checks

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov We don't take care of direct jumps when address mapping changes. Thus we must be sure to generate direct jumps so that they always keep valid even if address mapping changes. Luckily, we can only allow to execute a TB if it was generated from the pages

[Qemu-devel] [PATCH v5 08/10] tcg: Clean up tb_jmp_unlink()

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Unify the code of this function with tb_jmp_remove_from_list(). Making these functions similar improves their readability. Also this could be a step towards making this function thread-safe. Signed-off-by: Sergey Fedorov

[Qemu-devel] [PATCH v5 03/10] tcg: Rearrange tb_link_page() to avoid forward declaration

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Reviewed-by: Alex Bennée --- translate-all.c | 204 1 file

[Qemu-devel] [PATCH v5 07/10] tcg: Extract removing of jumps to TB from tb_phys_invalidate()

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Move the code for removing jumps to a TB out of tb_phys_invalidate() to a separate static inline function tb_jmp_unlink(). This simplifies tb_phys_invalidate() and improves code structure. Signed-off-by: Sergey Fedorov

[Qemu-devel] [PATCH v5 06/10] tcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list()

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov tb_jmp_remove() was only used to remove the TB from a list of all TBs jumping to the same TB which is n-th jump destination of the given TB. Put a comment briefly describing the function behavior and rename it to better reflect its purpose.

[Qemu-devel] [PATCH v5 00/10] tcg: Direct block chaining clean-up

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov This series combines a set of patches which is meant to improve overall code structure and readability of the direct block chaining mechanism. The other point is to make a step towards thread safety of TB chainig. This series is based on commit:

[Qemu-devel] [PATCH v5 02/10] tcg: Use uintptr_t type for jmp_list_{next|first} fields of TB

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov These fields do not contain pure pointers to a TranslationBlock structure. So uintptr_t is the most appropriate type for them. Also put some asserts to assure that the two least significant bits of the pointer are always zero before assigning it to

[Qemu-devel] [PATCH v5 05/10] tcg: Clarify thread safety check in tb_add_jump()

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov The check is to make sure that another thread hasn't already done the same while we were outside of tb_lock. Mention this in a comment. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov

[Qemu-devel] [PATCH v5 01/10] tcg: Clean up direct block chaining data fields

2016-04-28 Thread Sergey Fedorov
From: Sergey Fedorov Briefly describe in a comment how direct block chaining is done. It should help in understanding of the following data fields. Rename some fields in TranslationBlock and TCGContext structures to better reflect their purpose (dropping excessive 'tb_'

[Qemu-devel] [PATCH for 2.6] configure: Allow builds -Weverything

2016-04-28 Thread Stefan Weil
The clang compiler supports a useful compiler option -Weverything. As this option triggers warnings in glib header files, too, testing glib with -Werror will always fail. A size mismatch is also detected without -Werror, so simply remove it. Signed-off-by: Stefan Weil ---

Re: [Qemu-devel] [BUG 2.6] Compiler warnings (clang) in 2.6 (was: Broken CONFIG_TPM?)

2016-04-28 Thread Stefan Weil
Am 28.04.2016 um 22:33 schrieb Stefan Weil: > A compilation test with clang -Weverything reported this problem: > > config-host.h:112:20: warning: '$' in identifier > [-Wdollar-in-identifier-extension] > > The line of code looks like this: > > #define CONFIG_TPM $(CONFIG_SOFTMMU) > > This is fine

Re: [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization

2016-04-28 Thread Eric Blake
On 04/18/2016 05:11 AM, Zhang Chen wrote: s/initlization/initialization/ in the subject > packet come from primary char indev will be send to > outdev - packet come from secondary char dev will be drop Grammar suggestion: Packets coming from the primary char indev will be sent to outdev;

  1   2   3   >