Re: [Qemu-devel] [PATCH V1 RESEND 1/6] hmat acpi: Build Memory Subsystem Address Range Structure(s) in ACPI HMAT

2018-09-13 Thread Liu, Jingqi
On Wednesday, September 12, 2018 10:34 PM, Eric Blake wrote: > On 7/16/18 6:54 AM, Igor Mammedov wrote: > > >> + > >> +#include "unistd.h" > >> +#include "fcntl.h" > >> +#include "qemu/osdep.h" > >> +#include "sysemu/numa.h" > >> +#include "hw/i386/pc.h" > >> +#include "hw/i386/acpi-build.h" > >>

Re: [Qemu-devel] [PATCH] qemu: Add virtio pmem device

2018-09-13 Thread Pankaj Gupta
> > > This patch adds virtio-pmem Qemu device. > > > > This device presents memory address range information to guest > > which is backed by file backend type. It acts like persistent > > memory device for KVM guest. Guest can perform read and > > persistent write operations on this memory

Re: [Qemu-devel] [PATCH 6/6] x86_iommu/amd: Enable Guest virtual APIC support

2018-09-13 Thread Suravee Suthikulpanit
Peter, On 9/12/18 11:52 AM, Peter Xu wrote: On Tue, Sep 11, 2018 at 11:49:49AM -0500, Brijesh Singh wrote: Now that amd-iommu support interrupt remapping, enable the GASup in IVRS table and GASup in extended feature register to indicate that IOMMU support guest virtual APIC mode. Note that the

Re: [Qemu-devel] [PATCH 2/3] aio-posix: compute timeout before polling

2018-09-13 Thread Fam Zheng
On Wed, 09/12 19:10, Paolo Bonzini wrote: > This is a preparation for the next patch, and also a very small > optimization. Compute the timeout only once, before invoking > try_poll_mode, and adjust it in run_poll_handlers. The adjustment > is the polling time when polling fails, or zero (non-blo

Re: [Qemu-devel] [PATCH 5/6] x86_iommu/amd: Add interrupt remap support when VAPIC is enabled

2018-09-13 Thread Suravee Suthikulpanit
Brijesh, On 9/11/18 11:49 PM, Brijesh Singh wrote: Emulate the interrupt remapping support when guest virtual APIC is enabled. See IOMMU spec:https://support.amd.com/TechDocs/48882_IOMMU.pdf (section 2.2.5.2) for details information. When VAPIC is enabled, it uses interrupt remapping as define

Re: [Qemu-devel] [PATCH 3/3] display/stdvga: add edid support.

2018-09-13 Thread Gerd Hoffmann
> > --- a/docs/specs/standard-vga.txt > > +++ b/docs/specs/standard-vga.txt > > @@ -61,7 +61,7 @@ MMIO area spec > > Likewise applies to the pci variant only for obvious reasons. > > - - 03ff : reserved, for possible virtio extension. > > + - 03ff : edid data blob. > > > > +if (edid

Re: [Qemu-devel] [PATCH 3/3] aio-posix: do skip system call if ctx->notifier polling succeeds

2018-09-13 Thread Fam Zheng
On Wed, 09/12 19:10, Paolo Bonzini wrote: > Commit 70232b5253 ("aio-posix: Don't count ctx->notifier as progress when > 2018-08-15), by not reporting progress, causes aio_poll to execute the > system call when polling succeeds because of ctx->notifier. This introduces > latency before the call to

Re: [Qemu-devel] [PATCH v6 0/3] migration: compression optimization

2018-09-13 Thread Xiao Guangrong
On 09/06/2018 07:03 PM, Juan Quintela wrote: guangrong.x...@gmail.com wrote: From: Xiao Guangrong Changelog in v6: Thanks to Juan's review, in this version we 1) move flush compressed data to find_dirty_block() where it hits the end of memblock 2) use save_page_use_compression instead

Re: [Qemu-devel] [PATCH v2] vmdk: align end of file to a sector boundary

2018-09-13 Thread yuchenlin via Qemu-devel
On 2018-09-13 10:54, Fam Zheng wrote: On Thu, 09/13 10:31, yuchen...@synology.com wrote: From: yuchenlin There is a rare case which the size of last compressed cluster is larger than the cluster size, which will cause the file is not aligned at the sector boundary. The code looks good to me.

[Qemu-devel] [PATCH] intel_iommu: handle invalid ce for shadow sync

2018-09-13 Thread Peter Xu
There are two callers for vtd_sync_shadow_page_table_range(), one provided a valid context entry and one not. Move that fetching operation into the caller vtd_sync_shadow_page_table() where we need to fetch the context entry. Meanwhile, we should handle VTD_FR_CONTEXT_ENTRY_P properly when synchr

Re: [Qemu-devel] [PATCH] intel_iommu: handle invalid ce for shadow sync

2018-09-13 Thread Maxime Coquelin
Hi Peter, On 09/13/2018 09:55 AM, Peter Xu wrote: There are two callers for vtd_sync_shadow_page_table_range(), one provided a valid context entry and one not. Move that fetching operation into the caller vtd_sync_shadow_page_table() where we need to fetch the context entry. Meanwhile, we shou

Re: [Qemu-devel] [PATCH 2/6] x86_iommu/amd: Prepare for interrupt remap support

2018-09-13 Thread Suravee Suthikulpanit
Brijesh / Peter, On 9/13/18 10:15 AM, Peter Xu wrote: On Wed, Sep 12, 2018 at 01:59:06PM -0500, Brijesh Singh wrote: [...] } return &iommu_as[devfn]->as; } @@ -1172,6 +1274,10 @@ static void amdvi_realize(DeviceState *dev, Error **err) return; } +/* Pseu

Re: [Qemu-devel] [PATCH v2] vmdk: align end of file to a sector boundary

2018-09-13 Thread Fam Zheng
On Thu, 09/13 15:47, yuchenlin wrote: > On 2018-09-13 10:54, Fam Zheng wrote: > > On Thu, 09/13 10:31, yuchen...@synology.com wrote: > > > From: yuchenlin > > > > > > There is a rare case which the size of last compressed cluster > > > is larger than the cluster size, which will cause the file is

[Qemu-devel] [PATCH v3] vmdk: align end of file to a sector boundary

2018-09-13 Thread yuchenlin--- via Qemu-devel
From: yuchenlin There is a rare case which the size of last compressed cluster is larger than the cluster size, which will cause the file is not aligned at the sector boundary. There are three reasons to do it. First, if vmdk doesn't align at the sector boundary, there may be many undefined beha

Re: [Qemu-devel] [Qemu-block] [PATCH 1/3] aio-posix: fix concurrent access to poll_disable_cnt

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 08:56, Fam Zheng wrote: >> +/* No need to order poll_disable_cnt writes against other updates; >> + * the counter is only used to avoid wasting time and latency on >> + * iterated polling when the system call will be ultimately necessary. >> + * Changing handlers is a

Re: [Qemu-devel] [PATCH] intel_iommu: handle invalid ce for shadow sync

2018-09-13 Thread Peter Xu
On Thu, Sep 13, 2018 at 10:16:20AM +0200, Maxime Coquelin wrote: > Hi Peter, > > On 09/13/2018 09:55 AM, Peter Xu wrote: > > There are two callers for vtd_sync_shadow_page_table_range(), one > > provided a valid context entry and one not. Move that fetching > > operation into the caller vtd_sync_

Re: [Qemu-devel] [Qemu-block] [PATCH 1/3] aio-posix: fix concurrent access to poll_disable_cnt

2018-09-13 Thread Fam Zheng
On Thu, 09/13 10:29, Paolo Bonzini wrote: > On 13/09/2018 08:56, Fam Zheng wrote: > >> +/* No need to order poll_disable_cnt writes against other updates; > >> + * the counter is only used to avoid wasting time and latency on > >> + * iterated polling when the system call will be ultima

Re: [Qemu-devel] [PATCH v3] vmdk: align end of file to a sector boundary

2018-09-13 Thread Fam Zheng
On Thu, 09/13 16:29, yuchen...@synology.com wrote: > From: yuchenlin > > There is a rare case which the size of last compressed cluster > is larger than the cluster size, which will cause the file is > not aligned at the sector boundary. > > There are three reasons to do it. First, if vmdk doesn

Re: [Qemu-devel] [PATCH 6/6] x86_iommu/amd: Enable Guest virtual APIC support

2018-09-13 Thread Suravee Suthikulpanit
Brijesh/Peter, On 9/13/18 4:14 AM, Brijesh Singh wrote: On 09/11/2018 11:52 PM, Peter Xu wrote: ... diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5c2c638..1cbc8ba 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2565,7 +2565,8 @@ build_amd_iommu(GArray *tabl

Re: [Qemu-devel] [PATCH v0 2/2] block: postpone the coroutine executing if the BDS's is drained

2018-09-13 Thread Kevin Wolf
Am 12.09.2018 um 19:03 hat Denis V. Lunev geschrieben: > On 09/12/2018 04:15 PM, Kevin Wolf wrote: > > Am 12.09.2018 um 14:03 hat Denis Plotnikov geschrieben: > >> On 10.09.2018 15:41, Kevin Wolf wrote: > >>> Am 29.06.2018 um 14:40 hat Denis Plotnikov geschrieben: > Fixes the problem of ide re

Re: [Qemu-devel] [PATCH v2 1/4] Fix segmentation fault when qemu_signal_init fails

2018-09-13 Thread Fei Li
On 09/12/2018 03:55 PM, Fam Zheng wrote: On Fri, 09/07 21:38, Fei Li wrote: Currently, when qemu_signal_init() fails it only returns a non-zero value but without propagating any Error. But its callers need a non-null err when runs error_report_err(err), or else 0->msg occurs. To avoid such s

Re: [Qemu-devel] [PATCH 2/6] x86_iommu/amd: Prepare for interrupt remap support

2018-09-13 Thread Peter Xu
On Thu, Sep 13, 2018 at 03:15:27PM +0700, Suravee Suthikulpanit wrote: > Brijesh / Peter, > > On 9/13/18 10:15 AM, Peter Xu wrote: > > On Wed, Sep 12, 2018 at 01:59:06PM -0500, Brijesh Singh wrote: > > > > [...] > > > > > > >} > > > > >return &iommu_as[devfn]->as; > > > > >}

Re: [Qemu-devel] [PATCH v2 1/4] Fix segmentation fault when qemu_signal_init fails

2018-09-13 Thread Fam Zheng
On Thu, 09/13 16:46, Fei Li wrote: > > > On 09/12/2018 03:55 PM, Fam Zheng wrote: > > On Fri, 09/07 21:38, Fei Li wrote: > > > Currently, when qemu_signal_init() fails it only returns a non-zero > > > value but without propagating any Error. But its callers need a > > > non-null err when runs err

Re: [Qemu-devel] [PATCH v2 2/4] ui/vnc.c: polish vnc_init_func

2018-09-13 Thread Fei Li
On 09/12/2018 03:57 PM, Fam Zheng wrote: On Fri, 09/07 21:39, Fei Li wrote: Add a new Error parameter for vnc_display_init() to handle errors in its caller: vnc_init_func(), just like vnc_display_open() does. And let the call trace propagate the Error. Besides, make vnc_start_worker_thread()

Re: [Qemu-devel] [PATCH] input-linux: customizable grab toggle keys v3

2018-09-13 Thread Gerd Hoffmann
On Mon, Sep 03, 2018 at 04:32:10PM +, Ryan El Kochta wrote: > This patch adds a new option to the input-linux object: > > grab_toggle=key-key-key "grab-toggle" (no underscore) please. I'm still not convinced we need that much flexibility. I would go for a fixed list of combinations. Suggest

Re: [Qemu-devel] [PATCH v3 2/2] 40p: add fixed IRQ routing for LSI SCSI device

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 06:21, Mark Cave-Ayland wrote: > Indeed, see the Based-on header attached to the cover letter: it is > dependent upon the lsi53c8xx_create() removal patchset at > https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg00797.html > which Paolo has queued here: > https://lists.gnu.org

Re: [Qemu-devel] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 08:03, Fam Zheng wrote: > On Wed, 09/12 14:42, Paolo Bonzini wrote: >> On 12/09/2018 13:50, Fam Zheng wrote: I think it's okay if it is invoked. The sequence is first you stop the vq, then you drain the BlockBackends, then you switch AioContext. All that matters is th

Re: [Qemu-devel] [PATCH v2 2/2] spapr: increase the size of the IRQ number space

2018-09-13 Thread Cédric Le Goater
On 09/13/2018 04:25 AM, David Gibson wrote: > On Tue, Sep 11, 2018 at 07:55:03AM +0200, Cédric Le Goater wrote: >> The new layout using static IRQ number does not leave much space to >> the dynamic MSI range, only 0x100 IRQ numbers. Increase the total >> number of IRQS for newer machines and introd

[Qemu-devel] [Bug 1792193] Re: AMD Athlon(tm) X2 Dual-Core QL-64 bug

2018-09-13 Thread Dr. David Alan Gilbert
Hi Kirill, That's a bit tricky to debug; could you build qemu from git and try and bisect between 2.12.0 and 3.0 to see which commit broke it? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1792193

[Qemu-devel] [PATCH v2] change get_image_size return type to int64_t

2018-09-13 Thread Li Zhijian
Previously, if the size of initrd >=2G, qemu exits with error: root@haswell-OptiPlex-9020:/home/lizj# /home/lizhijian/lkp/qemu-colo/x86_64-softmmu/qemu-system-x86_64 -kernel ./vmlinuz-4.16.0-rc4 -initrd large.cgz -nographic qemu: error reading initrd large.cgz: No such file or directory root@hasw

Re: [Qemu-devel] [Qemu-block] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 11:11, Paolo Bonzini wrote: > On 13/09/2018 08:03, Fam Zheng wrote: >> On Wed, 09/12 14:42, Paolo Bonzini wrote: >>> On 12/09/2018 13:50, Fam Zheng wrote: > I think it's okay if it is invoked. The sequence is first you stop the > vq, then you drain the BlockBackends, then you

Re: [Qemu-devel] [PATCH v6 20/25] replay: wake up vCPU when replaying

2018-09-13 Thread Paolo Bonzini
On 12/09/2018 10:19, Pavel Dovgalyuk wrote: > This patch tries to wake up the vCPU when it sleeps and the icount warp > checkpoint isn't met. It means that vCPU has something to do, because > there are no other reasons of non-matching warp checkpoint. What happens if !replay_has_checkpoint()? Sho

Re: [Qemu-devel] [PATCH v2 4/4] qemu_thread_create: propagate the error to callers to handle

2018-09-13 Thread Fei Li
On 09/12/2018 04:20 PM, Fam Zheng wrote: On Fri, 09/07 21:39, Fei Li wrote: Make qemu_thread_create() return a Boolean to indicate if it succeeds rather than failing with an error. And add an Error parameter to hold the error message and let the callers handle it. Besides, directly return if

Re: [Qemu-devel] [PATCH 9/9] hostmem-ram: use whole path for memory region name with >= 3.1

2018-09-13 Thread Dr. David Alan Gilbert
* Marc-André Lureau (marcandre.lur...@redhat.com) wrote: > hostmem-file and hostmem-memfd use the whole object path for the > memory region name, but hostname-ram uses only the path component (the > basename): > > qemu -m 1024 -object memory-backend-ram,id=mem,size=1G -numa node,memdev=mem > -mon

Re: [Qemu-devel] [PATCH v6 22/25] replay: add BH oneshot event for block layer

2018-09-13 Thread Paolo Bonzini
On 12/09/2018 10:19, Pavel Dovgalyuk wrote: > + uint64_t id = replay_get_current_step(); > + replay_add_event(REPLAY_ASYNC_EVENT_BH_ONESHOT, cb, opaque, id); Why does it need an id, while REPLAY_ASYNC_EVENT_BH does not? Paolo

Re: [Qemu-devel] [PATCH v6 00/25] Fixing record/replay and adding reverse debugging

2018-09-13 Thread Paolo Bonzini
On 12/09/2018 10:17, Pavel Dovgalyuk wrote: > GDB remote protocol supports reverse debugging of the targets. > It includes 'reverse step' and 'reverse continue' operations. > The first one finds the previous step of the execution, > and the second one is intended to stop at the last breakpoint that

Re: [Qemu-devel] [PATCH 8/8] exec: add read callback for notdirty memory region

2018-09-13 Thread Paolo Bonzini
On 12/09/2018 18:01, Li Qiang wrote: > From: Li Qiang > > Signed-off-by: Li Qiang This cannot happen, since TLB_NOTDIRTY is only added to the addr_write member (see accel/tcg/cputlb.c). Paolo > --- > exec.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/exec.c b/exec.c > in

Re: [Qemu-devel] [PATCH v6 20/25] replay: wake up vCPU when replaying

2018-09-13 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 12/09/2018 10:19, Pavel Dovgalyuk wrote: > > This patch tries to wake up the vCPU when it sleeps and the icount warp > > checkpoint isn't met. It means that vCPU has something to do, because > > there are no other reasons of non-matching warp

Re: [Qemu-devel] [PATCH v6 22/25] replay: add BH oneshot event for block layer

2018-09-13 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 12/09/2018 10:19, Pavel Dovgalyuk wrote: > > + uint64_t id = replay_get_current_step(); > > + replay_add_event(REPLAY_ASYNC_EVENT_BH_ONESHOT, cb, opaque, id); > > Why does it need an id, while REPLAY_ASYNC_EVENT_BH does not? Because _oneshot

[Qemu-devel] [PATCH v8 2/2] vl:c: make sure that sockets are calculated correctly in '-smp X' case

2018-09-13 Thread Igor Mammedov
commit (5cdc9b76e3 vl.c: Remove dead assignment) removed sockets calculation when 'sockets' weren't provided on CLI since there wasn't any users for it back then. Exiting checks are neither reachable } else if (sockets * cores * threads < cpus) { or nor triggerable if (sockets * cores * thr

[Qemu-devel] [PATCH v8 0/2] deprecate incorrect CPUs topolog

2018-09-13 Thread Igor Mammedov
Changelog since v7: * drop repetitive sentence in deprication doc (Eric Blake ) Changelog since v5: * add(v6) and then remove(v7) Notes section to/from deprication doc (Eduardo Habkost ) * fix up wording and math formating in deprication doc (Eduardo Habkost ) * drop !socket check

[Qemu-devel] [PATCH v8 1/2] vl.c deprecate incorrect CPUs topology

2018-09-13 Thread Igor Mammedov
-smp [cpus],sockets/cores/threads[,maxcpus] should describe topology so that total number of logical CPUs [sockets * cores * threads] would be equal to [maxcpus], however historically we didn't have such check in QEMU and it is possible to start VM with an invalid topology. Deprecate invalid option

[Qemu-devel] [PATCH] vhost-user: define conventions for vhost-user backends

2018-09-13 Thread Marc-André Lureau
As discussed during "[PATCH v4 00/29] vhost-user for input & GPU" review, let's define a common set of backend conventions to help with management layer implementation, and interoperability. Cc: libvir-l...@redhat.com Cc: Gerd Hoffmann Cc: Daniel P. Berrangé Cc: Changpeng Liu Cc: Dr. David Alan

Re: [Qemu-devel] [PATCH V1 RESEND 6/6] hmat acpi: Implement _HMA method to update HMAT at runtime

2018-09-13 Thread Igor Mammedov
On Wed, 12 Sep 2018 01:12:43 + "Liu, Jingqi" wrote: > On Monday, July 16, 2018 8:29 PM, Igor Mammedov wrote: > > On Tue, 19 Jun 2018 23:20:57 +0800 > > Liu Jingqi wrote: > > > > > OSPM evaluates HMAT only during system initialization. > > > Any changes to the HMAT state at runtime or inf

Re: [Qemu-devel] [PATCH 6/6] x86_iommu/amd: Enable Guest virtual APIC support

2018-09-13 Thread Peter Xu
On Thu, Sep 13, 2018 at 03:36:28PM +0700, Suravee Suthikulpanit wrote: > Brijesh/Peter, > > On 9/13/18 4:14 AM, Brijesh Singh wrote: > > > > > > On 09/11/2018 11:52 PM, Peter Xu wrote: > > ... > > > > > > > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > > > index 5c2c638..1

Re: [Qemu-devel] [PATCH v2] hostmem: no need to check for host_memory_backend_mr_inited() in alloc()

2018-09-13 Thread Igor Mammedov
On Mon, 10 Sep 2018 17:49:46 +0400 Marc-André Lureau wrote: > memfd_backend_memory_alloc/file_backend_memory_alloc both needlessly > are are calling host_memory_backend_mr_inited() which creates an > illusion that alloc could be called multiple times but it isn't, it's > called once from UserCrea

Re: [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes

2018-09-13 Thread Gerd Hoffmann
On Fri, Sep 07, 2018 at 06:08:48PM -0400, Bandan Das wrote: > v2: > Same as v1 but with another minor cleanup > patch. The write buffer breakup is still WIP. > > A documentation fix and changes to return the > right error code on write failures. Added to usb queue. thanks, Gerd

Re: [Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr()

2018-09-13 Thread Igor Mammedov
On Wed, 29 Aug 2018 17:36:12 +0200 David Hildenbrand wrote: > Keep it simple for now and simply set the static property, that will > fail once realized. I'd merge this with previous patch and mention that set_addr will replace 'addr' property setting in the next patch where preliminary steps duri

Re: [Qemu-devel] [PATCH 3/3] virtio-pmem: Add virtio pmem driver

2018-09-13 Thread Luiz Capitulino
On Thu, 13 Sep 2018 02:58:21 -0400 (EDT) Pankaj Gupta wrote: > Hi Luiz, > > Thanks for the review. > > > > > > This patch adds virtio-pmem driver for KVM guest. > > > > > > Guest reads the persistent memory range information from > > > Qemu over VIRTIO and registers it on nvdimm_bus. It als

Re: [Qemu-devel] [PATCH v2 05/20] memory-device: convert get_region_size() to get_memory_region()

2018-09-13 Thread Igor Mammedov
On Wed, 29 Aug 2018 17:36:09 +0200 David Hildenbrand wrote: > To factor out plugging and unplugging of memory device we need access to > the memory region. So let's replace get_region_size() by > get_memory_region(). > > If any memory device will in the future have multiple memory regions > that

Re: [Qemu-devel] [PATCH] qemu: Add virtio pmem device

2018-09-13 Thread Luiz Capitulino
On Thu, 13 Sep 2018 03:06:27 -0400 (EDT) Pankaj Gupta wrote: > > > > > This patch adds virtio-pmem Qemu device. > > > > > > This device presents memory address range information to guest > > > which is backed by file backend type. It acts like persistent > > > memory device for KVM guest.

[Qemu-devel] [PATCH v2 02/17] blockjob: Wake up BDS when job becomes idle

2018-09-13 Thread Kevin Wolf
In the context of draining a BDS, the .drained_poll callback of block jobs is called. If this returns true (i.e. there is still some activity pending), the drain operation may call aio_poll() with blocking=true to wait for completion. As soon as the pending activity is completed and the job finall

[Qemu-devel] [PATCH v2 01/17] job: Fix missing locking due to mismerge

2018-09-13 Thread Kevin Wolf
job_completed() had a problem with double locking that was recently fixed independently by two different commits: "job: Fix nested aio_poll() hanging in job_txn_apply" "jobs: add exit shim" One fix removed the first aio_context_acquire(), the other fix removed the other one. Now we have a bug aga

[Qemu-devel] [PATCH v2 00/17] Fix some jobs/drain/aio_poll related hangs

2018-09-13 Thread Kevin Wolf
Especially the combination of iothreads, block jobs and drain tends to lead to hangs currently. This series fixes a few of these bugs, although there are more of them, to be addressed in separate patches. The primary goal of this series is to fix the scenario from: https://bugzilla.redhat.com/show

[Qemu-devel] [PATCH v2 10/17] block-backend: Fix potential double blk_delete()

2018-09-13 Thread Kevin Wolf
blk_unref() first decreases the refcount of the BlockBackend and calls blk_delete() if the refcount reaches zero. Requests can still be in flight at this point, they are only drained during blk_delete(): At this point, arbitrary callbacks can run. If any callback takes a temporary BlockBackend ref

[Qemu-devel] [PATCH v2 04/17] test-bdrv-drain: Drain with block jobs in an I/O thread

2018-09-13 Thread Kevin Wolf
This extends the existing drain test with a block job to include variants where the block job runs in a different AioContext. Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng --- tests/test-bdrv-drain.c | 92 + 1 file changed, 86 insertions(+), 6

Re: [Qemu-devel] [PATCH v2 06/20] memory-device: document MemoryDeviceClass

2018-09-13 Thread Igor Mammedov
On Wed, 29 Aug 2018 17:36:10 +0200 David Hildenbrand wrote: > Document the functions and when to not expect errors. > > Signed-off-by: David Hildenbrand > --- > include/hw/mem/memory-device.h | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/include/hw/mem/memory-device.

[Qemu-devel] [PATCH v2 03/17] aio-wait: Increase num_waiters even in home thread

2018-09-13 Thread Kevin Wolf
Even if AIO_WAIT_WHILE() is called in the home context of the AioContext, we still want to allow the condition to change depending on other threads as long as they kick the AioWait. Specfically block jobs can be running in an I/O thread and should then be able to kick a drain in the main loop conte

[Qemu-devel] [PATCH v2 11/17] block-backend: Decrease in_flight only after callback

2018-09-13 Thread Kevin Wolf
Request callbacks can do pretty much anything, including operations that will yield from the coroutine (such as draining the backend). In that case, a decreased in_flight would be visible to other code and could lead to a drain completing while the callback hasn't actually completed yet. Signed-of

[Qemu-devel] [PATCH v2 06/17] job: Use AIO_WAIT_WHILE() in job_finish_sync()

2018-09-13 Thread Kevin Wolf
job_finish_sync() needs to release the AioContext lock of the job before calling aio_poll(). Otherwise, callbacks called by aio_poll() would possibly take the lock a second time and run into a deadlock with a nested AIO_WAIT_WHILE() call. Also, job_drain() without aio_poll() isn't necessarily enou

[Qemu-devel] [PATCH v2 05/17] test-blockjob: Acquire AioContext around job_cancel_sync()

2018-09-13 Thread Kevin Wolf
All callers in QEMU proper hold the AioContext lock when calling job_finish_sync(). test-blockjob should do the same when it calls the function indirectly through job_cancel_sync(). Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng --- include/qemu/job.h| 6 ++ tests/test-blockjob.c | 6

[Qemu-devel] [PATCH v2 16/17] job: Avoid deadlocks in job_completed_txn_abort()

2018-09-13 Thread Kevin Wolf
Amongst others, job_finalize_single() calls the .prepare/.commit/.abort callbacks of the individual job driver. Recently, their use was adapted for all block jobs so that they involve code calling AIO_WAIT_WHILE() now. Such code must be called under the AioContext lock for the respective job, but w

[Qemu-devel] [PATCH v2 17/17] test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort

2018-09-13 Thread Kevin Wolf
This adds tests for calling AIO_WAIT_WHILE() in the .commit and .abort callbacks. Both reasons why .abort could be called for a single job are tested: Either .run or .prepare could return an error. Signed-off-by: Kevin Wolf --- tests/test-bdrv-drain.c | 116 ++

[Qemu-devel] [PATCH v2 08/17] block: Add missing locking in bdrv_co_drain_bh_cb()

2018-09-13 Thread Kevin Wolf
bdrv_do_drained_begin/end() assume that they are called with the AioContext lock of bs held. If we call drain functions from a coroutine with the AioContext lock held, we yield and schedule a BH to move out of coroutine context. This means that the lock for the home context of the coroutine is rele

[Qemu-devel] [PATCH v2 07/17] test-bdrv-drain: Test AIO_WAIT_WHILE() in completion callback

2018-09-13 Thread Kevin Wolf
This is a regression test for a deadlock that occurred in block job completion callbacks (via job_defer_to_main_loop) because the AioContext lock was taken twice: once in job_finish_sync() and then again in job_defer_to_main_loop_bh(). This would cause AIO_WAIT_WHILE() to hang. Signed-off-by: Kevi

[Qemu-devel] [PULL 01/12] migration/rdma: Fix uninitialised rdma_return_path

2018-09-13 Thread Juan Quintela
From: "Dr. David Alan Gilbert" Clang correctly errors out moaning that rdma_return_path is used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it. Fixes: 55cc1b5937a8e709e4c102e74b206281073aab82 Signed-off-by: Dr. David Alan Gilbert Reported-by: Cornelia H

[Qemu-devel] [PATCH v2 09/17] block-backend: Add .drained_poll callback

2018-09-13 Thread Kevin Wolf
A bdrv_drain operation must ensure that all parents are quiesced, this includes BlockBackends. Otherwise, callbacks called by requests that are completed on the BDS layer, but not quite yet on the BlockBackend layer could still create new requests. Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng

[Qemu-devel] [PULL 07/12] migration: use save_page_use_compression in flush_compressed_data

2018-09-13 Thread Juan Quintela
From: Xiao Guangrong It avoids to touch compression locks if xbzrle and compression are both enabled Signed-off-by: Xiao Guangrong Reviewed-by: Juan Quintela Message-Id: <20180906070101.27280-4-xiaoguangr...@tencent.com> Signed-off-by: Juan Quintela --- migration/ram.c | 4 +++- 1 file chang

[Qemu-devel] [PATCH v2 15/17] test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level()

2018-09-13 Thread Kevin Wolf
This is a regression test for a deadlock that could occur in callbacks called from the aio_poll() in bdrv_drain_poll_top_level(). The AioContext lock wasn't released and therefore would be taken a second time in the callback. This would cause a possible AIO_WAIT_WHILE() in the callback to hang. Si

[Qemu-devel] [PULL 00/12] Migration queue

2018-09-13 Thread Juan Quintela
/migration/20180913 for you to fetch changes up to 418fe4f69648b4f3f0afd2588926deafac81cfe8: tests/migration: Enable the migration test on s390x, too (2018-09-13 14:06:26 +0200) migration/next for 20180913 Hi this patchset has a

[Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit

2018-09-13 Thread Kevin Wolf
When starting an active commit job, other callbacks can run before mirror_start_job() calls bdrv_ref() where needed and cause the nodes to go away. Add another pair of bdrv_ref/unref() around it to protect against this case. Signed-off-by: Kevin Wolf --- block/mirror.c | 11 +++ 1 file c

[Qemu-devel] [PULL 04/12] Add a hint message to loadvm and exits on failure

2018-09-13 Thread Juan Quintela
From: Jose Ricardo Ziviani This patch adds a small hint for the failure case of the load snapshot process. It may be useful for users to remember that the VM configuration has changed between the save and load processes. (qemu) loadvm vm-20180903083641 Unknown savevm section or instance 'cpu_com

[Qemu-devel] [PATCH v2 14/17] block: Remove aio_poll() in bdrv_drain_poll variants

2018-09-13 Thread Kevin Wolf
bdrv_drain_poll_top_level() was buggy because it didn't release the AioContext lock of the node to be drained before calling aio_poll(). This way, callbacks called by aio_poll() would possibly take the lock a second time and run into a deadlock with a nested AIO_WAIT_WHILE() call. However, it turn

[Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drained_poll()

2018-09-13 Thread Kevin Wolf
Block jobs claim in .drained_poll() that they are in a quiescent state as soon as job->deferred_to_main_loop is true. This is obviously wrong, they still have a completion BH to run. We only get away with this because commit 91af091f923 added an unconditional aio_poll(false) to the drain functions,

[Qemu-devel] [PULL 09/12] tests/migration: Support cross compilation in generating boot header file

2018-09-13 Thread Juan Quintela
From: Wei Huang Recently a new configure option, CROSS_CC_GUEST, was added to $(TARGET)-softmmu/config-target.mak to support TCG-related tests. This patch tries to leverage this option to support cross compilation when the migration boot block file is being re-generated: * The x86 related files

[Qemu-devel] [PULL 06/12] migration: show the statistics of compression

2018-09-13 Thread Juan Quintela
From: Xiao Guangrong Currently, it includes: pages: amount of pages compressed and transferred to the target VM busy: amount of count that no free thread to compress data busy-rate: rate of thread busy compressed-size: amount of bytes after compression compression-rate: rate of compressed size R

[Qemu-devel] [PULL 02/12] migration: fix calculating xbzrle_counters.cache_miss_rate

2018-09-13 Thread Juan Quintela
From: Xiao Guangrong As Peter pointed out: | - xbzrle_counters.cache_miss is done in save_xbzrle_page(), so it's | per-guest-page granularity | | - RAMState.iterations is done for each ram_find_and_save_block(), so | it's per-host-page granularity | | An example is that when we migrate a 2M h

[Qemu-devel] [PULL 08/12] tests/migration: Convert x86 boot block compilation script into Makefile

2018-09-13 Thread Juan Quintela
From: Wei Huang The x86 boot block header currently is generated with a shell script. To better support other CPUs (e.g. aarch64), we convert the script into Makefile. This allows us to 1) support cross-compilation easily, and 2) avoid creating a script file for every architecture. Note that, in

[Qemu-devel] [PULL 03/12] migration: handle the error condition properly

2018-09-13 Thread Juan Quintela
From: Xiao Guangrong ram_find_and_save_block() can return negative if any error hanppens, however, it is completely ignored in current code Signed-off-by: Xiao Guangrong Reviewed-by: Juan Quintela Message-Id: <20180903092644.25812-5-xiaoguangr...@tencent.com> Signed-off-by: Juan Quintela ---

[Qemu-devel] [PULL 10/12] tests/migration: Add migration-test header file

2018-09-13 Thread Juan Quintela
From: Wei Huang This patch moves the settings related migration-test from the migration-test.c file to a new header file. Reviewed-by: Juan Quintela Reviewed-by: Andrew Jones Signed-off-by: Wei Huang Message-Id: <1536174934-26022-4-git-send-email-...@redhat.com> Signed-off-by: Juan Quintela

[Qemu-devel] [PULL 05/12] migration: do not flush_compressed_data at the end of iteration

2018-09-13 Thread Juan Quintela
From: Xiao Guangrong flush_compressed_data() needs to wait all compression threads to finish their work, after that all threads are free until the migration feeds new request to them, reducing its call can improve the throughput and use CPU resource more effectively We do not need to flush all t

[Qemu-devel] [PULL 12/12] tests/migration: Enable the migration test on s390x, too

2018-09-13 Thread Juan Quintela
From: Thomas Huth We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test. Signed-off-by: Thomas Huth Message-Id: <1535027120-26187-1-git-send-email-th...@redhat.

[Qemu-devel] [PULL 11/12] tests: Add migration test for aarch64

2018-09-13 Thread Juan Quintela
From: Wei Huang This patch adds migration test support for aarch64. The test code, which implements the same functionality as x86, is booted as a kernel in qemu. Here are the design choices we make for aarch64: * We choose this -kernel approach because aarch64 QEMU doesn't provide a built-in

[Qemu-devel] [PATCH] migration-test: Only generate a single target architecture

2018-09-13 Thread Juan Quintela
Several changes: - We only allow generate header "inside" the tree. Why? Because we need to connit the result, so it makes no sense to generate them on the build dir. - We only generate a single target each time. Getting all the cross-compilers correctly is an impossible task. So know you

Re: [Qemu-devel] Can I only commit from active image to corresponding range of its backing file by qemu cmd?

2018-09-13 Thread Max Reitz
On 13.09.18 05:33, lampahome wrote: > I split data to 3 chunks and save it in 3 independent backing files like > below: > img.000 <-- img.001 <-- img.002 > img.000 is the backing file of img.001 and 001 is the backing file of 002. > img.000 saves the 1st chunk of data and img.001 saves the 2nd chun

Re: [Qemu-devel] [PATCH v6 0/3] migration: compression optimization

2018-09-13 Thread Juan Quintela
Xiao Guangrong wrote: > On 09/06/2018 07:03 PM, Juan Quintela wrote: >> guangrong.x...@gmail.com wrote: >>> From: Xiao Guangrong >>> >>> Changelog in v6: >>> >>> Thanks to Juan's review, in this version we >>> 1) move flush compressed data to find_dirty_block() where it hits the end >>> of me

Re: [Qemu-devel] [PATCH v3 08/10] block: Allow changing 'discard' on reopen

2018-09-13 Thread Max Reitz
On 06.09.18 11:37, Alberto Garcia wrote: > 'discard' is one of the basic BlockdevOptions available for all > drivers, but it's not handled by bdrv_reopen_prepare() so any attempt > to change it results in an error: > >(qemu) qemu-io virtio0 "reopen -o discard=on" >Cannot change the option

Re: [Qemu-devel] [PATCH v3 09/10] block: Allow changing 'detect-zeroes' on reopen

2018-09-13 Thread Max Reitz
On 06.09.18 11:37, Alberto Garcia wrote: > 'detect-zeroes' is one of the basic BlockdevOptions available for all > drivers, but it's not handled by bdrv_reopen_prepare(), so any attempt > to change it results in an error: > >(qemu) qemu-io virtio0 "reopen -o detect-zeroes=on" >Cannot chang

Re: [Qemu-devel] [PULL 0/5] Migration queue

2018-09-13 Thread Juan Quintela
Juan Quintela wrote: > The following changes since commit 19b599f7664b2ebfd0f405fb79c14dd241557452: > > Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2' > into staging (2018-08-27 16:44:20 +0100) > > are available in the Git repository at: > > git://github.com/juanq

Re: [Qemu-devel] [PATCH v6 00/25] Fixing record/replay and adding reverse debugging

2018-09-13 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 12/09/2018 10:17, Pavel Dovgalyuk wrote: > > GDB remote protocol supports reverse debugging of the targets. > > It includes 'reverse step' and 'reverse continue' operations. > > The first one finds the previous step of the execution, > > and t

Re: [Qemu-devel] [PATCH v6 22/25] replay: add BH oneshot event for block layer

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 13:13, Pavel Dovgalyuk wrote: >> From: Paolo Bonzini [mailto:pbonz...@redhat.com] >> On 12/09/2018 10:19, Pavel Dovgalyuk wrote: >>> + uint64_t id = replay_get_current_step(); >>> + replay_add_event(REPLAY_ASYNC_EVENT_BH_ONESHOT, cb, opaque, id); >> >> Why does it need an id, while RE

Re: [Qemu-devel] [PATCH v6 00/25] Fixing record/replay and adding reverse debugging

2018-09-13 Thread Paolo Bonzini
On 13/09/2018 15:40, Pavel Dovgalyuk wrote: >> For now I'm queuing 12, 14, 19, 20 (pending question to you) and 23-25. > What about patch 21? I'd want an ACK from the IDE maintainer. Let's add him to Cc. Paolo

Re: [Qemu-devel] [qemu-s390x] [PATCH v8 3/6] s390x/kvm: enable/disable AP instruction interpretation for guest

2018-09-13 Thread Tony Krowiak
On 09/13/2018 01:28 AM, Thomas Huth wrote: On 2018-09-12 22:08, Tony Krowiak wrote: From: Tony Krowiak Let's use the KVM_SET_DEVICE_ATTR ioctl to enable or disable hardware interpretation of AP instructions executed on the guest. If the S390_FEAT_AP feature is installed, AP instructions will b

Re: [Qemu-devel] [PATCH v2 01/17] job: Fix missing locking due to mismerge

2018-09-13 Thread Max Reitz
On 13.09.18 14:52, Kevin Wolf wrote: > job_completed() had a problem with double locking that was recently > fixed independently by two different commits: > > "job: Fix nested aio_poll() hanging in job_txn_apply" > "jobs: add exit shim" > > One fix removed the first aio_context_acquire(), the oth

Re: [Qemu-devel] [qemu-s390x] [PATCH v8 6/6] s390: doc: detailed specifications for AP virtualization

2018-09-13 Thread Tony Krowiak
On 09/13/2018 02:06 AM, Thomas Huth wrote: On 2018-09-12 22:08, Tony Krowiak wrote: This patch provides documentation describing the AP architecture and design concepts behind the virtualization of AP devices. It also includes an example of how to configure AP devices for exclusive use of KVM gu

Re: [Qemu-devel] [PATCH v2 3/3] 40p: add fixed IRQ routing for LSI SCSI device

2018-09-13 Thread Artyom Tarasenko
On Sat, Sep 8, 2018 at 11:11 AM Mark Cave-Ayland wrote: > > Whilst the PReP specification describes how all PCI IRQs are routed via IRQ > 15 on the interrupt controller, the real 40p machine has routing quirk in > that the LSI SCSI device is routed to IRQ 13. Is it a routing quirk or does 40p use

Re: [Qemu-devel] [PATCH v3 01/13] target/i386: move cpu_cc_srcT to DisasContext

2018-09-13 Thread Alex Bennée
Emilio G. Cota writes: > Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée > --- > target/i386/translate.c | 32 ++-- > 1 file changed, 18 insertions(+), 14 deletions(-) > > diff --git a/target/i386/translate.c b/target/i386/translate.c > index 1f9d1d9b24..

Re: [Qemu-devel] [PATCH v3 02/13] target/i386: move cpu_A0 to DisasContext

2018-09-13 Thread Alex Bennée
Emilio G. Cota writes: > Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée > --- > target/i386/translate.c | 472 > 1 file changed, 236 insertions(+), 236 deletions(-) > > diff --git a/target/i386/translate.c b/target/i386/translate.c > index e

Re: [Qemu-devel] [PATCH v3 03/13] target/i386: move cpu_T0 to DisasContext

2018-09-13 Thread Alex Bennée
Emilio G. Cota writes: > Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée > --- > target/i386/translate.c | 1174 --- > 1 file changed, 594 insertions(+), 580 deletions(-) > > diff --git a/target/i386/translate.c b/target/i386/translate.c > index c

Re: [Qemu-devel] [PATCH v3 04/13] target/i386: move cpu_T1 to DisasContext

2018-09-13 Thread Alex Bennée
Emilio G. Cota writes: > Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée > --- > target/i386/translate.c | 341 > 1 file changed, 170 insertions(+), 171 deletions(-) > > diff --git a/target/i386/translate.c b/target/i386/translate.c > index 7

  1   2   >