[PATCH 17/20] qemu-kvm: Use upstream main loop initialization

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

 



Switch to CONFIG_IOTHREAD version of qemu_kvm_init_main_loop and drop
qemu_kvm_init_main_loop as well as kvm_init_ap.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 cpus.c     |   62 +-----------------------------------------------------------
 kvm-all.c  |    2 -
 qemu-kvm.h |    1 -
 3 files changed, 1 insertions(+), 64 deletions(-)

diff --git a/cpus.c b/cpus.c
index a4bac1a..7bd888a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -529,9 +529,7 @@ static void qemu_tcg_init_cpu_signals(void)
 }
 #endif /* _WIN32 */
 
-/*#ifndef CONFIG_IOTHREAD*/
-static void qemu_kvm_init_main_loop(void);
-
+#ifndef CONFIG_IOTHREAD
 int qemu_init_main_loop(void)
 {
     int ret;
@@ -540,13 +538,11 @@ int qemu_init_main_loop(void)
     if (ret) {
         return ret;
     }
-    qemu_kvm_init_main_loop();
 
     qemu_init_sigbus();
 
     return qemu_event_init();
 }
-#ifndef CONFIG_IOTHREAD
 
 void qemu_main_loop_start(void)
 {
@@ -653,7 +649,6 @@ static QemuCond qemu_system_cond;
 static QemuCond qemu_pause_cond;
 static QemuCond qemu_work_cond;
 
-#ifdef UNUSED_IOTHREAD_IMPL
 int qemu_init_main_loop(void)
 {
     int ret;
@@ -683,7 +678,6 @@ int qemu_init_main_loop(void)
 
     return 0;
 }
-#endif /* UNUSED_IOTHREAD_IMPL */
 
 void qemu_main_loop_start(void)
 {
@@ -1200,10 +1194,6 @@ unsigned long kvm_get_thread_id(void)
     return syscall(SYS_gettid);
 }
 
-static void sig_ipi_handler(int n)
-{
-}
-
 static void kvm_main_loop_wait(CPUState *env, int timeout)
 {
     struct timespec ts;
@@ -1338,58 +1328,8 @@ int kvm_init_vcpu(CPUState *env)
     return 0;
 }
 
-int kvm_init_ap(void)
-{
-    struct sigaction action;
-
-    qemu_mutex_lock(&qemu_global_mutex);
-
-    signal(SIG_IPI, sig_ipi_handler);
-
-    memset(&action, 0, sizeof(action));
-    action.sa_flags = SA_SIGINFO;
-    action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
-    sigaction(SIGBUS, &action, NULL);
-    prctl(PR_MCE_KILL, 1, 1, 0, 0);
-    return 0;
-}
-
 bool qemu_system_is_ready(void)
 {
     return qemu_system_ready;
 }
-
-static void qemu_kvm_init_main_loop(void)
-{
-    sigset_t mask;
-    int sigfd;
-
-    sigemptyset(&mask);
-    sigaddset(&mask, SIGIO);
-    sigaddset(&mask, SIGALRM);
-    sigaddset(&mask, SIGBUS);
-    sigprocmask(SIG_BLOCK, &mask, NULL);
-
-    sigfd = qemu_signalfd(&mask);
-    if (sigfd == -1) {
-        fprintf(stderr, "failed to create signalfd\n");
-        exit(1);
-    }
-
-    fcntl(sigfd, F_SETFL, O_NONBLOCK);
-
-    qemu_set_fd_handler2(sigfd, NULL, sigfd_handler, NULL,
-                         (void *)(unsigned long) sigfd);
-
-    qemu_cond_init(&qemu_cpu_cond);
-    qemu_cond_init(&qemu_system_cond);
-    qemu_cond_init(&qemu_pause_cond);
-    qemu_cond_init(&qemu_work_cond);
-    qemu_mutex_init(&qemu_fair_mutex);
-    qemu_mutex_init(&qemu_global_mutex);
-    qemu_mutex_lock(&qemu_global_mutex);
-
-    qemu_thread_get_self(&io_thread);
-}
-
 #endif /* CONFIG_KVM */
diff --git a/kvm-all.c b/kvm-all.c
index e6a2b65..7b032ba 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -821,8 +821,6 @@ int kvm_init(void)
         return ret;
     }
 
-    kvm_init_ap();
-
     cpu_interrupt_handler = kvm_handle_interrupt;
 
     return 0;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2420f82..a4c811c 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -266,7 +266,6 @@ struct kvm_pit_state {
 #endif                          /* !CONFIG_KVM */
 
 int kvm_create_vcpu(CPUState *env);
-int kvm_init_ap(void);
 void kvm_save_lapic(CPUState *env);
 void kvm_load_lapic(CPUState *env);
 
-- 
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