]> git.proxmox.com Git - mirror_qemu.git/commitdiff
ui/console: ensure do_safe_dpy_refresh holds BQL
authorAlex Bennée <alex.bennee@linaro.org>
Wed, 22 Mar 2017 16:11:13 +0000 (16:11 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Tue, 28 Mar 2017 09:52:24 +0000 (10:52 +0100)
I missed the fact that when an exclusive work item runs it drops the
BQL to ensure all no vCPUs are stuck waiting for it, hence causing a
deadlock. However the actual helper needs to take the BQL especially
as we'll be messing with device emulation bits during the update which
all assume BQL is held.

We make a minor cpu_reloading_memory_map which must try and unlock the
RCU if we are actually outside the running context.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
cpu-exec-common.c
ui/console.c

index 0504a9457b38b67d532f1a2c32e2f04c9bf4d648..e81da276bb0cd78ab2c655f60e7a6001ab8161fd 100644 (file)
@@ -35,7 +35,7 @@ void cpu_loop_exit_noexc(CPUState *cpu)
 #if defined(CONFIG_SOFTMMU)
 void cpu_reloading_memory_map(void)
 {
-    if (qemu_in_vcpu_thread()) {
+    if (qemu_in_vcpu_thread() && current_cpu->running) {
         /* The guest can in theory prolong the RCU critical section as long
          * as it feels like. The major problem with this is that because it
          * can do multiple reconfigurations of the memory map within the
index 937c95084072dccb6f8b99782ad4a4ab3458d033..dd27c9501b247423e781b307380e95269f18165b 100644 (file)
@@ -1586,7 +1586,9 @@ bool dpy_gfx_check_format(QemuConsole *con,
 static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque)
 {
     DisplayChangeListener *dcl = opaque.host_ptr;
+    qemu_mutex_lock_iothread();
     dcl->ops->dpy_refresh(dcl);
+    qemu_mutex_unlock_iothread();
 }
 
 static void dpy_refresh(DisplayState *s)