[PATCH 05/18] kvm: Set up signal mask also for !CONFIG_IOTHREAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>

Block SIG_IPI and SIGBUS, unblock them during KVM_RUN, just like in
io-thread mode. This will be required to process SIGBUS and for
self-IPIs. As Windows doesn't support signal services, we need to
provide a stub for the init function.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 cpus.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/cpus.c b/cpus.c
index a21e2d6..bf0fb85 100644
--- a/cpus.c
+++ b/cpus.c
@@ -223,7 +223,6 @@ fail:
     return err;
 }
 
-#ifdef CONFIG_IOTHREAD
 static void dummy_signal(int sig)
 {
 }
@@ -238,6 +237,13 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
     sigact.sa_handler = dummy_signal;
     sigaction(SIG_IPI, &sigact, NULL);
 
+#ifndef CONFIG_IOTHREAD
+    sigemptyset(&set);
+    sigaddset(&set, SIG_IPI);
+    sigaddset(&set, SIGBUS);
+    pthread_sigmask(SIG_BLOCK, &set, NULL);
+#endif
+
     pthread_sigmask(SIG_BLOCK, NULL, &set);
     sigdelset(&set, SIG_IPI);
     sigdelset(&set, SIGBUS);
@@ -247,7 +253,6 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
         exit(1);
     }
 }
-#endif
 
 #else /* _WIN32 */
 
@@ -276,6 +281,10 @@ static void qemu_event_increment(void)
         exit (1);
     }
 }
+
+static void qemu_kvm_init_cpu_signals(CPUState *env)
+{
+}
 #endif /* _WIN32 */
 
 #ifndef CONFIG_IOTHREAD
@@ -296,8 +305,10 @@ void qemu_init_vcpu(void *_env)
 
     env->nr_cores = smp_cores;
     env->nr_threads = smp_threads;
-    if (kvm_enabled())
+    if (kvm_enabled()) {
         kvm_init_vcpu(env);
+        qemu_kvm_init_cpu_signals(env);
+    }
     return;
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux