[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/37] kvm: Set up signal mask also for !CONFIG_IOTH
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 12/37] kvm: Set up signal mask also for !CONFIG_IOTHREAD |
Date: |
Mon, 14 Feb 2011 13:22:41 -0200 |
From: Jan Kiszka <address@hidden>
Block SIG_IPI, unblock it during KVM_RUN, just like in io-thread mode.
It's unused so far, but this infrastructure will be required for
self-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As
Windows doesn't support signal services, we need to provide a stub for
the init function.
Signed-off-by: Jan Kiszka <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
cpus.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index 62120c4..f27dfbd 100644
--- a/cpus.c
+++ b/cpus.c
@@ -223,11 +223,9 @@ fail:
return err;
}
-#ifdef CONFIG_IOTHREAD
static void dummy_signal(int sig)
{
}
-#endif
#else /* _WIN32 */
@@ -259,6 +257,32 @@ static void qemu_event_increment(void)
#endif /* _WIN32 */
#ifndef CONFIG_IOTHREAD
+static void qemu_kvm_init_cpu_signals(CPUState *env)
+{
+#ifndef _WIN32
+ int r;
+ sigset_t set;
+ struct sigaction sigact;
+
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_handler = dummy_signal;
+ sigaction(SIG_IPI, &sigact, NULL);
+
+ sigemptyset(&set);
+ sigaddset(&set, SIG_IPI);
+ pthread_sigmask(SIG_BLOCK, &set, NULL);
+
+ pthread_sigmask(SIG_BLOCK, NULL, &set);
+ sigdelset(&set, SIG_IPI);
+ sigdelset(&set, SIGBUS);
+ r = kvm_set_signal_mask(env, &set);
+ if (r) {
+ fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
+ exit(1);
+ }
+#endif
+}
+
int qemu_init_main_loop(void)
{
cpu_set_debug_excp_handler(cpu_debug_handler);
@@ -284,6 +308,7 @@ void qemu_init_vcpu(void *_env)
fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));
exit(1);
}
+ qemu_kvm_init_cpu_signals(env);
}
}
--
1.7.4
- [Qemu-devel] [PATCH 21/37] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN, (continued)
- [Qemu-devel] [PATCH 21/37] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 33/37] kvm: Remove unneeded memory slot reservation, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 10/37] kvm: Provide sigbus services arch-independently, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 26/37] Improve vm_stop reason declarations, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 08/37] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 13/37] kvm: Refactor qemu_kvm_eat_signals, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 36/37] kvm: Make kvm_state globally available, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 03/37] Process vmstop requests in IO thread, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 19/37] kvm: Unconditionally reenter kernel after IO exits, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 09/37] kvm: Handle kvm_init_vcpu errors, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 12/37] kvm: Set up signal mask also for !CONFIG_IOTHREAD,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 20/37] kvm: Remove static return code of kvm_handle_io, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 35/37] cirrus: Remove obsolete kvm.h include, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 28/37] Move debug exception handling out of cpu_exec, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 07/37] kvm: Report proper error on GET_VCPU_MMAP_SIZE failures, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 11/37] Refactor signal setup functions in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 23/37] Refactor kvm&tcg function names in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 14/37] kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 15/37] Set up signalfd under !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 02/37] Stop current VCPU on synchronous reset requests, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 22/37] kvm: make tsc stable over migration and machine start, Marcelo Tosatti, 2011/02/14