[Qemu-devel] [PATCH v3] tcg/mips: Bugfix for crash when running program with qemu-i386.

2017-07-09 Thread Jiang Biao
When running a helloworld program with qemu-i386 in linux-user mode on Loongson 3A3000, it will crash. This patch fix the bug. Signed-off-by: Jiang Biao Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.inc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcg

Re: [Qemu-devel] [PATCH v22 25/30] qmp: add x-debug-block-dirty-bitmap-sha256

2017-07-09 Thread Markus Armbruster
John Snow writes: > On 07/07/2017 09:53 AM, Markus Armbruster wrote: >> Vladimir Sementsov-Ogievskiy writes: >> >>> 07.07.2017 12:00, Markus Armbruster wrote: "Daniel P. Berrange" writes: > On Fri, Jul 07, 2017 at 10:05:22AM +0200, Markus Armbruster wrote: >> Vladimir Sements

Re: [Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL

2017-07-09 Thread Mark Cave-Ayland
On 07/07/17 22:30, Eduardo Habkost wrote: > object_resolve_path*() ambiguous path detection breaks when > ambiguous==NULL and the object tree have 3 objects of the same type and > only 2 of them are under the same parent. e.g.: > > /container/obj1 (TYPE_FOO) > /container/obj2 (TYPE_FOO) > /ob

Re: [Qemu-devel] [RFC drcVI PATCH] spapr: reset DRCs on migration pre_load

2017-07-09 Thread David Gibson
On Fri, Jul 07, 2017 at 06:20:37PM -0300, Daniel Henrique Barboza wrote: > "spapr: Remove 'awaiting_allocation' DRC flag" removed the flag that > was originally was being used to prevent a race condition between > hot unplug and hotplug. The DRC code base got simplified and more > robust over time,

Re: [Qemu-devel] [PATCH] tcg/mips: Bugfix for crashwhenrunningprogram with qemu-i386.

2017-07-09 Thread jiang.biao2
> > this section of code is to extend the addr_regl to 64bit, and use *base* as > > temp > > intermedia. The real intention could be to extend addr_regl into base, and > > then > > move base back to addr_regl for later use, but it wrongly assigning base to > > addr_regl directly, which will

Re: [Qemu-devel] [PATCH 02/22] translate-all: remove redundant !tcg_enabled check in dump_exec_info

2017-07-09 Thread Thomas Huth
On 09.07.2017 09:49, Emilio G. Cota wrote: > This check is redundant because it is already performed by the only > caller of dump_exec_info -- the caller was updated by b7da97eef > ("monitor: Check whether TCG is enabled before running the "info jit" > code"). > > Checking twice wouldn't necessari

Re: [Qemu-devel] [PATCH 22/22] translate-all: do not hold tb_lock during code generation in softmmu

2017-07-09 Thread Richard Henderson
On 07/09/2017 05:51 PM, Emilio G. Cota wrote: On Sun, Jul 09, 2017 at 11:38:50 -1000, Richard Henderson wrote: On 07/08/2017 09:50 PM, Emilio G. Cota wrote: (snip) I think it would be better to have a tb_htable_lookup_or_insert function, which performs the insert iff a matching object isn't al

Re: [Qemu-devel] [PATCH] tcg/mips: Bugfix for crash whenrunningprogram with qemu-i386.

2017-07-09 Thread Richard Henderson
On 07/09/2017 05:15 PM, jiang.bi...@zte.com.cn wrote: It lies in the following code, > if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { > tcg_out_ext32u(s, base, addr_regl); >addr_regl = base; //problem is here. >} this section of code is to extend the addr_regl to 64bi

Re: [Qemu-devel] [PATCH v2] tcg/mips: Bugfix for crash when running program with qemu-i386.

2017-07-09 Thread Richard Henderson
On 07/09/2017 07:49 PM, Jiang Biao wrote: When running a helloworld program with qemu-i386 in linux-user mode on Loongson 3A3000, it will crash. The reasion is wrong assigning from base to addr_regl directly. This patch fix the bug. Signed-off-by: Jiang Biao Signed-off-by: Richard Henderson --

[Qemu-devel] [PATCH v2] tcg/mips: Bugfix for crash when running program with qemu-i386.

2017-07-09 Thread Jiang Biao
When running a helloworld program with qemu-i386 in linux-user mode on Loongson 3A3000, it will crash. The reasion is wrong assigning from base to addr_regl directly. This patch fix the bug. Signed-off-by: Jiang Biao Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.inc.c | 10 ++

Re: [Qemu-devel] About the trace framework

2017-07-09 Thread Xie Changlong
在 7/9/2017 5:57 PM, Wang Dong 写道: Hi, I am new to QEMU. But I got some problem so that I want to figure it out. So I try to debug qemu to see what happened. And I found trace framework. I think this will help me understand the point. So I compiled qemu with option: ## *--enable-trace-back

Re: [Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 11:48:53 -1000, Richard Henderson wrote: > On 07/09/2017 11:29 AM, Emilio G. Cota wrote: (snip) > >Exactly. Also, in user-mode "vCPU threads" (i.e. host threads) come and > >go all the time, so this doesn't work well with having a single > >code_gen_buffer, which I assumed w

Re: [Qemu-devel] [PATCH 22/22] translate-all: do not hold tb_lock during code generation in softmmu

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 11:38:50 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: (snip) > I think it would be better to have a tb_htable_lookup_or_insert function, > which performs the insert iff a matching object isn't already there, > returning the entry which *is*

Re: [Qemu-devel] [PATCH] tcg/mips: Bugfix for crash whenrunningprogram with qemu-i386.

2017-07-09 Thread jiang.biao2
> On 07/09/2017 04:04 PM, jiang.bi...@zte.com.cn wrote: > > >> if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { > > >> tcg_out_ext32u(s, base, addr_regl) > > >> -addr_regl = base > > >> +tcg_out_mov(s, TCG_TYPE_PTR, addr_regl, base) > > >> } > > >> if

Re: [Qemu-devel] [PATCH] tcg/mips: Bugfix for crash when runningprogram with qemu-i386.

2017-07-09 Thread Richard Henderson
On 07/09/2017 04:04 PM, jiang.bi...@zte.com.cn wrote: >> if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { >> tcg_out_ext32u(s, base, addr_regl); >> -addr_regl = base; >> +tcg_out_mov(s, TCG_TYPE_PTR, addr_regl, base); >> } >> if (guest_base == 0 && d

Re: [Qemu-devel] [PATCH] tcg/mips: Bugfix for crash when runningprogram with qemu-i386.

2017-07-09 Thread jiang.biao2
>> if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { >> tcg_out_ext32u(s, base, addr_regl) >> -addr_regl = base >> +tcg_out_mov(s, TCG_TYPE_PTR, addr_regl, base) >> } >> if (guest_base == 0 && data_regl != addr_regl) { >> base = addr_regl > > Th

Re: [Qemu-devel] [PATCH] block/vmdk: Report failures in vmdk_read_cid()

2017-07-09 Thread Fam Zheng
On Sun, 07/09 18:06, Peter Maydell wrote: > The function vmdk_read_cid() can fail if the read on the underlying > block device fails, or if there's a format error in the VMDK file. > However its API doesn't provide a mechanism to report these errors, > and in some cases we were returning a CID of 0

Re: [Qemu-devel] [PATCH v3 3/4] qcow2: add shrink image support

2017-07-09 Thread Max Reitz
On 2017-07-07 23:26, Eric Blake wrote: > On 07/07/2017 09:30 AM, Pavel Butsykin wrote: >> This patch add shrinking of the image file for qcow2. As a result, this >> allows >> us to reduce the virtual image size and free up space on the disk without >> copying the image. Image can be fragmented and

Re: [Qemu-devel] [PATCH v3 3/4] qcow2: add shrink image support

2017-07-09 Thread Max Reitz
On 2017-07-07 16:30, Pavel Butsykin wrote: > This patch add shrinking of the image file for qcow2. As a result, this allows > us to reduce the virtual image size and free up space on the disk without > copying the image. Image can be fragmented and shrink is done by punching > holes > in the image

Re: [Qemu-devel] [PATCH 0/2] slirp: handle errors in sosendoob()

2017-07-09 Thread Samuel Thibault
Peter Maydell, on dim. 09 juil. 2017 22:21:01 +0100, wrote: > Ping^2 ? I'm sorry I'm still too busy ATM, it's still far in my mbox. Samuel

Re: [Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Richard Henderson
On 07/09/2017 11:29 AM, Emilio G. Cota wrote: On Sun, Jul 09, 2017 at 11:19:37 -1000, Richard Henderson wrote: On 07/08/2017 09:50 PM, Emilio G. Cota wrote: This allows us to generate TCG code in parallel. MTTCG already uses it, although the next commit pushes down a lock to actually perform pa

Re: [Qemu-devel] [PATCH 17/22] tcg: distribute profiling counters across TCGContext's

2017-07-09 Thread Richard Henderson
On 07/09/2017 11:14 AM, Emilio G. Cota wrote: On Sun, Jul 09, 2017 at 10:45:55 -1000, Richard Henderson wrote: On 07/08/2017 09:50 PM, Emilio G. Cota wrote: +/* includes aborted translations because of exceptions */ +atomic_set(&prof->tb_count1, prof->tb_count1 + 1); Again, atomic_set

Re: [Qemu-devel] [PATCH 22/22] translate-all: do not hold tb_lock during code generation in softmmu

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: +if (!have_tb_lock) { +TranslationBlock *t; + +tb_lock(); +/* + * There's a chance that our desired tb has been translated while + * we were translating it. + */ +t = tb_htable_lookup(cpu, pc

Re: [Qemu-devel] [PATCH v3 2/4] qcow2: add qcow2_cache_discard

2017-07-09 Thread Max Reitz
On 2017-07-07 16:30, Pavel Butsykin wrote: > Whenever l2/refcount table clusters are discarded from the file we can > automatically drop unnecessary content of the cache tables. This reduces > the chance of eviction useful cache data and eliminates inconsistent data > in the cache with the data in

Re: [Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 11:19:37 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: > >This allows us to generate TCG code in parallel. MTTCG already uses > >it, although the next commit pushes down a lock to actually > >perform parallel generation. > > > >User-mode is

Re: [Qemu-devel] [PATCH 0/2] slirp: handle errors in sosendoob()

2017-07-09 Thread Peter Maydell
Ping^2 ? thanks -- PMM On 26 June 2017 at 13:24, Peter Maydell wrote: > Ping for review? > > thanks > -- PMM > > On 5 June 2017 at 17:19, Peter Maydell wrote: >> At the moment the slirp sosendoob() function doesn't properly >> handle errors from slirp_send(), and its callers don't do >> anythin

Re: [Qemu-devel] [PATCH v3 1/4] qemu-img: add --shrink flag for resize

2017-07-09 Thread Max Reitz
On 2017-07-07 23:12, Eric Blake wrote: > On 07/07/2017 09:30 AM, Pavel Butsykin wrote: >> The flag as additional precaution of data loss. Perhaps in the future the > > s/as/is/ s/of/against/ > >> operation shrink without this flag will be blocked for all formats, but while > > s/while/for now/ >

Re: [Qemu-devel] [PATCH 03/22] cputlb: bring back tlb_flush_count under !TLB_DEBUG

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 16:56:23 -0400, Emilio G. Cota wrote: > On Sun, Jul 09, 2017 at 10:00:01 -1000, Richard Henderson wrote: > > On 07/08/2017 09:49 PM, Emilio G. Cota wrote: > > >+atomic_set(&env->tlb_flush_count, env->tlb_flush_count + 1); > > > > Want atomic_read here, so they're all th

Re: [Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: This allows us to generate TCG code in parallel. MTTCG already uses it, although the next commit pushes down a lock to actually perform parallel generation. User-mode is kept out of this: contention due to concurrent translation is more commonly foun

Re: [Qemu-devel] [PATCH 17/22] tcg: distribute profiling counters across TCGContext's

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 10:45:55 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: > >+/* includes aborted translations because of exceptions */ > >+atomic_set(&prof->tb_count1, prof->tb_count1 + 1); > > Again, atomic_set without atomic_read is pointless. > Ei

[Qemu-devel] [PATCH] block/vpc.c: Handle write failures in get_image_offset()

2017-07-09 Thread Peter Maydell
Coverity (CID 1355236) points out that get_image_offset() doesn't check that it actually succeeded in writing the updated block bitmap to the file. Check the error return from bdrv_pwrite_sync() and propagate an error response back up to the function which calls get_image_offset() for a write so th

Re: [Qemu-devel] [PATCH 19/22] tcg: introduce tcg_context_clone

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 10:48:27 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: > >@@ -409,6 +411,18 @@ void tcg_context_init(TCGContext *s) > > } > > /* > >+ * Clone the initial TCGContext. Used by TCG threads to copy the TCGContext > >+ * set up by their parent

Re: [Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: I was not sure about tci_regs. From code inspection it seems that they have to be per-thread, so I converted them, but I do not think anyone has ever tried to get MTTCG working with TCI. Yes, those should be per-thread. Really, they should be on th

Re: [Qemu-devel] [PATCH 20/22] tcg: dynamically allocate from code_gen_buffer using equally-sized regions

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: +static void code_gen_set_region_size(TCGContext *s) +{ +size_t per_cpu = s->code_gen_buffer_size / smp_cpus; +size_t div; + +assert(per_cpu); +/* + * Use a single region if all we have is one vCPU. + * We could also use a sing

[Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping

2017-07-09 Thread Eric Auger
From: Pranavkumar Sawargaonkar Let's provide the GPEX host bridge with the INTx/gsi mapping. This is needed for INTx/gsi routing. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Tushar Jagad Signed-off-by: Eric Auger --- hw/arm/virt.c | 4 1 file changed, 4 insertions(+) diff --

[Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing

2017-07-09 Thread Eric Auger
From: Pranavkumar Sawargaonkar Now we are able to retrieve the gsi from the INTx pin, let's enable intx_to_irq routing. From that point on, irqfd becomes usable along with INTx when assigning a PCIe device. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Tushar Jagad Signed-off-by: Eric

[Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping

2017-07-09 Thread Eric Auger
From: Pranavkumar Sawargaonkar To implement INTx to gsi routing we need to pass the gpex host bridge the gsi associated to each INTx index. Let's introduce irq_num array and gpex_set_irq_num setter function. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Tushar Jagad Signed-off-by: Eri

[Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing

2017-07-09 Thread Eric Auger
This series implements INTx to gsi routing for ARM VIRT/Gpex. This is a respin of [1] which was lost in limbo. ARM virt uses GPEX PCIe bridge. This latter does not implement INTx to GSI routing. PCIe/INTx assignment works but the consequence is irqfd is not used along with INTx interrupts and VFIO

Re: [Qemu-devel] [PATCH 11/22] translate-all: use a binary search tree to track TBs in TBContext

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 10:33:41 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: > > #if defined(DEBUG_TB_FLUSH) > >+nb_tbs = g_tree_nnodes(tcg_ctx.tb_ctx.tb_tree); > > printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n", > >(unsigned l

[Qemu-devel] [RFC v5 7/8] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route

2017-07-09 Thread Eric Auger
In case the MSI is translated by an IOMMU we need to fixup the MSI route with the translated address. Signed-off-by: Eric Auger --- It is still unclear to me if we need to register an IOMMUNotifier to handle any change in the MSI doorbell which would occur behind the scene and would not lead to

[Qemu-devel] [RFC v5 5/8] hw/arm/virt-acpi-build: Add smmuv3 node in IORT table

2017-07-09 Thread Eric Auger
From: Prem Mallappa This patch builds the smmuv3 node in the ACPI IORT table. The RID space of the root complex, which spans 0x0-0x1 maps to streamid space 0x0-0x1 in smmuv3, which in turn maps to deviceid space 0x0-0x1 in the ITS group. The guest must feature the IOMMU probe deferr

Re: [Qemu-devel] [PATCH 03/22] cputlb: bring back tlb_flush_count under !TLB_DEBUG

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 10:00:01 -1000, Richard Henderson wrote: > On 07/08/2017 09:49 PM, Emilio G. Cota wrote: > >+atomic_set(&env->tlb_flush_count, env->tlb_flush_count + 1); > > Want atomic_read here, so they're all the same. It's not needed. Note that this thread is the only one ever wri

[Qemu-devel] [RFC v5 6/8] hw/arm/virt: Add tlbi-on-map property to the smmuv3 node

2017-07-09 Thread Eric Auger
For VFIO integration we need to update physical IOMMU mappings each time the guest updates the vIOMMU translation structures. For that, we rely on a special smmuv3 option, "tlbi-on-map" which forces TLB invalidations on map (this mode is similar to the Intel VTD caching Mode). The smmuv3 driver the

[Qemu-devel] [RFC v5 4/8] hw/arm/virt: Add 2.10 machine type

2017-07-09 Thread Eric Auger
The new machine type allows smmuv3 instantiation. A new option is introduced to turn the feature on/off (off by default). Signed-off-by: Eric Auger --- Another alternative would be to use the -device option as done on x86. As the smmu is a sysbus device, we would need to use the platform bus fr

[Qemu-devel] [RFC v5 8/8] hw/arm/smmuv3: VFIO integration

2017-07-09 Thread Eric Auger
This patch allows doing PCIe passthrough with a guest exposed with a vSMMUv3. It implements the replay and notify_flag_changed iommu ops. Also on TLB and data structure invalidation commands, we replay the mappings so that the physical IOMMU implements updated stage 1 settings (Guest IOVA -> Guest

[Qemu-devel] [RFC v5 3/8] hw/arm/virt: Add SMMUv3 to the virt board

2017-07-09 Thread Eric Auger
From: Prem Mallappa Add code to instantiate an smmu-v3 in mach-virt. A new boolean flag is introduced in VirtMachineState to allow this instantiation. It is currently false. Signed-off-by: Prem Mallappa Signed-off-by: Eric Auger --- v4 -> v5: - add dma-coherent property v2 -> v3: - vbi was r

[Qemu-devel] [RFC v5 2/8] hw/arm/smmuv3: smmuv3 emulation model

2017-07-09 Thread Eric Auger
From: Prem Mallappa Introduces the SMMUv3 derived model. This is based on System MMUv3 specification (v17). Signed-off-by: Prem Mallappa Signed-off-by: Eric Auger --- v4 -> v5: - change smmuv3_translate proto (IOMMUAccessFlags flag) - has_stagex replaced by is_ste_stagex - smmu_cfg_populate r

[Qemu-devel] [RFC v5 0/8] ARM SMMUv3 Emulation Support

2017-07-09 Thread Eric Auger
This series implements the emulation code for ARM SMMUv3. This is the continuation of Prem's work [1]. This v5 mainly brings VFIO integration in DT mode. On guest kernel side, this requires a quirk [1] to force TLB invalidation on map. The following changes also are noticeable: - fix SMMU_CMDQ_CO

[Qemu-devel] [RFC v5 1/8] hw/arm/smmu-common: smmu base class

2017-07-09 Thread Eric Auger
Introduces the base device and class for the ARM smmu. Implements VMSAv8-64 table lookup and translation. VMSAv8-32 is not implemented. Signed-off-by: Eric Auger Signed-off-by: Prem Mallappa --- v4 -> v5: - add initial level in translation config - implement block pte - rename must_translate in

Re: [Qemu-devel] [PATCH 19/22] tcg: introduce tcg_context_clone

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: @@ -409,6 +411,18 @@ void tcg_context_init(TCGContext *s) } /* + * Clone the initial TCGContext. Used by TCG threads to copy the TCGContext + * set up by their parent thread via tcg_context_init(). + */ +void tcg_context_clone(TCGContext *s) +

Re: [Qemu-devel] [PATCH 18/22] tcg: define TCG_HIGHWATER

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: Will come in handy very soon. Signed-off-by: Emilio G. Cota --- tcg/tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 17/22] tcg: distribute profiling counters across TCGContext's

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: +/* includes aborted translations because of exceptions */ +atomic_set(&prof->tb_count1, prof->tb_count1 + 1); Again, atomic_set without atomic_read is pointless. Either you're trying to give the compiler extra information, or you aren't. A

Re: [Qemu-devel] [PATCH 16/22] tcg: keep a list of TCGContext's

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: Before we make TCGContext thread-local. Once that is done, iterating over all TCG contexts will be quite useful; for instance we will need it to gather profiling info from each TCGContext. A possible alternative would be to keep an array of TCGContex

Re: [Qemu-devel] [PATCH 15/22] gen-icount: fold exitreq_label into TCGContext

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: Before we make TCGContext thread-local. Signed-off-by: Emilio G. Cota --- include/exec/gen-icount.h | 7 +++ tcg/tcg.h | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 14/22] tcg: take .helpers out of TCGContext

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: Before TCGContext is made thread-local. The hash table becomes read-only after it is filled in, so we can save space by keeping just a global pointer to it. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 2 -- tcg/tcg.c | 10 +- 2 files

Re: [Qemu-devel] [PATCH 11/22] translate-all: use a binary search tree to track TBs in TBContext

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: In order to use glib's binary search tree we embed a helper struct in TranslationBlock to allow us to compare tb's based on their tc_ptr as well as their tc_size fields. Using an anon struct really doesn't help. You're effectively using two differ

Re: [Qemu-devel] [PATCH v4 00/16] block: Preallocated truncate

2017-07-09 Thread Max Reitz
On 2017-06-13 22:20, Max Reitz wrote: > === Series dependencies === > > This series depends on v7 of Stefan's series > "qemu-img: add measure sub-command" > (http://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg03035.html). > > > === Actual cover letter === > > This series adds preallocat

Re: [Qemu-devel] [PATCH 09/22] exec-all: shrink tb->invalid to uint8_t

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: To avoid wasting a byte. I don't have any use in mind for this byte, but I think it's good to leave this byte explicitly free for future use. See this discussion for how the u16 came to be: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg0

Re: [Qemu-devel] [PATCH 08/22] tcg/mips: constify tcg_target_callee_save_regs

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:50 PM, Emilio G. Cota wrote: Signed-off-by: Emilio G. Cota --- tcg/mips/tcg-target.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 07/22] tcg/i386: constify tcg_target_callee_save_regs

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: Signed-off-by: Emilio G. Cota --- tcg/i386/tcg-target.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 06/22] translate-all: make have_tb_lock static

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: It is only used by this object, and it's not exported to any other. Signed-off-by: Emilio G. Cota --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 04/22] tcg: fix corruption of code_time profiling counter upon tb_flush

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: Whenever there is an overflow in code_gen_buffer (e.g. we run out of space in it and have to flush it), the code_time profiling counter ends up with an invalid value (that is, code_time -= profile_getclock(), without later on getting += profile_getclo

Re: [Qemu-devel] [PATCH 03/22] cputlb: bring back tlb_flush_count under !TLB_DEBUG

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: +atomic_set(&env->tlb_flush_count, env->tlb_flush_count + 1); Want atomic_read here, so they're all the same. Otherwise, Reviewed-by: Richard Henderson r~

Re: [Qemu-devel] [PATCH 02/22] translate-all: remove redundant !tcg_enabled check in dump_exec_info

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: This check is redundant because it is already performed by the only caller of dump_exec_info -- the caller was updated by b7da97eef ("monitor: Check whether TCG is enabled before running the "info jit" code"). Checking twice wouldn't necessarily be t

Re: [Qemu-devel] [PATCH 01/22] vl: fix breakage of -tb-size

2017-07-09 Thread Richard Henderson
On 07/08/2017 09:49 PM, Emilio G. Cota wrote: Commit e7b161d573 ("vl: add tcg_enabled() for tcg related code") adds a check to exit the program when !tcg_enabled() while parsing the -tb-size flag. It turns out that when the -tb-size flag is evaluated, tcg_enabled() can only return 0, since it is

Re: [Qemu-devel] [PATCH v9 0/9] qemu-img: add measure sub-command

2017-07-09 Thread Max Reitz
On 2017-07-05 14:57, Stefan Hajnoczi wrote: > v9: > * Fix swapped fmt <-> output_fmt parameters in documentation [Max] Oh, it was just the wrong way around there. > * Clarify that backing file clusters also available in the new image >file *may* be ommitted from the calculation [Max] [...]

Re: [Qemu-devel] [PATCH v2 3/8] Convert error_report() to warn_report()

2017-07-09 Thread Max Reitz
On 2017-07-08 01:21, Alistair Francis wrote: > Convert all uses of error_report("[Ww]arning:"... to use warn_report() > instead. This helps standardise on a single method of printing warnings > to the user. > > All of the warnings were changed using this command: > find ./* -type f -exec sed -

Re: [Qemu-devel] [PATCH 00/22] tcg: per-thread TCG

2017-07-09 Thread Emilio G. Cota
On Sun, Jul 09, 2017 at 03:49:52 -0400, Emilio G. Cota wrote: > The series applies on top of the current master (b11365867568). It's a lot of patches -- you can fetch them from: https://github.com/cota/qemu/commits/multi-tcg Note that there's a patch in the branch there that is not part of the

[Qemu-devel] [PATCH] slirp: fork_exec(): Don't close() a negative number in fork_exec()

2017-07-09 Thread Peter Maydell
In a fork_exec() error path we try to closesocket(s) when s might be a negative number because the thing that failed was the qemu_socket() call. Add a guard so we don't do this. (Spotted by Coverity: CID 1005727 issue 1 of 2.) Signed-off-by: Peter Maydell --- Issue 2 of 2 in CID 1005727 is trick

Re: [Qemu-devel] [PATCH v4 2/5] qapi: Add qobject_is_equal()

2017-07-09 Thread Max Reitz
On 2017-07-06 16:30, Markus Armbruster wrote: > Max Reitz writes: > >> This generic function (along with its implementations for different >> types) determines whether two QObjects are equal. >> >> Signed-off-by: Max Reitz >> --- >> Markus also proposed just reporting two values as unequal if th

Re: [Qemu-devel] [PATCH v4 5/5] tests: Add check-qobject for equality tests

2017-07-09 Thread Max Reitz
On 2017-07-05 22:05, Eric Blake wrote: > On 07/05/2017 02:04 PM, Max Reitz wrote: >> Add a new test file (check-qobject.c) for unit tests that concern >> QObjects as a whole. >> >> Its only purpose for now is to test the qobject_is_equal() function. >> >> Signed-off-by: Max Reitz >> --- >> tests/

Re: [Qemu-devel] [PATCH v4 2/5] qapi: Add qobject_is_equal()

2017-07-09 Thread Max Reitz
On 2017-07-05 21:49, Eric Blake wrote: > On 07/05/2017 02:04 PM, Max Reitz wrote: >> This generic function (along with its implementations for different >> types) determines whether two QObjects are equal. >> >> Signed-off-by: Max Reitz >> --- >> Markus also proposed just reporting two values as u

Re: [Qemu-devel] [PULL 5/8] commit: Fix use after free in completion

2017-07-09 Thread Peter Maydell
On 13 June 2017 at 17:46, Kevin Wolf wrote: > Am 13.06.2017 um 18:12 hat Peter Maydell geschrieben: >> On 7 June 2017 at 18:50, Kevin Wolf wrote: >> > diff --git a/block/commit.c b/block/commit.c >> > index a3028b2..af6fa68 100644 >> > --- a/block/commit.c >> > +++ b/block/commit.c >> > @@ -89,6

[Qemu-devel] [PATCH] block/vmdk: Report failures in vmdk_read_cid()

2017-07-09 Thread Peter Maydell
The function vmdk_read_cid() can fail if the read on the underlying block device fails, or if there's a format error in the VMDK file. However its API doesn't provide a mechanism to report these errors, and in some cases we were returning a CID of 0 and in some cases a CID of 0x, either of

[Qemu-devel] [PATCH] xen_pt_msi.c: Check for xen_host_pci_get_* failures in xen_pt_msix_init()

2017-07-09 Thread Peter Maydell
Check the return status of the xen_host_pci_get_* functions we call in xen_pt_msix_init(), and fail device init if the reads failed rather than ploughing ahead. (Spotted by Coverity: CID 777338.) Signed-off-by: Peter Maydell --- Disclaimer: compile tested only! The only other Xen-related Coverit

[Qemu-devel] New documentation for the LatticeMicro32 target

2017-07-09 Thread Programmingkid
I just made a documentation page for the LatticeMicro32 target. I need to know its current status, how much of this system is implemented, what software runs on it. If anyone could supply more information that would be appreciated. Pictures of this target running would be great as well. Thanks.

[Qemu-devel] About the trace framework

2017-07-09 Thread Wang Dong
Hi, I am new to QEMU. But I got some problem so that I want to figure it out. So I try to debug qemu to see what happened. And I found trace framework. I think this will help me understand the point. So I compiled qemu with option: ## *--enable-trace-backends=simple* And did as the docs/tra

Re: [Qemu-devel] [PATCH 09/22] monitor: disable "info jit" and "info opcount" if !TCG

2017-07-09 Thread Emilio G. Cota
On Thu, Jul 06, 2017 at 16:26:52 -0400, Emilio G. Cota wrote: > On Tue, Jul 04, 2017 at 13:12:02 +0200, Paolo Bonzini wrote: > > Reviewed-by: Richard Henderson > > Signed-off-by: Paolo Bonzini (snip) > > +++ b/accel/tcg/translate-all.c > > @@ -1851,6 +1851,11 @@ void dump_exec_info(FILE *f, fprin

[Qemu-devel] [PATCH 20/22] tcg: dynamically allocate from code_gen_buffer using equally-sized regions

2017-07-09 Thread Emilio G. Cota
In preparation for having multiple TCG threads. The naive solution here is to split code_gen_buffer statically among the TCG threads; this however results in poor utilization if translation needs are different across TCG threads. What we do here is to add an extra layer of indirection, assigning

[Qemu-devel] [PATCH 11/22] translate-all: use a binary search tree to track TBs in TBContext

2017-07-09 Thread Emilio G. Cota
This is a prerequisite for having threads generate code on separate buffers, which will help scalability when booting multiple cores under MTTCG. For this we need a new field (.tc_size) in TranslationBlock to keep track of the size of the translated code. This field is added into a 4-byte hole tha

[Qemu-devel] [PATCH 16/22] tcg: keep a list of TCGContext's

2017-07-09 Thread Emilio G. Cota
Before we make TCGContext thread-local. Once that is done, iterating over all TCG contexts will be quite useful; for instance we will need it to gather profiling info from each TCGContext. A possible alternative would be to keep an array of TCGContext pointers. However this option however is not t

[Qemu-devel] [PATCH 19/22] tcg: introduce tcg_context_clone

2017-07-09 Thread Emilio G. Cota
Before we make TCGContext thread-local. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 1 + tcg/tcg.c | 14 ++ 2 files changed, 15 insertions(+) diff --git a/tcg/tcg.h b/tcg/tcg.h index 2a64ee2..be5f3fd 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -778,6 +778,7 @@ static inline void *t

[Qemu-devel] [PATCH 05/22] exec-all: fix typos in TranslationBlock's documentation

2017-07-09 Thread Emilio G. Cota
Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/exec/exec-all.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 8096d64..8326e7d 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-a

[Qemu-devel] [PATCH 09/22] exec-all: shrink tb->invalid to uint8_t

2017-07-09 Thread Emilio G. Cota
To avoid wasting a byte. I don't have any use in mind for this byte, but I think it's good to leave this byte explicitly free for future use. See this discussion for how the u16 came to be: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg04564.html We could use a bool but in some systems

[Qemu-devel] [PATCH 18/22] tcg: define TCG_HIGHWATER

2017-07-09 Thread Emilio G. Cota
Will come in handy very soon. Signed-off-by: Emilio G. Cota --- tcg/tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index c19c473..2f003a0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -115,6 +115,8 @@ static int tcg_target_const_match(tcg_target_lo

[Qemu-devel] [PATCH 10/22] exec-all: move tb->invalid to the end of the struct

2017-07-09 Thread Emilio G. Cota
This opens up a 4-byte hole to be used by upcoming work. Note that moving this field to the 2nd cache line of the struct does not affect performance: tb->page_addr is in the 2nd cache line as well, and both are accessed during code lookup. Besides, the tb->invalid check is easily predicted. Signe

[Qemu-devel] [PATCH 04/22] tcg: fix corruption of code_time profiling counter upon tb_flush

2017-07-09 Thread Emilio G. Cota
Whenever there is an overflow in code_gen_buffer (e.g. we run out of space in it and have to flush it), the code_time profiling counter ends up with an invalid value (that is, code_time -= profile_getclock(), without later on getting += profile_getclock() due to the goto). Fix it by using the ti v

[Qemu-devel] [PATCH 14/22] tcg: take .helpers out of TCGContext

2017-07-09 Thread Emilio G. Cota
Before TCGContext is made thread-local. The hash table becomes read-only after it is filled in, so we can save space by keeping just a global pointer to it. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 2 -- tcg/tcg.c | 10 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --g

[Qemu-devel] [PATCH 13/22] tcg: take tb_ctx out of TCGContext

2017-07-09 Thread Emilio G. Cota
Before TCGContext is made thread-local. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/exec/tb-context.h | 2 ++ tcg/tcg.h | 2 -- accel/tcg/cpu-exec.c | 2 +- accel/tcg/translate-all.c | 57 +++ linux

[Qemu-devel] [PATCH 00/22] tcg: per-thread TCG

2017-07-09 Thread Emilio G. Cota
Original RFC here: https://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg06874.html I included Richard's feedback (Thanks!) from the original RFC, and added quite a few things. This is now a proper PATCHset since it is a lot more mature. Highlights: - It works! I tested single/multi-threa

[Qemu-devel] [PATCH 21/22] tcg: enable per-thread TCG for softmmu

2017-07-09 Thread Emilio G. Cota
This allows us to generate TCG code in parallel. MTTCG already uses it, although the next commit pushes down a lock to actually perform parallel generation. User-mode is kept out of this: contention due to concurrent translation is more commonly found in full-system mode. This patch is fairly sma

[Qemu-devel] [PATCH 02/22] translate-all: remove redundant !tcg_enabled check in dump_exec_info

2017-07-09 Thread Emilio G. Cota
This check is redundant because it is already performed by the only caller of dump_exec_info -- the caller was updated by b7da97eef ("monitor: Check whether TCG is enabled before running the "info jit" code"). Checking twice wouldn't necessarily be too bad, but here the check also returns with tb_

[Qemu-devel] [PATCH 22/22] translate-all: do not hold tb_lock during code generation in softmmu

2017-07-09 Thread Emilio G. Cota
Each vCPU can now generate code with TCG in parallel. Thus, drop tb_lock around code generation in softmmu. Note that we still have to take tb_lock after code translation, since there is global state that we have to update. Nonetheless holding tb_lock for less time provides significant performanc

[Qemu-devel] [PATCH 01/22] vl: fix breakage of -tb-size

2017-07-09 Thread Emilio G. Cota
Commit e7b161d573 ("vl: add tcg_enabled() for tcg related code") adds a check to exit the program when !tcg_enabled() while parsing the -tb-size flag. It turns out that when the -tb-size flag is evaluated, tcg_enabled() can only return 0, since it is set (or not) much later by configure_accelerato

[Qemu-devel] [PATCH 15/22] gen-icount: fold exitreq_label into TCGContext

2017-07-09 Thread Emilio G. Cota
Before we make TCGContext thread-local. Signed-off-by: Emilio G. Cota --- include/exec/gen-icount.h | 7 +++ tcg/tcg.h | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 9b3cb14..489aff7 100644 --

[Qemu-devel] [PATCH 08/22] tcg/mips: constify tcg_target_callee_save_regs

2017-07-09 Thread Emilio G. Cota
Signed-off-by: Emilio G. Cota --- tcg/mips/tcg-target.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 8cff9a6..790b4fc 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -2323,7 +2323,7 @@

[Qemu-devel] [PATCH 03/22] cputlb: bring back tlb_flush_count under !TLB_DEBUG

2017-07-09 Thread Emilio G. Cota
Commit f0aff0f124 ("cputlb: add assert_cpu_is_self checks") buried the increment of tlb_flush_count under TLB_DEBUG. This results in "info jit" always (mis)reporting 0 TLB flushes when !TLB_DEBUG. Besides, under MTTCG tlb_flush_count is updated by several threads, so in order not to lose counts we

[Qemu-devel] [PATCH 06/22] translate-all: make have_tb_lock static

2017-07-09 Thread Emilio G. Cota
It is only used by this object, and it's not exported to any other. Signed-off-by: Emilio G. Cota --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 72ce445..2fa9f65 100644 --- a/accel/tcg/

[Qemu-devel] [PATCH 17/22] tcg: distribute profiling counters across TCGContext's

2017-07-09 Thread Emilio G. Cota
TCGContext is about to be made thread-local. To avoid scalability issues when profiling info is enabled, this patch makes the profiling info counters distributed via the following changes: 1) Consolidate profile info into its own struct, TCGProfile, which TCGContext also includes. Note that tcg

[Qemu-devel] [PATCH 12/22] translate-all: report correct avg host TB size

2017-07-09 Thread Emilio G. Cota
Since commit 6e3b2bfd6 ("tcg: allocate TB structs before the corresponding translated code") we are not fully utilizing code_gen_buffer for translated code, and therefore are incorrectly reporting the amount of translated code as well as the average host TB size. Address this by: - Making the cons

  1   2   >