All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>, Anthony Liguori <anthony@codemonkey.ws>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: [patch 2/3] QEMU/KVM: add function to handle signals
Date: Thu, 27 Mar 2008 12:09:08 -0300	[thread overview]
Message-ID: <20080327151016.860749563@localhost.localdomain> (raw)
In-Reply-To: 20080327150906.699073229@localhost.localdomain

[-- Attachment #1: io-thread-sig --]
[-- Type: text/plain, Size: 1892 bytes --]

SIGUSR1 has no handler, and the SIGUSR2 one does nothing useful anymore 
(thats also true for SIGIO on tap fd, which runs host_alarm_handler
unnecessarily). 

Index: kvm-userspace.io/qemu/qemu-kvm.c
===================================================================
--- kvm-userspace.io.orig/qemu/qemu-kvm.c
+++ kvm-userspace.io/qemu/qemu-kvm.c
@@ -161,13 +161,30 @@ static int has_work(CPUState *env)
     return kvm_arch_has_work(env);
 }
 
+static int kvm_process_signal(int si_signo)
+{
+    struct sigaction sa;
+
+    switch (si_signo) {
+    case SIGUSR2:
+        pthread_cond_signal(&qemu_aio_cond);
+        break;
+    case SIGALRM:
+    case SIGIO:
+        sigaction(si_signo, NULL, &sa);
+        sa.sa_handler(si_signo);
+        break;
+    }
+
+    return 1;
+}
+
 static int kvm_eat_signal(struct qemu_kvm_signal_table *waitset, CPUState *env,
                           int timeout)
 {
     struct timespec ts;
     int r, e, ret = 0;
     siginfo_t siginfo;
-    struct sigaction sa;
 
     ts.tv_sec = timeout / 1000;
     ts.tv_nsec = (timeout % 1000) * 1000000;
@@ -182,13 +199,9 @@ static int kvm_eat_signal(struct qemu_kv
 	printf("sigtimedwait: %s\n", strerror(e));
 	exit(1);
     }
-    if (r != -1) {
-	sigaction(siginfo.si_signo, NULL, &sa);
-	sa.sa_handler(siginfo.si_signo);
-	if (siginfo.si_signo == SIGUSR2)
-	    pthread_cond_signal(&qemu_aio_cond);
-	ret = 1;
-    }
+    if (r != -1)
+        ret = kvm_process_signal(siginfo.si_signo);
+
     if (env && vcpu_info[env->cpu_index].stop) {
 	vcpu_info[env->cpu_index].stop = 0;
 	vcpu_info[env->cpu_index].stopped = 1;

-- 


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

  parent reply	other threads:[~2008-03-27 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 15:09 [patch 0/3] QEMU dedicated IO thread Marcelo Tosatti
2008-03-27 15:09 ` [patch 1/3] QEMU/KVM: separate thread for IO handling Marcelo Tosatti
2008-03-27 15:23   ` Avi Kivity
2008-03-27 15:48     ` Marcelo Tosatti
2008-03-27 15:49       ` Avi Kivity
2008-03-27 15:09 ` Marcelo Tosatti [this message]
2008-03-27 15:25   ` [patch 2/3] QEMU/KVM: add function to handle signals Avi Kivity
2008-03-27 15:57     ` Marcelo Tosatti
2008-03-27 15:57       ` Avi Kivity
2008-03-27 16:55   ` Avi Kivity
2008-03-27 15:09 ` [patch 3/3] QEMU/libkvm: dont create vcpu0 thread Marcelo Tosatti
2008-03-27 15:55   ` Avi Kivity
2008-03-27 15:54 ` [patch 0/3] QEMU dedicated IO thread Avi Kivity
2008-03-27 19:06   ` Avi Kivity
2008-03-27 20:21     ` Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2008-04-02 23:20 [patch 0/3] separate thread for IO handling V3 Marcelo Tosatti
2008-04-02 23:20 ` [patch 2/3] QEMU/KVM: add function to handle signals Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080327151016.860749563@localhost.localdomain \
    --to=mtosatti@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.