[Qemu-devel] [PULL v2 04/50] ivhsmem: read do not accept more than sizeof(long)

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau ivshmem_read() only reads sizeof(long) from the input buffer. Accepting more could lead to fifo8 abort() on 32bit systems if fifo is not empty. A following patch will change the protocol to 64-bit little-endian instead. Signed-off-by: Marc-André Lureau Reviewed-by: Cla

[Qemu-devel] [PULL v2 07/50] ivshmem: remove unnecessary dup()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau qemu_chr_fe_get_msgfd() transfers ownership, there is no need to dup the fd. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v2 06/50] ivshmem: factor out the incoming fifo handling

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Make a new function fifo_update_and_get() that can be reused by other functions (in next commits). Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 59 --- 1 file changed, 39 inser

[Qemu-devel] [PULL v2 17/50] ivshmem: remove max_peer field

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau max_peer isn't really useful, it tracks the maximum received VM id, but that quickly matches nb_peers, the size of the peers array. Since VM come and go, there might be sparse peers so it doesn't help much in general to have this value around. Signed-off-by: Marc-André Lu

[Qemu-devel] [PULL v2 08/50] ivshmem: remove superflous ivshmem_attr field

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fbeb731..7138b8d 100644 --- a/hw/misc/ivshmem.c +++ b/hw/

[Qemu-devel] [PULL v2 10/50] ivshmem: more qdev conversion

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Use the latest qemu device modeling API, in particular, convert to realize to fix the error handling; right now a botched device_add ivhsmem command kills the VM. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 119

[Qemu-devel] [PULL v2 18/50] ivshmem: improve debug messages

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Some misc improvements to ivshmem debug. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index c4c130d..50f9c8f 1006

[Qemu-devel] [PULL v2 15/50] ivshmem: remove useless ivshmem_update_irq() val argument

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau val isn't used in ivshmem_update_irq() function. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 19640bb..374ecff

[Qemu-devel] [PULL v2 21/50] ivshmem: simplify a bit the code

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Use some more explicit variables to simplify the code. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivs

[Qemu-devel] [PULL v2 19/50] ivshmem: improve error handling

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The test whether the chardev is an AF_UNIX socket rejects "-chardev socket,id=chr0,path=/tmp/foo,server,nowait -device ivshmem,chardev=chr0", but fails to explain why. Use an explicit error on why a chardev may be rejected. Signed-off-by: Marc-André Lureau Reviewed-by:

[Qemu-devel] [PULL v2 11/50] ivshmem: remove last exit(1)

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Failing to create a chardev shouldn't be fatal. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 62547c0..e7224b9 100644 -

[Qemu-devel] [PULL v2 22/50] ivshmem: use common return

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Both if branches return, move this out to common end. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index c054e52..fbb6f40

[Qemu-devel] [PULL v2 12/50] ivshmem: limit maximum number of peers to G_MAXUINT16

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Limit the maximum number of peers to MAXUINT16. This is more realistic and better matches the limit of the doorbell register. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

[Qemu-devel] [PULL v2 16/50] ivshmem: initialize max_peer to -1

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau There is no peer when device is initialized, do not let doorbell for inexisting peer 0. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/mi

[Qemu-devel] [PULL v2 30/50] ivshmem: error on too many eventfd received

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The number of eventfd that can be handled per peer is limited by the number of vectors. Return an error when receiving too many of them. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 8 insertions(+) d

[Qemu-devel] [PULL v2 23/50] ivshmem: use common is_power_of_2()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The common version correctly checks for 0 value case. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fbb6f40..e678b

[Qemu-devel] [PULL v2 29/50] ivshmem: replace 'guest' for 'peer' appropriately

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The terms 'guest' and 'peer' are used sometime interchangeably which may be confusing. Instead, use 'peer' for the remote instances of ivshmem clients, and 'guest' for the local VM. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 2

[Qemu-devel] [PULL v2 20/50] ivshmem: print error on invalid peer id

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The server shouldn't send invalid peer id, so print an error if it's the case. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index d7a00bd..6

[Qemu-devel] [PULL v2 14/50] ivshmem: allocate eventfds in resize_peers()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau It simplifies a bit the code to allocate the array when setting the number of peers instead of lazily when receiving the first vector. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 11 ++- 1 file changed, 2 insertions(+),

[Qemu-devel] [PULL v2 24/50] ivshmem: migrate with VMStateDescription

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau load_state_old() is used to keep compatibility with version 0. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 142 ++ 1 file changed, 89 insertions(+), 53 deletions(-) diff --gi

[Qemu-devel] [PULL v2 09/50] ivshmem: remove useless doorbell field

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 7138b8d..dea4096 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -71,7 +71,6 @@ t

[Qemu-devel] [PULL v2 26/50] ivshmem: check shm isn't already initialized

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The server should not change the shm, and this isn't handled by qemu and we should should verify this in qemu. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/misc/ivshmem.

[Qemu-devel] [PULL v2 31/50] ivshmem: reset mask on device reset

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The interrupt mask is a state value, it should be reset, like the interrupt status. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 50af4

[Qemu-devel] [PULL v2 27/50] ivshmem: add device description

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 9023f95..7be3d5e 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -925,6 +925,7 @

[Qemu-devel] [PULL v2 33/50] ivshmem-client: check the number of vectors

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Check the number of vectors received from the server, to avoid out of bound array access. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- contrib/ivshmem-client/ivshmem-client.c | 5 + 1 file changed, 5 insertions(+) diff --git a/contrib/ivshmem-

[Qemu-devel] [PULL v2 34/50] ivshmem-server: use a uint16 for client ID

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau In practice, the number of VM is limited to MAXUINT16 in ivshmem, so use the same limit on the server (removes a theorical infinite loop) Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- contrib/ivshmem-server/ivshmem-server.c | 11 ++- contrib

[Qemu-devel] [PULL v2 36/50] docs: update ivshmem device spec

2015-10-12 Thread marcandre . lureau
From: David Marchand Add some notes on the parts needed to use ivshmem devices: more specifically, explain the purpose of an ivshmem server and the basic concept to use the ivshmem devices in guests. Move some parts of the documentation and re-organise it. Signed-off-by: David Marchand Reviewed

[Qemu-devel] [PULL v2 37/50] ivshmem: add check on protocol version in QEMU

2015-10-12 Thread marcandre . lureau
From: David Marchand Send a protocol version as the first message from server, clients must close communication if they don't support this protocol version. Older QEMUs should be fine with this change in the protocol since they overrides their own vm_id on reception of an id associated to no eve

[Qemu-devel] [PULL v2 41/50] glib-compat: add 2.38/2.40/2.46 asserts

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Those are mostly useful for writing tests. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- include/glib-compat.h | 61 +++ 1 file changed, 61 insertions(+) diff --git a/include/glib-compat.h b/include/g

[Qemu-devel] [PULL v2 38/50] contrib: remove unnecessary strdup()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau getopt() optarg points to argv memory, no need to dup those values, fixes small leaks detected by clang-analyzer. Signed-off-by: Marc-André Lureau Reviewed-by: Vladimir Sementsov-Ogievskiy --- contrib/ivshmem-client/main.c | 2 +- contrib/ivshmem-server/main.c | 6 +++-

[Qemu-devel] [PULL v2 49/50] ivshmem: use little-endian int64_t for the protocol

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The current ivshmem protocol uses 'long' for integers. But the sizeof(long) depends on the host and the endianess is not defined, which may cause portability troubles. Instead, switch to using little-endian int64_t. This breaks the protocol, except on x64 little-endian ho

[Qemu-devel] [PULL v2 35/50] ivshmem-server: fix hugetlbfs support

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau As pointed out on the ML by Andrew Jones, glibc no longer permits creating POSIX shm on hugetlbfs directly. When given a hugetlbfs path, create a shareable file there. Signed-off-by: Marc-André Lureau Reviewed-by: Vladimir Sementsov-Ogievskiy --- contrib/ivshmem-server

[Qemu-devel] [PULL v2 50/50] doc: document ivshmem & hugepages

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Document and give some examples of hugepages support with ivshmem device and server. Signed-off-by: Marc-André Lureau Reviewed-by: Eric Blake --- qemu-doc.texi | 13 + 1 file changed, 13 insertions(+) diff --git a/qemu-doc.texi b/qemu-doc.texi index afa226

[Qemu-devel] [PULL v2 43/50] ivshmem: do not keep shm_fd open

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Remove shm_fd from device state, closing it as early as possible to avoid leaks. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v2 44/50] ivshmem: use qemu_strtosz()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Use the common qemu utility function to parse the memory size. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/hw/misc/ivshmem.

[Qemu-devel] [PULL v2 40/50] qtest: add qtest_add_abrt_handler()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Allow a test to add abort handlers, use GHook for all handlers. There is currently no way to remove a handler, but it could be later added if needed. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- tests/libqtest.c | 37 --

[Qemu-devel] [PULL v2 46/50] ivshmem: remove EventfdEntry.vector

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau No need to store an extra int for the vector number when it can be computed easily by looking at the position in the array. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

[Qemu-devel] [PULL v2 42/50] tests: add ivshmem qtest

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Adds 4 ivshmemtests: - single qemu instance and basic IO - pair of instances, check memory sharing - pair of instances with server, and MSIX - hot plug/unplug A temporary shm is created as well as a directory to place server socket, both should be clear on exit and abort.

[Qemu-devel] [PULL v2 13/50] ivshmem: simplify around increase_dynamic_storage()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Set the number of peers and array allocation in a single place. Rename to better reflect the function content. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 27 +++ 1 file changed, 11 insertions(+), 16 del

[Qemu-devel] [PULL v2 39/50] msix: implement pba write (but read-only)

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau qpci_msix_pending() writes on pba region, causing qemu to SEGV: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x77fba8c0 (LWP 25882)] 0x in ?? () (gdb) bt #0 0x in () #1 0x556556c5 in m

[Qemu-devel] [PULL v2 45/50] ivshmem: add hostmem backend

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Instead of handling allocation, teach ivshmem to use a memory backend. This allows to use hugetlbfs backed memory now. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c| 84 +--- test

[Qemu-devel] [PULL v2 47/50] ivshmem: rename MSI eventfd_table

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau The array is used to have vector specific data, so use a more descriptive name. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v2 48/50] ivshmem: use kvm irqfd for msi notifications

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Use irqfd for improving context switch when notifying the guest. If the host doesn't support kvm irqfd, regular msi notifications are still supported. Note: the ivshmem implementation doesn't allow switching between MSI and IO interrupts, this patch doesn't either. Signe

[Qemu-devel] [PULL v2 28/50] ivshmem: fix pci_ivshmem_exit()

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau Free all objects owned by the device, making sure the device is free, fixing hot-unplug. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) d

[Qemu-devel] [PULL v2 32/50] contrib: add ivshmem client and server

2015-10-12 Thread marcandre . lureau
From: David Marchand When using ivshmem devices, notifications between guests can be sent as interrupts using a ivshmem-server (typical use described in documentation). The client is provided as a debug tool. Signed-off-by: Olivier Matz Signed-off-by: David Marchand [fix a valgrind warning, op

[Qemu-devel] [PULL v2 25/50] ivshmem: shmfd can be 0

2015-10-12 Thread marcandre . lureau
From: Marc-André Lureau 0 is a valid fd value, so change conditions and set -1 value early Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index

[Qemu-devel] [PULL v3 00/51] Ivshmem patches

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The following changes since commit c49d3411faae8ffaab8f7e5db47405a008411c10: Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-12' into staging (2015-10-13 10:42:06 +0100) are available in the git repository at: g...@github.com:elmarco/qemu.git ta

[Qemu-devel] [PULL v3 04/51] ivhsmem: read do not accept more than sizeof(long)

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau ivshmem_read() only reads sizeof(long) from the input buffer. Accepting more could lead to fifo8 abort() on 32bit systems if fifo is not empty. A following patch will change the protocol to 64-bit little-endian instead. Signed-off-by: Marc-André Lureau Reviewed-by: Cla

[Qemu-devel] [PULL v3 02/51] char: add qemu_chr_free()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau If a chardev is allowed to be created outside of QMP, then it must be also possible to free it. This is useful for ivshmem that creates chardev anonymously and must be able to free them. Signed-off-by: Marc-André Lureau Acked-by: Paolo Bonzini Reviewed-by: Claudio Fonta

[Qemu-devel] [PULL v3 10/51] ivshmem: more qdev conversion

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Use the latest qemu device modeling API, in particular, convert to realize to fix the error handling; right now a botched device_add ivhsmem command kills the VM. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 119

[Qemu-devel] [PULL v3 06/51] ivshmem: factor out the incoming fifo handling

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Make a new function fifo_update_and_get() that can be reused by other functions (in next commits). Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 59 --- 1 file changed, 39 inser

[Qemu-devel] [PULL v3 19/51] ivshmem: improve error handling

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The test whether the chardev is an AF_UNIX socket rejects "-chardev socket,id=chr0,path=/tmp/foo,server,nowait -device ivshmem,chardev=chr0", but fails to explain why. Use an explicit error on why a chardev may be rejected. Signed-off-by: Marc-André Lureau Reviewed-by:

[Qemu-devel] [PULL v3 21/51] ivshmem: simplify a bit the code

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Use some more explicit variables to simplify the code. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivs

[Qemu-devel] [PULL v3 05/51] ivshmem: fix number of bytes to push to fifo

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau If the fifo has 0 bytes, and the read is of size 1, the call to fifo8_push_all() will copy off boundary data. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc

[Qemu-devel] [PULL v3 11/51] ivshmem: remove last exit(1)

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Failing to create a chardev shouldn't be fatal. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 62547c0..e7224b9 100644 -

[Qemu-devel] [PULL v3 07/51] ivshmem: remove unnecessary dup()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau qemu_chr_fe_get_msgfd() transfers ownership, there is no need to dup the fd. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v3 26/51] ivshmem: check shm isn't already initialized

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The server should not change the shm, and this isn't handled by qemu and we should should verify this in qemu. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/misc/ivshmem.

[Qemu-devel] [PULL v3 18/51] ivshmem: improve debug messages

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Some misc improvements to ivshmem debug. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index c4c130d..50f9c8f 1006

[Qemu-devel] [PULL v3 14/51] ivshmem: allocate eventfds in resize_peers()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau It simplifies a bit the code to allocate the array when setting the number of peers instead of lazily when receiving the first vector. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 11 ++- 1 file changed, 2 insertions(+),

[Qemu-devel] [PULL v3 42/51] glib-compat: add 2.38/2.40/2.46 asserts

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Those are mostly useful for writing tests. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- include/glib-compat.h | 61 +++ 1 file changed, 61 insertions(+) diff --git a/include/glib-compat.h b/include/g

[Qemu-devel] [PULL v3 23/51] ivshmem: use common is_power_of_2()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The common version correctly checks for 0 value case. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fbb6f40..e678b

[Qemu-devel] [PULL v3 29/51] ivshmem: replace 'guest' for 'peer' appropriately

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The terms 'guest' and 'peer' are used sometime interchangeably which may be confusing. Instead, use 'peer' for the remote instances of ivshmem clients, and 'guest' for the local VM. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 2

[Qemu-devel] [PULL v3 22/51] ivshmem: use common return

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Both if branches return, move this out to common end. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index c054e52..fbb6f40

[Qemu-devel] [PULL v3 48/51] ivshmem: rename MSI eventfd_table

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The array is used to have vector specific data, so use a more descriptive name. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v3 28/51] ivshmem: fix pci_ivshmem_exit()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Free all objects owned by the device, making sure the device is free, fixing hot-unplug. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) d

[Qemu-devel] [PULL v3 32/51] util: const event_notifier_get_fd() argument

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- include/qemu/event_notifier.h | 2 +- util/event_notifier-posix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qemu/event_notifier.h b/include/qemu/event_notifier.h index 88b57af..a8f2854 100644 ---

[Qemu-devel] [PULL v3 31/51] ivshmem: reset mask on device reset

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The interrupt mask is a state value, it should be reset, like the interrupt status. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 50af4

[Qemu-devel] [PULL v3 20/51] ivshmem: print error on invalid peer id

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The server shouldn't send invalid peer id, so print an error if it's the case. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index d7a00bd..6

[Qemu-devel] [PULL v3 50/51] ivshmem: use little-endian int64_t for the protocol

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The current ivshmem protocol uses 'long' for integers. But the sizeof(long) depends on the host and the endianess is not defined, which may cause portability troubles. Instead, switch to using little-endian int64_t. This breaks the protocol, except on x64 little-endian ho

[Qemu-devel] [PULL v3 34/51] ivshmem-client: check the number of vectors

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Check the number of vectors received from the server, to avoid out of bound array access. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- contrib/ivshmem-client/ivshmem-client.c | 5 + 1 file changed, 5 insertions(+) diff --git a/contrib/ivshmem-

[Qemu-devel] [PULL v3 35/51] ivshmem-server: use a uint16 for client ID

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau In practice, the number of VM is limited to MAXUINT16 in ivshmem, so use the same limit on the server (removes a theorical infinite loop) Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- contrib/ivshmem-server/ivshmem-server.c | 11 ++- contrib

[Qemu-devel] [PULL v3 30/51] ivshmem: error on too many eventfd received

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau The number of eventfd that can be handled per peer is limited by the number of vectors. Return an error when receiving too many of them. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 8 insertions(+) d

[Qemu-devel] [PULL v3 37/51] docs: update ivshmem device spec

2015-10-13 Thread marcandre . lureau
From: David Marchand Add some notes on the parts needed to use ivshmem devices: more specifically, explain the purpose of an ivshmem server and the basic concept to use the ivshmem devices in guests. Move some parts of the documentation and re-organise it. Signed-off-by: David Marchand Reviewed

[Qemu-devel] [PULL v3 33/51] contrib: add ivshmem client and server

2015-10-13 Thread marcandre . lureau
From: David Marchand When using ivshmem devices, notifications between guests can be sent as interrupts using a ivshmem-server (typical use described in documentation). The client is provided as a debug tool. Signed-off-by: Olivier Matz Signed-off-by: David Marchand [fix a valgrind warning, op

[Qemu-devel] [PULL v3 25/51] ivshmem: shmfd can be 0

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau 0 is a valid fd value, so change conditions and set -1 value early Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index

[Qemu-devel] [PULL v3 39/51] contrib: remove unnecessary strdup()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau getopt() optarg points to argv memory, no need to dup those values, fixes small leaks detected by clang-analyzer. Signed-off-by: Marc-André Lureau Reviewed-by: Vladimir Sementsov-Ogievskiy --- contrib/ivshmem-client/main.c | 2 +- contrib/ivshmem-server/main.c | 6 +++-

[Qemu-devel] [PULL v3 40/51] msix: implement pba write (but read-only)

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau qpci_msix_pending() writes on pba region, causing qemu to SEGV: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x77fba8c0 (LWP 25882)] 0x in ?? () (gdb) bt #0 0x in () #1 0x556556c5 in m

[Qemu-devel] [PULL v3 41/51] qtest: add qtest_add_abrt_handler()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Allow a test to add abort handlers, use GHook for all handlers. There is currently no way to remove a handler, but it could be later added if needed. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- tests/libqtest.c | 37 --

[Qemu-devel] [PULL v3 38/51] ivshmem: add check on protocol version in QEMU

2015-10-13 Thread marcandre . lureau
From: David Marchand Send a protocol version as the first message from server, clients must close communication if they don't support this protocol version. Older QEMUs should be fine with this change in the protocol since they overrides their own vm_id on reception of an id associated to no eve

[Qemu-devel] [PULL v3 46/51] ivshmem: add hostmem backend

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Instead of handling allocation, teach ivshmem to use a memory backend. This allows to use hugetlbfs backed memory now. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c| 84 +--- test

[Qemu-devel] [PULL v3 09/51] ivshmem: remove useless doorbell field

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 7138b8d..dea4096 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -71,7 +71,6 @@ t

[Qemu-devel] [PULL v3 43/51] tests: add ivshmem qtest

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Adds 4 ivshmemtests: - single qemu instance and basic IO - pair of instances, check memory sharing - pair of instances with server, and MSIX - hot plug/unplug A temporary shm is created as well as a directory to place server socket, both should be clear on exit and abort.

[Qemu-devel] [PULL v3 45/51] ivshmem: use qemu_strtosz()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Use the common qemu utility function to parse the memory size. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/hw/misc/ivshmem.

[Qemu-devel] [PULL v3 51/51] doc: document ivshmem & hugepages

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Document and give some examples of hugepages support with ivshmem device and server. Signed-off-by: Marc-André Lureau Reviewed-by: Eric Blake --- qemu-doc.texi | 13 + 1 file changed, 13 insertions(+) diff --git a/qemu-doc.texi b/qemu-doc.texi index afa226

[Qemu-devel] [PULL v3 47/51] ivshmem: remove EventfdEntry.vector

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau No need to store an extra int for the vector number when it can be computed easily by looking at the position in the array. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

[Qemu-devel] [PULL v3 17/51] ivshmem: remove max_peer field

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau max_peer isn't really useful, it tracks the maximum received VM id, but that quickly matches nb_peers, the size of the peers array. Since VM come and go, there might be sparse peers so it doesn't help much in general to have this value around. Signed-off-by: Marc-André Lu

[Qemu-devel] [PULL v3 24/51] ivshmem: migrate with VMStateDescription

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau load_state_old() is used to keep compatibility with version 0. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 142 ++ 1 file changed, 89 insertions(+), 53 deletions(-) diff --gi

[Qemu-devel] [PULL v3 03/51] msix: add VMSTATE_MSIX_TEST

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau ivshmem is going to use MSIX state conditionally. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- include/hw/pci/msix.h | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h

[Qemu-devel] [PULL v3 13/51] ivshmem: simplify around increase_dynamic_storage()

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Set the number of peers and array allocation in a single place. Rename to better reflect the function content. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 27 +++ 1 file changed, 11 insertions(+), 16 del

[Qemu-devel] [PULL v3 27/51] ivshmem: add device description

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 9023f95..7be3d5e 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -925,6 +925,7 @

[Qemu-devel] [PULL v3 01/51] tests: Add ivshmem qtest

2015-10-13 Thread marcandre . lureau
From: Andreas Färber Note that it launches two instances, as sharing memory is the purpose of ivshmem. Cc: Cam Macdonell Cc: Marc-André Lureau Signed-off-by: Andreas Färber [ Remove Nahanni codename, add test to pci set - Marc-André ] Signed-off-by: Marc-André Lureau --- tests/Makefile

[Qemu-devel] [PULL v3 16/51] ivshmem: initialize max_peer to -1

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau There is no peer when device is initialized, do not let doorbell for inexisting peer 0. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/mi

[Qemu-devel] [PULL v3 12/51] ivshmem: limit maximum number of peers to G_MAXUINT16

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Limit the maximum number of peers to MAXUINT16. This is more realistic and better matches the limit of the doorbell register. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

[Qemu-devel] [PULL v3 44/51] ivshmem: do not keep shm_fd open

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Remove shm_fd from device state, closing it as early as possible to avoid leaks. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/misc/ivshmem.c

[Qemu-devel] [PULL v3 15/51] ivshmem: remove useless ivshmem_update_irq() val argument

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau val isn't used in ivshmem_update_irq() function. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 19640bb..374ecff

[Qemu-devel] [PULL v3 08/51] ivshmem: remove superflous ivshmem_attr field

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fbeb731..7138b8d 100644 --- a/hw/misc/ivshmem.c +++ b/hw/

[Qemu-devel] [PULL v3 36/51] ivshmem-server: fix hugetlbfs support

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau As pointed out on the ML by Andrew Jones, glibc no longer permits creating POSIX shm on hugetlbfs directly. When given a hugetlbfs path, create a shareable file there. Signed-off-by: Marc-André Lureau Reviewed-by: Vladimir Sementsov-Ogievskiy --- contrib/ivshmem-server

[Qemu-devel] [PULL v3 49/51] ivshmem: use kvm irqfd for msi notifications

2015-10-13 Thread marcandre . lureau
From: Marc-André Lureau Use irqfd for improving context switch when notifying the guest. If the host doesn't support kvm irqfd, regular msi notifications are still supported. Note: the ivshmem implementation doesn't allow switching between MSI and IO interrupts, this patch doesn't either. Signe

[Qemu-devel] [PATCH] tests: re-enable vhost-user-test

2015-10-15 Thread marcandre . lureau
From: Marc-André Lureau Commit 7fe34ca9c2e actually disabled vhost-user-test altogether, since CONFIG_VHOST_NET is a per-target config variable. CONFIG_VHOST_NET_USED is the host config, actually unused since 1322629b4f2. But it was set whenever vhost_net was enabled. tests/vhost-user-test is a

[Qemu-devel] [PATCH] tests: re-enable vhost-user-test

2015-10-15 Thread marcandre . lureau
From: Marc-André Lureau Commit 7fe34ca9c2e actually disabled vhost-user-test altogether, since CONFIG_VHOST_NET is a per-target config variable. tests/vhost-user-test is already x86/64 softmmu specific test, in order to enable it correctly, kvm & vhost-net are also conditions. To check that, set

<    1   2   3   4   5   6   7   8   9   10   >