Re: [Qemu-devel] [PATCH v3 0/4] ARRAY_SIZE fixups

2017-01-19 Thread Markus Armbruster
"Michael S. Tsirkin" writes: > Turns out virtio kept using ARRAY_SIZE on fields which stopped > being arrays, this was noticed by a coverity scan. > I fixed this up, this patchset fixes up the ARRAY_SIZE macro so that this > bug does not reappear in any other place. Preferably with the tweaks I

[Qemu-devel] [PATCH v11 16/16] tests: Add test-image-lock

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/Makefile.include | 2 + tests/test-image-lock.c | 200 +++ tests/test-replication.c | 6 +- 3 files changed, 205 insertions(+), 3 deletions(-) create mode 100644 tests/test-image-lock.c diff --git a/tests/Make

[Qemu-devel] [PATCH v11 15/16] qcow2: Force "no other writer" lock on bs->file

2017-01-19 Thread Fam Zheng
Writing to the same qcow2 file from two QEMU processes at the same time will never work correctly, so disable it even when the caller specifies BDRV_O_RDWR. Other formats are less vulnerable because they don't have internal snapshots thus qemu-img is less often misused to create live snapshot. Si

Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct

2017-01-19 Thread Markus Armbruster
Eric Blake writes: > On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: >> There are theoretical concerns that some compilers might not trigger >> build failures on attempts to define an array of size -1 and make it a >> variable sized array instead. > > Rather, the concern is that if someone chan

Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct

2017-01-19 Thread Markus Armbruster
"Michael S. Tsirkin" writes: > There are theoretical concerns that some compilers might not trigger > build failures on attempts to define an array of size -1 and make it a > variable sized array instead. Let rewrite using a struct with a negative > bit field size instead as there are no dynamic

[Qemu-devel] [PATCH v11 09/16] iotests: 085: Avoid image locking conflict

2017-01-19 Thread Fam Zheng
In the case where we test the expected error when a blockdev-snapshot target already has a backing image, backing chain is opened multiple times. This will be a problem when we use image locking, so use a different backing file that is not already open. Signed-off-by: Fam Zheng --- tests/qemu-io

[Qemu-devel] [PATCH v11 06/16] iotests: 055: Don't attach the drive to vm for drive-backup

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/qemu-iotests/055 | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 1d3fd04..20a7596 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -45

[Qemu-devel] [PATCH v11 05/16] block: Set "share-rw" flag in drive-backup when sync=none

2017-01-19 Thread Fam Zheng
In this case we may open the source's backing image chain multiple times. Setting share flag means the new open won't try to acquire or check any lock, once we implement image locking. Signed-off-by: Fam Zheng --- blockdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockdev.c b/blo

Re: [Qemu-devel] [PATCH v3 4/4] ARRAY_SIZE: check that argument is an array

2017-01-19 Thread Markus Armbruster
Eric Blake writes: > On 01/19/2017 04:11 PM, Michael S. Tsirkin wrote: > +#define QEMU_IS_ARRAY(x) (!__builtin_types_compatible_p(typeof(x), \ +typeof(&(x)[0]))) #ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / siz

[Qemu-devel] [PATCH v11 11/16] iotests: 172: Use separate images for multiple devices

2017-01-19 Thread Fam Zheng
To avoid image lock failures. Signed-off-by: Fam Zheng --- tests/qemu-iotests/172 | 53 -- tests/qemu-iotests/172.out | 50 ++- 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/tests/qemu-iote

[Qemu-devel] [PATCH v11 12/16] tests: Use null-co:// instead of /dev/null as the dummy image

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/drive_del-test.c| 2 +- tests/nvme-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-scsi-test.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a

[Qemu-devel] [PATCH v11 03/16] qemu-io: Set "share-rw" flag together with read-only

2017-01-19 Thread Fam Zheng
qemu-io is a low level tool to read or modify guest visible data, which implies the user knows very well what is being done. Allowing reading from a locked image is harmless in most cases, so do it. Signed-off-by: Fam Zheng --- qemu-io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu

[Qemu-devel] [PATCH v11 14/16] file-posix: Implement image locking

2017-01-19 Thread Fam Zheng
This implements open flag sensible image locking for local file and host device protocol. virtlockd in libvirt locks the first byte, so we start looking at the file bytes from 1. Quoting what was proposed by Kevin Wolf , there are four locking modes by combining two bits (BDRV_O_RDWR and BDRV_O_S

[Qemu-devel] [PATCH v11 13/16] tests: Disable image lock in test-replication

2017-01-19 Thread Fam Zheng
The COLO block replication architecture requires one disk to be shared between primary and secondary, in the test both processes use posix file protocol (instead of over NBD) so it is affected by image locking. Disable the lock. Signed-off-by: Fam Zheng --- tests/test-replication.c | 9 +++--

[Qemu-devel] [PATCH v11 10/16] iotests: 091: Quit QEMU before checking image

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/qemu-iotests/091 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 32bbd56..10ac4a8 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -95,7 +95,9 @@ echo "vm2: qemu process running succe

[Qemu-devel] [PATCH v11 01/16] osdep: Add qemu_lock_fd and qemu_unlock_fd

2017-01-19 Thread Fam Zheng
They are wrappers of POSIX fcntl "file private locking", with a convenient "try lock" wrapper implemented with F_OFD_GETLK. Signed-off-by: Fam Zheng --- include/qemu/osdep.h | 3 +++ util/osdep.c | 48 2 files changed, 51 insertions(+) d

[Qemu-devel] [PATCH v11 04/16] qemu-img: Set "share-rw" flag in read-only commands

2017-01-19 Thread Fam Zheng
Checking the status of an image when it is being used by guest is usually useful, and there is no risk of corrupting data, so don't let the upcoming image locking feature limit this use case. Signed-off-by: Fam Zheng --- qemu-img.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-)

[Qemu-devel] [PATCH v11 07/16] iotests: 030: Read-only open image for getting map

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/qemu-iotests/030 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 54db54a..fe0c73f 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -114,7 +114,7 @@ class TestSingleD

[Qemu-devel] [PATCH v11 08/16] iotests: 087: Don't attach test image twice

2017-01-19 Thread Fam Zheng
The test scenario doesn't require the same image, instead it focuses on the duplicated node-name, so use null-co to avoid locking conflict. Signed-off-by: Fam Zheng --- tests/qemu-iotests/087 | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/087 b/tests

[Qemu-devel] [PATCH v11 00/16] block: Image locking series

2017-01-19 Thread Fam Zheng
v11: Move lock bytes from 1-2 to 0x10-0x12. [Daniel] v10: While we still don't have comprehensive propagation mechanism that will be provided by new op blocker system for "permissive modes", the locking enabled by default is regardlessly useful and long overdue. So I think we should merge this for

[Qemu-devel] [PATCH v11 02/16] block: Define BDRV_O_SHARE_RW

2017-01-19 Thread Fam Zheng
Signed-off-by: Fam Zheng --- include/block/block.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 8b0dcda..243839d 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -97,6 +97,8 @@ typedef struct HDGeometry {

Re: [Qemu-devel] [PATCH v2 3/4] compiler: expression version of QEMU_BUILD_BUG_ON

2017-01-19 Thread Markus Armbruster
"Michael S. Tsirkin" writes: > On Thu, Jan 19, 2017 at 02:33:40PM +0100, Markus Armbruster wrote: >> Paolo Bonzini writes: >> >> > On 19/01/2017 09:12, Markus Armbruster wrote: >> >> "Michael S. Tsirkin" writes: >> >> >> >>> QEMU_BUILD_BUG_ON uses a typedef in order to be safe >> >>> to use o

Re: [Qemu-devel] [PATCH v2 6/6] qapi: Promote blockdev-change-medium arguments to QAPI type

2017-01-19 Thread Markus Armbruster
Eric Blake writes: > On 01/19/2017 03:48 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> Having a named rather than anonymous C type will make it easier >>> to improve the testsuite in a later patch. >> >> Post it together with said later patch then. > > It was that way in the v1 ser

Re: [Qemu-devel] [PATCH RFC v11 3/4] vfio-pci: pass the aer error to guest

2017-01-19 Thread Tian, Kevin
> From: Alex Williamson > Sent: Thursday, January 19, 2017 6:32 AM > > On Sat, 31 Dec 2016 17:13:07 +0800 > Cao jin wrote: > > > From: Chen Fan > > > > When physical device has uncorrectable error hanppened, the vfio_pci > > driver will signal the uncorrectable error status register value to >

Re: [Qemu-devel] [PATCH RFC v11 3/4] vfio-pci: pass the aer error to guest

2017-01-19 Thread Cao jin
On 01/19/2017 06:31 AM, Alex Williamson wrote: > On Sat, 31 Dec 2016 17:13:07 +0800 > Cao jin wrote: > >> From: Chen Fan >> >> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c >> index 76a8ac3..9861f72 100644 >> --- a/hw/vfio/pci.c >> +++ b/hw/vfio/pci.c >> @@ -2470,21 +2470,55 @@ static void vfio_

[Qemu-devel] [PATCH] intel_iommu: fix and simplify size calculation in process_device_iotlb_desc()

2017-01-19 Thread Jason Wang
We don't use 1ULL which is wrong during size calculation. Fix it, and while at it, switch to use cto64() and adds a comments to make it simpler and easier to be understood. Reported-by: Paolo Bonzini Cc: Paolo Bonzini Signed-off-by: Jason Wang --- hw/i386/intel_iommu.c | 10 +- 1 file

Re: [Qemu-devel] [PATCH RFC v11 4/4] vfio: add 'aer' property to expose aercap

2017-01-19 Thread Cao jin
On 01/19/2017 06:36 AM, Alex Williamson wrote: > On Sat, 31 Dec 2016 17:13:08 +0800 > Cao jin wrote: > >> From: Chen Fan >> >> Add 'aer' property, let user choose whether expose the aer capability >> or not. > > But that's not what it does, it only controls the behavior in response > to non-f

Re: [Qemu-devel] [PATCH RFC v11 2/4] vfio: new function to init aer cap for vfio device

2017-01-19 Thread Cao jin
On 01/19/2017 06:09 AM, Alex Williamson wrote: > On Sat, 31 Dec 2016 17:13:06 +0800 > Cao jin wrote: > >> From: Chen Fan >> >> Introduce new function to initilize AER capability registers >> for vfio-pci device. >> >> Signed-off-by: Chen Fan >> Signed-off-by: Dou Liyang >> Signed-off-by: Cao

Re: [Qemu-devel] [PATCH RFC 0/3] vfio: allow to notify unmap for very big region

2017-01-19 Thread Peter Xu
On Thu, Jan 19, 2017 at 09:21:10PM -0700, Alex Williamson wrote: > On Fri, 20 Jan 2017 11:43:28 +0800 > Peter Xu wrote: > > > On Thu, Jan 19, 2017 at 10:54:37AM -0700, Alex Williamson wrote: > > > On Thu, 19 Jan 2017 17:25:29 +0800 > > > Peter Xu wrote: > > > > > > > This requirement originat

Re: [Qemu-devel] [PATCH RFC 0/3] vfio: allow to notify unmap for very big region

2017-01-19 Thread Alex Williamson
On Fri, 20 Jan 2017 11:43:28 +0800 Peter Xu wrote: > On Thu, Jan 19, 2017 at 10:54:37AM -0700, Alex Williamson wrote: > > On Thu, 19 Jan 2017 17:25:29 +0800 > > Peter Xu wrote: > > > > > This requirement originates from the VT-d vfio series: > > > > > > https://lists.nongnu.org/archive/htm

[Qemu-devel] [PATCH v3 4/6] replication: fix code logic with the new shared_disk option

2017-01-19 Thread zhanghailiang
Some code logic only be needed in non-shared disk, here we adjust these codes to prepare for shared disk scenario. Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang --- block/replication.c | 47 --- 1 file changed, 28 insertions(+), 19 deletio

[Qemu-devel] [PATCH v3 5/6] replication: Implement block replication for shared disk case

2017-01-19 Thread zhanghailiang
Just as the scenario of non-shared disk block replication, we are going to implement block replication from many basic blocks that are already in QEMU. The architecture is: virtio-blk || .-- /

[Qemu-devel] [PATCH v3 2/6] replication: add shared-disk and shared-disk-id options

2017-01-19 Thread zhanghailiang
We use these two options to identify which disk is shared Cc: Eric Blake Signed-off-by: zhanghailiang Signed-off-by: Wen Congyang Signed-off-by: Zhang Chen --- v3: - Move g_free(s->shared_disk_id) to the common fail process place (Stefan) - Fix comments for these two options --- block/replica

[Qemu-devel] [PATCH v3 3/6] replication: Split out backup_do_checkpoint() from secondary_do_checkpoint()

2017-01-19 Thread zhanghailiang
The helper backup_do_checkpoint() will be used for primary related codes. Here we split it out from secondary_do_checkpoint(). Besides, it is unnecessary to call backup_do_checkpoint() in replication starting and normally stop replication path. We only need call it while do real checkpointing. Re

[Qemu-devel] [PATCH v3 0/6] COLO block replication supports shared disk case

2017-01-19 Thread zhanghailiang
COLO block replication doesn't support the shared disk case, Here we try to implement it and this is the third version. Last posted series patches: https://lists.gnu.org/archive/html/qemu-block/2016-12/msg00039.html You can refer to the above link if want to test it. I have uploaded the new versi

[Qemu-devel] [PATCH v3 1/6] docs/block-replication: Add description for shared-disk case

2017-01-19 Thread zhanghailiang
Introuduce the scenario of shared-disk block replication and how to use it. Reviewed-by: Changlong Xie Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang Signed-off-by: Wen Congyang Signed-off-by: Zhang Chen --- docs/block-replication.txt | 139

[Qemu-devel] [PATCH v3 6/6] nbd/replication: implement .bdrv_get_info() for nbd and replication driver

2017-01-19 Thread zhanghailiang
Without this callback, there will be an error reports in the primary side: "qemu-system-x86_64: Couldn't determine the cluster size of the target image, which has no backing file: Operation not supported Aborting, since this may create an unusable destination image" For nbd driver, it doesn't have

Re: [Qemu-devel] [PATCH RFC 0/3] vfio: allow to notify unmap for very big region

2017-01-19 Thread Peter Xu
On Thu, Jan 19, 2017 at 10:54:37AM -0700, Alex Williamson wrote: > On Thu, 19 Jan 2017 17:25:29 +0800 > Peter Xu wrote: > > > This requirement originates from the VT-d vfio series: > > > > https://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg03495.html > > > > The goal of this series i

Re: [Qemu-devel] [RFC 05/13] pc: move pcms->possible_cpus init out of pc_cpus_init()

2017-01-19 Thread Dou Liyang
At 01/19/2017 01:13 AM, Igor Mammedov wrote: possible_cpus could be initialized earlier then cpu objects, s/then/than/ i.e. when -smp is parsed so move init code to possible_cpu_arch_ids() [...]

Re: [Qemu-devel] [PATCH] virtio: force VIRTIO_F_IOMMU_PLATFORM

2017-01-19 Thread Jason Wang
On 2017年01月20日 06:27, Michael S. Tsirkin wrote: On Thu, Jan 19, 2017 at 11:12:21AM +0800, Jason Wang wrote: On 2017年01月19日 01:50, Michael S. Tsirkin wrote: On Wed, Jan 18, 2017 at 10:42:48AM +0800, Jason Wang wrote: On 2017年01月17日 22:44, Michael S. Tsirkin wrote: On Tue, Jan 17, 2017 at 12

[Qemu-devel] [PULL 6/6] tap: fix memory leak on failure in net_init_tap()

2017-01-19 Thread Jason Wang
From: Peter Maydell Commit 091a6b2ac fixed most of the memory leaks in failure paths in net_init_tap() reported by Coverity (CID 1356216), but missed one. Fix it by deferring the allocation of fds and vhost_fds until after the error check. Signed-off-by: Peter Maydell Signed-off-by: Jason Wang

[Qemu-devel] [PULL 5/6] hw/pci: use-after-free in pci_nic_init_nofail when nic device fails to initialize

2017-01-19 Thread Jason Wang
From: Alex Kompel object_property_set_bool(OBJECT(dev), true, "realized", &err) in pci_nic_init_nofail may release the object if device fails to initialize which leads to use-after-free in error handling block. qdev_init_nofail does the same thing while holding the reference. (gdb) run -net nic

[Qemu-devel] [PULL 4/6] hw/net/dp8393x: Avoid unintentional sign extensions on addresses

2017-01-19 Thread Jason Wang
From: Peter Maydell The dp8393x has several 32-bit values which are formed by concatenating two 16 bit device register values. Attempting to do these inline with ((s->reg[HI] << 16) | s->reg[LO]) can result in an unintended sign extension because "x << 16" is of type 'int' even though s->reg is u

[Qemu-devel] [PULL 3/6] m68k: QOMify the MCF Fast Ethernet Controller device

2017-01-19 Thread Jason Wang
From: Thomas Huth When running qemu-system-m68k with the "-net" parameter (for example simply "-net nic -net user"), there is currently a confusing warning message saying: Warning: requested NIC (anonymous, model mcf_fec) was not created (not supported by this machine?) This seems to happen b

[Qemu-devel] [PULL 0/6] Net patches

2017-01-19 Thread Jason Wang
The following changes since commit 0f6bcf68a99efdc531b209551f2b760b0bdcc554: Merge remote-tracking branch 'remotes/artyom/tags/pull-sun4v-20170118' into staging (2017-01-19 18:34:13 +) are available in the git repository at: https://github.com/jasowang/qemu.git tags/net-pull-request fo

[Qemu-devel] [PULL 1/6] docs: Fix description of the sentence

2017-01-19 Thread Jason Wang
From: Zhang Chen Say it in another way to make it easier to understand. Signed-off-by: Zhang Chen Signed-off-by: Eric Blake Signed-off-by: Stefan Weil Signed-off-by: Jason Wang --- docs/colo-proxy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/colo-proxy.txt

[Qemu-devel] [PULL 2/6] net: optimize checksum computation

2017-01-19 Thread Jason Wang
From: Ladi Prosek Very simple loop optimization with a significant performance impact. Microbenchmark results, modern x86-64: buffer size | speed up +- 1500| 1.7x 64 | 1.5x 8 | 1.15x Microbenchmark results, POWER7: buffer size | speed up

[Qemu-devel] [PATCH] virtio: Fix no interrupt when not creating msi controller

2017-01-19 Thread Shannon Zhao
From: Shannon Zhao For ARM virt machine, if we use virt-2.7 which will not create ITS node, the virtio-net can not recieve interrupts so it can't get ip address through dhcp. This fixes commit 83d768b(virtio: set ISR on dataplane notifications). Signed-off-by: Shannon Zhao --- hw/virtio/virtio

Re: [Qemu-devel] [PATCH RFC v2 1/6] docs/block-replication: Add description for shared-disk case

2017-01-19 Thread Hailiang Zhang
On 2017/1/20 0:41, Stefan Hajnoczi wrote: On Thu, Jan 19, 2017 at 10:50:19AM +0800, Hailiang Zhang wrote: On 2017/1/13 21:41, Stefan Hajnoczi wrote: On Mon, Dec 05, 2016 at 04:34:59PM +0800, zhanghailiang wrote: +Issue qmp command: + { 'execute': 'blockdev-add', +'arguments': { +'

Re: [Qemu-devel] [PATCH RFC] vfio error recovery: kernel support

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 03:57:34PM -0700, Alex Williamson wrote: > On Fri, 20 Jan 2017 00:21:02 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Jan 19, 2017 at 03:10:56PM -0700, Alex Williamson wrote: > > > On Thu, 19 Jan 2017 22:16:03 +0200 > > > "Michael S. Tsirkin" wrote: > > > > > > > T

Re: [Qemu-devel] [PATCH] bitmap: assert that start and nr are non negative

2017-01-19 Thread Fam Zheng
On Thu, 01/19 17:43, Peter Lieven wrote: > commit e1123a3b introduced a data corruption regression > in the iscsi driver because it passed -1 as nr to bitmap_set > and bitmap_clear. Add an assertion to catch such flaws earlier. > > Suggested-by: Fam Zheng > Signed-off-by: Peter Lieven > --- > u

Re: [Qemu-devel] [PATCH v10 14/16] file-posix: Implement image locking

2017-01-19 Thread Fam Zheng
On Thu, 01/19 15:49, Daniel P. Berrange wrote: > On Thu, Jan 19, 2017 at 10:38:14PM +0800, Fam Zheng wrote: > > This implements open flag sensible image locking for local file > > and host device protocol. > > > > virtlockd in libvirt locks the first byte, so we start looking at the > > file bytes

Re: [Qemu-devel] [PATCH v7 05/27] tcg: add options for enabling MTTCG

2017-01-19 Thread Pranith Kumar
Alex Bennée writes: > From: KONRAD Frederic > > We know there will be cases where MTTCG won't work until additional work > is done in the front/back ends to support. It will however be useful to > be able to turn it on. > > As a result MTTCG will default to off unless the combination is > suppor

Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging

2017-01-19 Thread Haozhong Zhang
On 01/16/17 11:00 +, Stefan Hajnoczi wrote: On Mon, Jan 16, 2017 at 01:55:34PM +0800, Xiao Guangrong wrote: On 01/14/2017 02:02 AM, Eduardo Habkost wrote: > On Fri, Jan 13, 2017 at 01:17:27PM +, Stefan Hajnoczi wrote: > > On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote: >

Re: [Qemu-devel] [PATCH v7 26/27] tcg: enable MTTCG by default for ARM on x86 hosts

2017-01-19 Thread Pranith Kumar
Alex Bennée writes: > This enables the multi-threaded system emulation by default for ARMv7 > and ARMv8 guests using the x86_64 TCG backend. This is because on the > guest side: > > - The ARM translate.c/translate-64.c have been converted to > - use MTTCG safe atomic primitives > - emit

Re: [Qemu-devel] [PATCH v3 4/4] ARRAY_SIZE: check that argument is an array

2017-01-19 Thread Eric Blake
On 01/19/2017 04:11 PM, Michael S. Tsirkin wrote: >>> +#define QEMU_IS_ARRAY(x) (!__builtin_types_compatible_p(typeof(x), \ >>> +typeof(&(x)[0]))) >>> #ifndef ARRAY_SIZE >>> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) >>> +#define AR

Re: [Qemu-devel] [PATCH RFC] vfio error recovery: kernel support

2017-01-19 Thread Alex Williamson
On Fri, 20 Jan 2017 00:21:02 +0200 "Michael S. Tsirkin" wrote: > On Thu, Jan 19, 2017 at 03:10:56PM -0700, Alex Williamson wrote: > > On Thu, 19 Jan 2017 22:16:03 +0200 > > "Michael S. Tsirkin" wrote: > > > > > This is a design and an initial patch for kernel side for AER > > > support in VFI

Re: [Qemu-devel] [PATCH] virtio: force VIRTIO_F_IOMMU_PLATFORM

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 11:12:21AM +0800, Jason Wang wrote: > > > On 2017年01月19日 01:50, Michael S. Tsirkin wrote: > > On Wed, Jan 18, 2017 at 10:42:48AM +0800, Jason Wang wrote: > > > > > > On 2017年01月17日 22:44, Michael S. Tsirkin wrote: > > > > On Tue, Jan 17, 2017 at 12:01:00PM +0800, Jason Wa

Re: [Qemu-devel] [PATCH RFC] vfio error recovery: kernel support

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 03:10:56PM -0700, Alex Williamson wrote: > On Thu, 19 Jan 2017 22:16:03 +0200 > "Michael S. Tsirkin" wrote: > > > This is a design and an initial patch for kernel side for AER > > support in VFIO. > > > > 0. What happens now (PCIE AER only) > >Fatal errors cause a lin

Re: [Qemu-devel] [PATCH v3 4/4] ARRAY_SIZE: check that argument is an array

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 03:59:33PM -0600, Eric Blake wrote: > On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: > > It's a familiar pattern: some code uses ARRAY_SIZE, then refactoring > > changes the argument from an array to a pointer to a dynamically > > allocated buffer. Code keeps compiling b

Re: [Qemu-devel] [PATCH RFC] vfio error recovery: kernel support

2017-01-19 Thread Alex Williamson
On Thu, 19 Jan 2017 22:16:03 +0200 "Michael S. Tsirkin" wrote: > This is a design and an initial patch for kernel side for AER > support in VFIO. > > 0. What happens now (PCIE AER only) >Fatal errors cause a link reset. >Non fatal errors don't. >All errors stop the VM eventually, but

Re: [Qemu-devel] [PATCH v3 4/4] ARRAY_SIZE: check that argument is an array

2017-01-19 Thread Eric Blake
On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: > It's a familiar pattern: some code uses ARRAY_SIZE, then refactoring > changes the argument from an array to a pointer to a dynamically > allocated buffer. Code keeps compiling but any ARRAY_SIZE calls now > return the size of the pointer divided

Re: [Qemu-devel] [PATCH v3 1/4] compiler: drop ; after BUILD_BUG_ON

2017-01-19 Thread Eric Blake
On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: > All users include the trailing ; anyway, let's require that - > it seems cleaner. > > Signed-off-by: Michael S. Tsirkin > --- > include/qemu/compiler.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Reviewed-by: Eric Blake > > di

Re: [Qemu-devel] [PATCH v6] hw/ssi/imx_spi.c: fix CS handling during SPI access.

2017-01-19 Thread Jean-Christophe DUBOIS
Le 16/01/2017 à 20:06, mar.krzeminski a écrit : W dniu 16.01.2017 o 18:22, Peter Maydell pisze: On 11 January 2017 at 20:00, Jean-Christophe Dubois wrote: The i.MX SPI device was not de-asserting the CS line at the end of memory access. This triggered a SIGSEGV in Qemu when the sabrelite emul

[Qemu-devel] [PULL 16/17] virtio: fix up max size checks

2017-01-19 Thread Michael S. Tsirkin
Coverity reports that ARRAY_SIZE(elem->out_sg) (and all the others too) is wrong because elem->out_sg is a pointer. However, the check is not in the right place and the max_size argument of virtqueue_map_iovec can be removed. The check on in_num/out_num should be moved to qemu_get_virtqueue_eleme

[Qemu-devel] [PULL 05/17] fw-cfg: support writeable blobs

2017-01-19 Thread Michael S. Tsirkin
Useful to send guest data back to QEMU. Changes from Laszlo Ersek : - rebase the patch from Michael Tsirkin's original postings at [1] and [2] to the following patches: - loader: Allow a custom AddressSpace when loading ROMs - loader: Add AddressSpace loading support to uImages - loader: f

Re: [Qemu-devel] [PATCH v3 3/4] compiler: expression version of QEMU_BUILD_BUG_ON

2017-01-19 Thread Eric Blake
On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: > QEMU_BUILD_BUG_ON uses a typedef in order to be safe > to use outside functions, but sometimes it's useful > to have a version that can be used within an expression. > Following what Linux does, introduce QEMU_BUILD_BUG_ON_ZERO > that return zero

Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct

2017-01-19 Thread Eric Blake
On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote: > There are theoretical concerns that some compilers might not trigger > build failures on attempts to define an array of size -1 and make it a > variable sized array instead. Rather, the concern is that if someone changes code so that the 'x' of Q

[Qemu-devel] [PULL 07/17] pc: Add 2.9 machine-types

2017-01-19 Thread Michael S. Tsirkin
From: Eduardo Habkost Cc: "Michael S. Tsirkin" Cc: Laszlo Ersek Cc: Igor Mammedov Signed-off-by: Eduardo Habkost Reviewed-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin Acked-by: Gabriel Somlo Tested-by: Gabriel Somlo Cc: Gabriel Somlo Signed-off-by: Laszlo Ersek Reviewed-by: Michael

[Qemu-devel] [PULL 13/17] virtio_crypto: header update

2017-01-19 Thread Michael S. Tsirkin
Update header from latest linux driver. Session creation structs gain padding to make them same size. Formatting cleanups. Signed-off-by: Michael S. Tsirkin Tested-by: Gonglei Reviewed-by: Gonglei --- include/standard-headers/linux/virtio_crypto.h | 481 + 1 file chang

[Qemu-devel] [PULL 15/17] vhost: drop VHOST_F_DEVICE_IOTLB

2017-01-19 Thread Michael S. Tsirkin
Upstream does not have it, uses VIRTIO_F_IOMMU_PLATFORM to signal support instead. Signed-off-by: Michael S. Tsirkin --- linux-headers/linux/vhost.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index ac7a1f1..1e86a3d 100644 --- a/

[Qemu-devel] [PULL 04/17] vhost_net: device IOTLB support

2017-01-19 Thread Michael S. Tsirkin
From: Jason Wang This patches implements Device IOTLB support for vhost kernel. This is done through: 1) switch to use dma helpers when map/unmap vrings from vhost codes 2) introduce a set of VhostOps to: - setting up device IOTLB request callback - processing device IOTLB request - pro

[Qemu-devel] [PULL 09/17] virtio: drop an obsolete comment

2017-01-19 Thread Michael S. Tsirkin
virtio core has code to revert queue number to maximum on reset. Drop TODO to add that. Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- hw/virtio/virtio-pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 8baaf2b..092

[Qemu-devel] [PULL 02/17] Revert "virtio: turn vq->notification into a nested counter"

2017-01-19 Thread Michael S. Tsirkin
From: Stefan Hajnoczi This reverts commit aff8fd18f1786fc5af259a9bc0077727222f51ca. Both virtio-net and virtio-crypto do not balance virtio_queue_set_notification() enable and disable calls. This makes the notifications_disabled counter unreliable and Doug Goldstein reported the following asser

[Qemu-devel] [PULL 12/17] pci_regs: update to latest linux

2017-01-19 Thread Michael S. Tsirkin
this drops a duplicate definition of PCI_EXT_CAP_ATS_SIZEOF Signed-off-by: Michael S. Tsirkin --- include/standard-headers/linux/pci_regs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h index be5b066..e5a

[Qemu-devel] [PULL 17/17] virtio: force VIRTIO_F_IOMMU_PLATFORM

2017-01-19 Thread Michael S. Tsirkin
From: Jason Wang We allow vhost to clear VIRITO_F_IOMMU_PLATFORM which is wrong since VIRTIO_F_IOMMU_PLATFORM is mandatory for security. Fixing this by enforce it after vdc->get_features(). Signed-off-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/vir

[Qemu-devel] [PULL 08/17] fw-cfg: bump "x-file-slots" to 0x20 for 2.9+ machine types

2017-01-19 Thread Michael S. Tsirkin
From: Laszlo Ersek More precisely, the "x-file-slots" count is bumped for all machine types that: (a) use fw_cfg, and (b) are not versioned (hence migration is not expected to work for them across QEMU releases anyway), or have version 2.9. This affects machine types implemented in the follo

[Qemu-devel] [PATCH v3 4/4] ARRAY_SIZE: check that argument is an array

2017-01-19 Thread Michael S. Tsirkin
It's a familiar pattern: some code uses ARRAY_SIZE, then refactoring changes the argument from an array to a pointer to a dynamically allocated buffer. Code keeps compiling but any ARRAY_SIZE calls now return the size of the pointer divided by element size. Let's add build time checks to ARRAY_SI

[Qemu-devel] [PULL 11/17] virtio-mmio: switch to linux headers

2017-01-19 Thread Michael S. Tsirkin
Switch to virtio_mmio.h from Linux - will make it easier to implement virtio 1. Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-mmio.c | 95 +++-- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virti

[Qemu-devel] [PULL 14/17] update-linux-headers.sh: support __bitwise

2017-01-19 Thread Michael S. Tsirkin
In 4.10, Linux is switching from __bitwise__ to use __bitwise exclusively. Update our script accordingly. Signed-off-by: Michael S. Tsirkin --- scripts/update-linux-headers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-linux-headers.sh b/scripts/update-lin

[Qemu-devel] [PULL 06/17] fw-cfg: turn FW_CFG_FILE_SLOTS into a device property

2017-01-19 Thread Michael S. Tsirkin
From: Laszlo Ersek We'd like to raise the value of FW_CFG_FILE_SLOTS. Doing it naively could lead to problems with backward migration: a more recent QEMU (running an older machine type) would allow the guest, in fw_cfg_select(), to select a high key value that is unavailable in the same machine t

[Qemu-devel] [PATCH v3 1/4] compiler: drop ; after BUILD_BUG_ON

2017-01-19 Thread Michael S. Tsirkin
All users include the trailing ; anyway, let's require that - it seems cleaner. Signed-off-by: Michael S. Tsirkin --- include/qemu/compiler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 157698b..7512082 100644 ---

[Qemu-devel] [PULL 10/17] virtio_mmio: add standard header file

2017-01-19 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- include/standard-headers/linux/virtio_mmio.h | 141 +++ 1 file changed, 141 insertions(+) create mode 100644 include/standard-headers/linux/virtio_mmio.h diff --git a/include/standard-headers/linux/virtio_mmio.h b/include/standard-h

[Qemu-devel] [PULL 03/17] virtio: disable notifications again after poll succeeded

2017-01-19 Thread Michael S. Tsirkin
From: Stefan Hajnoczi While AioContext is in polling mode virtqueue notifications are not necessary. Some device virtqueue handlers enable notifications. Make sure they stay disabled to avoid unnecessary vmexits. Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: M

[Qemu-devel] [PATCH v3 0/4] ARRAY_SIZE fixups

2017-01-19 Thread Michael S. Tsirkin
Turns out virtio kept using ARRAY_SIZE on fields which stopped being arrays, this was noticed by a coverity scan. I fixed this up, this patchset fixes up the ARRAY_SIZE macro so that this bug does not reappear in any other place. changes from v2: - dropped the merged virtio patch - whitesp

[Qemu-devel] [PULL 00/17] virtio, vhost, pc: fixes, features

2017-01-19 Thread Michael S. Tsirkin
The following changes since commit 23eb9e6b6d5315171cc15969bbc755f258004df0: Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-01-16' into staging (2017-01-17 13:53:50 +) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_u

[Qemu-devel] [PATCH 2/6] i386: Add ordering field to CPUClass

2017-01-19 Thread Eduardo Habkost
Instead of using kvm_enabled to order the "-cpu help" list, use a new "ordering" field for that. Signed-off-by: Eduardo Habkost --- target/i386/cpu-qom.h | 2 ++ target/i386/cpu.c | 8 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu-qom.h b/target/i386

[Qemu-devel] [PULL 01/17] virtio-net: enable ioeventfd even if vhost=off

2017-01-19 Thread Michael S. Tsirkin
From: Paolo Bonzini virtio-net-pci does not enable ioeventfd for historical reasons (and nobody ever checked whether it should be revisited). Note that other backends do enable ioeventfd for virtio-net. However, it has a major effect on performance. On Windows, throughput is _multiplied_ by 2

[Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct

2017-01-19 Thread Michael S. Tsirkin
There are theoretical concerns that some compilers might not trigger build failures on attempts to define an array of size -1 and make it a variable sized array instead. Let rewrite using a struct with a negative bit field size instead as there are no dynamic bit field sizes. This is similar to wh

[Qemu-devel] [PATCH v3 3/4] compiler: expression version of QEMU_BUILD_BUG_ON

2017-01-19 Thread Michael S. Tsirkin
QEMU_BUILD_BUG_ON uses a typedef in order to be safe to use outside functions, but sometimes it's useful to have a version that can be used within an expression. Following what Linux does, introduce QEMU_BUILD_BUG_ON_ZERO that return zero after checking condition at build time. Signed-off-by: Mich

[Qemu-devel] [PATCH 5/6] i386: Make "max" model not use any host CPUID info on TCG

2017-01-19 Thread Eduardo Habkost
Instead of reporting host CPUID data on "max", use the qemu64 CPU model as reference to initialize CPUID vendor/family/model/stepping/model-id. Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 9 + 1 file changed, 9 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c

[Qemu-devel] [PATCH] KVM: PPC: eliminate unnecessary duplicate constants

2017-01-19 Thread Paolo Bonzini
These are not needed since linux-headers/ provides up-to-date definitions. The constants are in linux-headers/asm-powerpc/kvm.h. The sole users, hw/intc/xics_kvm.c and target/ppc/kvm.c, include asm/kvm.h via sysemu/kvm.h->linux/kvm.h. Signed-off-by: Paolo Bonzini --- target/ppc/kvm_ppc.h | 12 -

[Qemu-devel] [PATCH 4/6] i386: Create "max" CPU model

2017-01-19 Thread Eduardo Habkost
Rename the existing "host" CPU model to "max, and set it to kvm_enabled=false. The new "max" CPU model will be able to enable all features supported by TCG out of the box, because its logic is based on x86_cpu_get_supported_feature_word(), which already works with TCG. A new KVM-specific "host" cl

[Qemu-devel] [PATCH 1/6] i386: Unset cannot_destroy_with_object_finalize_yet on "host" model

2017-01-19 Thread Eduardo Habkost
The class is now safe because the assert(kvm_enabled()) line was removed by commit e435601058e656e6d24e3e87b187e5518f7bf16a. Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cff23e129d..7947c8737

[Qemu-devel] [PATCH 3/6] i386: Rename X86CPU::host_features to X86CPU::max_features

2017-01-19 Thread Eduardo Habkost
Rename the field and add a small comment to make its purpose clearer. Signed-off-by: Eduardo Habkost --- target/i386/cpu.h | 2 +- target/i386/cpu.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 10c5a3538d..889363e120 10064

Re: [Qemu-devel] [PATCH v2 3/4] compiler: expression version of QEMU_BUILD_BUG_ON

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 02:58:48PM -0600, Eric Blake wrote: > On 01/19/2017 01:25 PM, Michael S. Tsirkin wrote: > > > +#define QEMU_BUILD_BUG_ON_ZERO(x) (sizeof(int[(x) ? -1 : 1]) - > > sizeof(int)) > >>> > >>> Linux here uses: > >>> > >>> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int

[Qemu-devel] [PATCH 0/6] i386: Add "max" CPU model to TCG and KVM

2017-01-19 Thread Eduardo Habkost
This is v2 of the previous series that enabled the "host" CPU model on TCG. Now a new "max" CPU is being added, while keeping "host" KVM-specific. In addition to simply adding "max" as a copy of the existing "host" CPU model, additional patches change it to not use any host CPUID information when

[Qemu-devel] [PATCH 6/6] i386: Don't set CPUClass::cpu_def on "max" model

2017-01-19 Thread Eduardo Habkost
Host CPUID info is used by the "max" CPU model only in KVM mode. Move the initialization of CPUID data for "max" from class_init to instance_init, and don't set CPUClass::cpu_def for "max". Signed-off-by: Eduardo Habkost --- target/i386/cpu-qom.h | 4 +++- target/i386/cpu.c | 45 +++

Re: [Qemu-devel] [PATCH v2 3/4] compiler: expression version of QEMU_BUILD_BUG_ON

2017-01-19 Thread Michael S. Tsirkin
On Thu, Jan 19, 2017 at 02:33:40PM +0100, Markus Armbruster wrote: > Paolo Bonzini writes: > > > On 19/01/2017 09:12, Markus Armbruster wrote: > >> "Michael S. Tsirkin" writes: > >> > >>> QEMU_BUILD_BUG_ON uses a typedef in order to be safe > >>> to use outside functions, but sometimes it's use

[Qemu-devel] [PATCH] pci: mark ROMs read-only

2017-01-19 Thread Michael S. Tsirkin
Looks like we didn't mark PCI ROMs as RO allowing mischief such as guests writing there. Further, e.g. vhost gets confused trying to allocate enough space to log writes there. Fix it up. Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) dif

  1   2   3   4   >