Misc patches for QEMU soft freeze
The following changes since commit 508e038a5d725f2aa729f58a1f5209b9be4227de:
dtc: Revert unintentional submodule downgrade from commit 077dd74239a99 (2017-03-03 12:48:42 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to f6eb0b319e4bad3d01d74d71e3a6cf40f0ede720:
iscsi: fix missing unlock (2017-03-03 16:41:20 +0100)
v4->v5: 4.11 kernel header already merged
added two more patches at the end
----------------------------------------------------------------
* kernel header update (requested by David and Vijay)
* GuestPanicInformation fixups (Anton)
* record/replay icount fixes (Pavel)
* cpu-exec cleanup, unification of icount_decr with tcg_exit_req (me)
* KVM_CAP_IMMEDIATE_EXIT support (me)
* vmxcap update (me)
* iscsi locking fix (me)
* VFIO ram device fix (Yongji)
* scsi-hd vs. default CD-ROM (Hervé)
* SMI migration fix (Dave)
* spice-char segfault (Li Qiang)
* improved "info mtree -f" (me)
----------------------------------------------------------------
Anton Nefedov (2):
qapi: flatten GuestPanicInformation union
qmp-events: fix GUEST_PANICKED description formatting
Dr. David Alan Gilbert (1):
x86: Work around SMI migration breakages
Hervé Poussineau (1):
vl: disable default cdrom when using explicitely scsi-hd
Li Qiang (1):
spice-char: fix segfault in char_spice_finalize
Paolo Bonzini (15):
cpu-exec: unify icount_decr and tcg_exit_req
cpu-exec: remove unnecessary check of cpu->exit_request Merge branch 'icount-update' into HEAD
cpus: remove ugly cast on sigbus_handler
KVM: x86: cleanup SIGBUS handlers
cpus: reorganize signal handling code
KVM: remove kvm_arch_on_sigbus
KVM: do not use sigtimedwait to catch SIGBUS
KVM: move SIG_IPI handling to kvm-all.c
kvm: use atomic_read/atomic_set to access cpu->exit_request
KVM: use KVM_CAP_IMMEDIATE_EXIT
vmxcap: port to Python 3
vmxcap: update for September 2016 SDM
memory: show region offset and ROM/RAM type in "info mtree -f"
iscsi: fix missing unlock
Pavel Dovgalyuk (1):
replay: check icount in cpu exec loop
Yongji Xie (1):
memory: Introduce DEVICE_HOST_ENDIAN for ram device
block/iscsi.c | 4 ++ cpu-exec.c | 93 +++++++++++++--------------- cpus.c | 102 +++++-------------------------- include/exec/cpu-common.h | 6 ++ include/exec/gen-icount.h | 53 ++++++++-------- include/hw/i386/pc.h | 4 ++ include/qemu/compatfd.h | 42 ------------- include/qemu/osdep.h | 37 ++++++++++++ include/qom/cpu.h | 15 +++-- include/sysemu/kvm.h | 11 ++-- kvm-all.c | 150 ++++++++++++++++++++++++++++++++++++++++++---- kvm-stub.c | 12 ++-- memory.c | 27 ++++++--- qapi-schema.json | 12 ++++ qapi/event.json | 4 +- qom/cpu.c | 2 +- scripts/kvm/vmxcap | 23 ++++--- spice-qemu-char.c | 5 +- target/arm/kvm.c | 10 ---- target/i386/cpu.c | 17 +++--- target/i386/cpu.h | 3 + target/i386/kvm.c | 88 +++++++++------------------ target/mips/kvm.c | 12 ---- target/ppc/kvm.c | 10 ---- target/s390x/kvm.c | 10 ---- tcg/tcg.h | 1 - translate-all.c | 2 +- translate-common.c | 13 ++-- util/compatfd.c | 1 - util/main-loop.c | 5 +- util/oslib-posix.c | 33 ++++++++++ vl.c | 13 ++-- 32 files changed, 428 insertions(+), 392 deletions(-) delete mode 100644 include/qemu/compatfd.h
---
PATCH 18/21 spice-char: fix segfault in char_spice_finalize
From: Li Qiang <[email protected]>
In 'qemu_chr_open_spice_vmc' if the 'psubtype' is NULL, it will call 'char_spice_finalize'. But as the SpiceChardev is not inserted in the 'spice_chars' list, the 'QLIST_REMOVE' will cause a segfault. Add a detect to avoid it.
Message-Id: <[email protected]>
--- spice-qemu-char.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
spice-qemu-char.c +4 -1
@@ -215,7 +215,10 @@ static void char_spice_finalize(Object *obj)SpiceChardev *s =SPICE_CHARDEV (obj);vmc_unregister_interface (s); -QLIST_REMOVE (s, next); + +if (s->next.le_prev) { +QLIST_REMOVE (s, next); + }g_free ((char *)s->sin.subtype);#if SPICE_SERVER_VERSION >=0x000c02
Signature · 1 line
1.8.3.1
PATCH 19/21 x86: Work around SMI migration breakages
In reply to Paolo BonziniFrom: "Dr. David Alan Gilbert" <[email protected]>
Migration from a 2.3.0 qemu results in a reboot on the receiving QEMU due to a disagreement about SM (System management) interrupts.
2.3.0 didn't have much SMI support, but it did set CPU_INTERRUPT_SMI and this gets into the migration stream, but on 2.3.0 it never got delivered.
~2.4.0 SMI interrupt support was added but was broken - so that when a 2.3.0 stream was received it cleared the CPU_INTERRUPT_SMI but never actually caused an interrupt.
The SMI delivery was recently fixed by 68c6efe07a, but the effect now is that an incoming 2.3.0 stream takes the interrupt it had flagged but it's bios can't actually handle it(I think partly due to the original interrupt not being taken during boot?). The consequence is a triple(?) fault and a reboot.
Tested from:
2.3.1 -M 2.3.0
2.7.0 -M 2.3.0
2.8.0 -M 2.3.0
2.8.0 -M 2.8.0
This corresponds to RH bugzilla entry 1420679.
Message-Id: <[email protected]>
--- include/hw/i386/pc.h | 4 ++++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 3 +++ target/i386/kvm.c | 7 ++++++- 4 files changed, 15 insertions(+), 1 deletion(-)
include/hw/i386/pc.h +4 -0
@@ -623,6 +623,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\ .property = "xlevel",\ .value = stringify(0x8000000a),\ + },{\ + .driver = TYPE_X86_CPU,\ + .property = "kvm-no-smi-migration",\ + .value = "on",\ },#define PC_COMPAT_2_2 \
target/i386/cpu.c +2 -0
@@ -3983,6 +3983,8 @@ static Property x86_cpu_properties[] = {DEFINE_PROP_BOOL ("cpuid-0xb" ,X86CPU , enable_cpuid_0xb, true),DEFINE_PROP_BOOL ("lmce" ,X86CPU , enable_lmce, false),DEFINE_PROP_BOOL ("l3-cache" ,X86CPU , enable_l3_cache, true), +DEFINE_PROP_BOOL ("kvm-no-smi-migration" ,X86CPU , kvm_no_smi_migration, + false),DEFINE_PROP_BOOL ("vmware-cpuid-freq" ,X86CPU , vmware_cpuid_freq, true), DEFINE_PROP_END_OF_LIST() };
target/i386/cpu.h +3 -0
@@ -1255,6 +1255,9 @@ struct X86CPU {/* if true override the phys_bits value with a value read from the host */ bool host_phys_bits; +/* Stop SMI delivery for migration compatibility with old machines */ +bool kvm_no_smi_migration; +/* Number of physical address bits supported */ uint32_t phys_bits;
target/i386/kvm.c +6 -1
@@ -2492,7 +2492,12 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) events.smi.pending =0 ; events.smi.latched_init =0 ; } - events.flags |=KVM_VCPUEVENT_VALID_SMM ; +/* Stop SMI delivery on old machine types to avoid a reboot +* on an inward migration of an old VM. +*/ +if (!cpu->kvm_no_smi_migration) { + events.flags |=KVM_VCPUEVENT_VALID_SMM ; + } }if (level >=KVM_PUT_RESET_STATE ) {
Signature · 1 line
1.8.3.1
PATCH 20/21 memory: show region offset and ROM/RAM type in "info mtree -f"
In reply to Paolo Bonzini"info mtree -f" output is currently hard to use for large RAM regions, because there is no hint as to what part of the region is being mapped. Add the offset if it is nonzero.
Secondly, FlatView has a readonly field, that can override the MemoryRegion in the presence of aliases. Take it into account.
Together, with this patch this:
address-space (flat view): KVM-SMRAM
0000000000000000-00000000000bffff (prio 0, ram): pc.ram 00000000000c0000-00000000000c9fff (prio 0, ram): pc.ram 00000000000ca000-00000000000ccfff (prio 0, ram): pc.ram 00000000000cd000-00000000000ebfff (prio 0, ram): pc.ram 00000000000ec000-00000000000effff (prio 0, ram): pc.ram 00000000000f0000-00000000000fffff (prio 0, ram): pc.ram 0000000000100000-00000000bfffffff (prio 0, ram): pc.ram 00000000fd000000-00000000fdffffff (prio 1, ram): vga.vram 00000000febc0000-00000000febdffff (prio 1, i/o): e1000-mmio 00000000febf0400-00000000febf041f (prio 0, i/o): vga ioports remapped 00000000febf0500-00000000febf0515 (prio 0, i/o): bochs dispi interface 00000000febf0600-00000000febf0607 (prio 0, i/o): qemu extended regs 00000000fec00000-00000000fec00fff (prio 0, i/o): kvm-ioapic 00000000fed00000-00000000fed003ff (prio 0, i/o): hpet 00000000fee00000-00000000feefffff (prio 4096, i/o): kvm-apic-msi 00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios 0000000100000000-000000013fffffff (prio 0, ram): pc.ram
becomes this:
address-space (flat view): KVM-SMRAM
0000000000000000-00000000000bffff (prio 0, ram): pc.ram 00000000000c0000-00000000000c9fff (prio 0, rom): pc.ram @00000000000c0000 00000000000ca000-00000000000ccfff (prio 0, ram): pc.ram @00000000000ca000 00000000000cd000-00000000000ebfff (prio 0, rom): pc.ram @00000000000cd000 00000000000ec000-00000000000effff (prio 0, ram): pc.ram @00000000000ec000 00000000000f0000-00000000000fffff (prio 0, rom): pc.ram @00000000000f0000 0000000000100000-00000000bfffffff (prio 0, ram): pc.ram @0000000000100000 00000000fd000000-00000000fdffffff (prio 1, ram): vga.vram 00000000febc0000-00000000febdffff (prio 1, i/o): e1000-mmio 00000000febf0400-00000000febf041f (prio 0, i/o): vga ioports remapped 00000000febf0500-00000000febf0515 (prio 0, i/o): bochs dispi interface 00000000febf0600-00000000febf0607 (prio 0, i/o): qemu extended regs 00000000fec00000-00000000fec00fff (prio 0, i/o): kvm-ioapic 00000000fed00000-00000000fed003ff (prio 0, i/o): hpet 00000000fee00000-00000000feefffff (prio 4096, i/o): kvm-apic-msi 00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios 0000000100000000-000000013fffffff (prio 0, ram): pc.ram @00000000c0000000
This should make it easier to understand what's going on.
--- memory.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
memory.c +18 -7
@@ -2588,13 +2588,24 @@ static void mtree_print_flatview(fprintf_function p, void *f,while (n--) { mr = range->mr; - p(f, MTREE_INDENT TARGET_FMT_plx "-" - TARGET_FMT_plx" (prio %d, %s): %s\n" , -int128_get64 (range->addr.start), -int128_get64 (range->addr.start) +MR_SIZE (range->addr.size), - mr->priority, -memory_region_type (mr), -memory_region_name (mr)); +if (range->offset_in_region) { + p(f, MTREE_INDENT TARGET_FMT_plx "-" + TARGET_FMT_plx" (prio %d, %s): %s @" TARGET_FMT_plx"\n" , +int128_get64 (range->addr.start), +int128_get64 (range->addr.start) +MR_SIZE (range->addr.size), + mr->priority, + range->readonly ?"rom" :memory_region_type (mr), +memory_region_name (mr), + range->offset_in_region); + }else { + p(f, MTREE_INDENT TARGET_FMT_plx "-" + TARGET_FMT_plx" (prio %d, %s): %s\n" , +int128_get64 (range->addr.start), +int128_get64 (range->addr.start) +MR_SIZE (range->addr.size), + mr->priority, + range->readonly ?"rom" :memory_region_type (mr), +memory_region_name (mr)); + } range++; }
Signature · 1 line
1.8.3.1
PATCH 21/21 iscsi: fix missing unlock
In reply to Paolo BonziniReported by Coverity.
--- block/iscsi.c | 4 ++++ 1 file changed, 4 insertions(+)
block/iscsi.c +4 -0
@@ -637,6 +637,7 @@ retry: }#endif if (iTask.task ==NULL ) { +qemu_mutex_unlock (&iscsilun->mutex);return -ENOMEM ; }#if LIBISCSI_API_VERSION < (20160603 )
@@ -864,6 +865,7 @@ retry: }#endif if (iTask.task ==NULL ) { +qemu_mutex_unlock (&iscsilun->mutex);return -ENOMEM ; }#if LIBISCSI_API_VERSION < (20160603 )
@@ -904,6 +906,7 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs) retry:if (iscsi_synchronizecache10_task (iscsilun->iscsi, iscsilun->lun,0 ,0 ,0 ,0 , iscsi_co_generic_cb, &iTask) ==NULL ) { +qemu_mutex_unlock (&iscsilun->mutex);return -ENOMEM ; }
@@ -1237,6 +1240,7 @@ retry: 0, 0, iscsi_co_generic_cb, &iTask); }if (iTask.task ==NULL ) { +qemu_mutex_unlock (&iscsilun->mutex);return -ENOMEM ; }
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 6 lines · Paolo Bonzini
The following changes since commit
508e038a5d725f2aa729f58a1f5209b9be4227de:dtc: Revert unintentional submodule downgrade from commit
077dd74239a99(2017-03-03 12:48:42 +0000)are available in the git repository at:
Quoted 9 lines
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
f6eb0b319e4bad3d01d74d71e3a6cf40f0ede720:iscsi: fix missing unlock (2017-03-03 16:41:20 +0100)
v4->v5: 4.11 kernel header already merged
added two more patches at the end
Applied, thanks.
-- PMM