All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze
@ 2017-03-03 16:30 Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 18/21] spice-char: fix segfault in char_spice_finalize Paolo Bonzini
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-03-03 16:30 UTC (permalink / raw)
  To: qemu-devel

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
---

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 18/21] spice-char: fix segfault in char_spice_finalize
  2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
@ 2017-03-03 16:30 ` Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 19/21] x86: Work around SMI migration breakages Paolo Bonzini
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-03-03 16:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Qiang, Li Qiang

From: Li Qiang <liq3ea@gmail.com>

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.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-Id: <1487665107-88004-1-git-send-email-liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 spice-qemu-char.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 6f46f46..4d1c76e 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -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
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 19/21] x86: Work around SMI migration breakages
  2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 18/21] spice-char: fix segfault in char_spice_finalize Paolo Bonzini
@ 2017-03-03 16:30 ` Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 20/21] memory: show region offset and ROM/RAM type in "info mtree -f" Paolo Bonzini
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-03-03 16:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170223133441.16010-1-dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d1f4554..ab303c7 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -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 \
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index aec5d9d..fba9212 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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()
 };
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 12a39d5..ac2ad6d 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -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;
 
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 7698421..887a812 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -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) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 20/21] memory: show region offset and ROM/RAM type in "info mtree -f"
  2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 18/21] spice-char: fix segfault in char_spice_finalize Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 19/21] x86: Work around SMI migration breakages Paolo Bonzini
@ 2017-03-03 16:30 ` Paolo Bonzini
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 21/21] iscsi: fix missing unlock Paolo Bonzini
  2017-03-04 12:50 ` [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-03-03 16:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Xu, William Tambe

"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.

Cc: Peter Xu <peterx@redhat.com>
Cc: "William Tambe" <tambewilliam@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 memory.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/memory.c b/memory.c
index 573fa6e..284894b 100644
--- a/memory.c
+++ b/memory.c
@@ -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++;
     }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 21/21] iscsi: fix missing unlock
  2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
                   ` (2 preceding siblings ...)
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 20/21] memory: show region offset and ROM/RAM type in "info mtree -f" Paolo Bonzini
@ 2017-03-03 16:30 ` Paolo Bonzini
  2017-03-04 12:50 ` [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-03-03 16:30 UTC (permalink / raw)
  To: qemu-devel

Reported by Coverity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/iscsi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index 76319a1..75d8905 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -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;
     }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze
  2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
                   ` (3 preceding siblings ...)
  2017-03-03 16:30 ` [Qemu-devel] [PATCH 21/21] iscsi: fix missing unlock Paolo Bonzini
@ 2017-03-04 12:50 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2017-03-04 12:50 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 3 March 2017 at 16:30, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 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
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-04 12:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 16:30 [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Paolo Bonzini
2017-03-03 16:30 ` [Qemu-devel] [PATCH 18/21] spice-char: fix segfault in char_spice_finalize Paolo Bonzini
2017-03-03 16:30 ` [Qemu-devel] [PATCH 19/21] x86: Work around SMI migration breakages Paolo Bonzini
2017-03-03 16:30 ` [Qemu-devel] [PATCH 20/21] memory: show region offset and ROM/RAM type in "info mtree -f" Paolo Bonzini
2017-03-03 16:30 ` [Qemu-devel] [PATCH 21/21] iscsi: fix missing unlock Paolo Bonzini
2017-03-04 12:50 ` [Qemu-devel] [PULL v5 00/21] Misc patches for QEMU soft freeze Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.