qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH] Implement qemu_kvm_eat_signals only for CONFIG_LINUX
Date: Sun, 06 Mar 2011 19:59:17 +0100	[thread overview]
Message-ID: <4D73D985.5020206@web.de> (raw)
In-Reply-To: <F76813CE-4ACC-4319-9F75-ED29A10DE830@web.de>

On 2011-03-06 18:46, Andreas Färber wrote:
> Hello,
> 
> Am 22.02.2010 um 22:26 schrieb Marcelo Tosatti:
> 
>> Change the way the internal qemu signal, used for communication between
>> iothread and vcpus, is handled.
>>
>> Block and consume it with sigtimedwait on the outer vcpu loop, which
>> allows more precise timing control.
> 
> Mac OS X v10.5 does not seem to support sigtimedwait():
> 
>   CC    arm-softmmu/cpus.o
> /Users/andreas/QEMU/qemu/cpus.c: In function ‘qemu_kvm_eat_signals’:
> /Users/andreas/QEMU/qemu/cpus.c:379: warning: implicit declaration of
> function ‘sigtimedwait’
> /Users/andreas/QEMU/qemu/cpus.c:379: warning: nested extern declaration
> of ‘sigtimedwait’
> /Users/andreas/QEMU/qemu/cpus.c:388: warning: implicit declaration of
> function ‘sigbus_reraise’
> /Users/andreas/QEMU/qemu/cpus.c:388: warning: nested extern declaration
> of ‘sigbus_reraise’
> 
> Could you please add some #ifdef? It used to be an optional POSIX
> extension.

This should fix it.

Jan

------8<-------

From: Jan Kiszka <jan.kiszka@siemens.com>

qemu_kvm_eat_signals requires POSIX support with realtime extensions for
sigtimedwait. Not all our target platforms provide this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 cpus.c |   94 ++++++++++++++++++++++++++++++++--------------------------------
 1 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/cpus.c b/cpus.c
index 94af696..a10559d 100644
--- a/cpus.c
+++ b/cpus.c
@@ -235,11 +235,58 @@ static void qemu_init_sigbus(void)
     prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
 }
 
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+    struct timespec ts = { 0, 0 };
+    siginfo_t siginfo;
+    sigset_t waitset;
+    sigset_t chkset;
+    int r;
+
+    sigemptyset(&waitset);
+    sigaddset(&waitset, SIG_IPI);
+    sigaddset(&waitset, SIGBUS);
+
+    do {
+        r = sigtimedwait(&waitset, &siginfo, &ts);
+        if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
+            perror("sigtimedwait");
+            exit(1);
+        }
+
+        switch (r) {
+        case SIGBUS:
+            if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
+                sigbus_reraise();
+            }
+            break;
+        default:
+            break;
+        }
+
+        r = sigpending(&chkset);
+        if (r == -1) {
+            perror("sigpending");
+            exit(1);
+        }
+    } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
+
+#ifndef CONFIG_IOTHREAD
+    if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
+        qemu_notify_event();
+    }
+#endif
+}
+
 #else /* !CONFIG_LINUX */
 
 static void qemu_init_sigbus(void)
 {
 }
+
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+}
 #endif /* !CONFIG_LINUX */
 
 #ifndef _WIN32
@@ -364,49 +411,6 @@ static int qemu_signalfd_init(sigset_t mask)
     return 0;
 }
 
-static void qemu_kvm_eat_signals(CPUState *env)
-{
-    struct timespec ts = { 0, 0 };
-    siginfo_t siginfo;
-    sigset_t waitset;
-    sigset_t chkset;
-    int r;
-
-    sigemptyset(&waitset);
-    sigaddset(&waitset, SIG_IPI);
-    sigaddset(&waitset, SIGBUS);
-
-    do {
-        r = sigtimedwait(&waitset, &siginfo, &ts);
-        if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
-            perror("sigtimedwait");
-            exit(1);
-        }
-
-        switch (r) {
-        case SIGBUS:
-            if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
-                sigbus_reraise();
-            }
-            break;
-        default:
-            break;
-        }
-
-        r = sigpending(&chkset);
-        if (r == -1) {
-            perror("sigpending");
-            exit(1);
-        }
-    } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
-
-#ifndef CONFIG_IOTHREAD
-    if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
-        qemu_notify_event();
-    }
-#endif
-}
-
 #else /* _WIN32 */
 
 HANDLE qemu_event_handle;
@@ -434,10 +438,6 @@ static void qemu_event_increment(void)
         exit (1);
     }
 }
-
-static void qemu_kvm_eat_signals(CPUState *env)
-{
-}
 #endif /* _WIN32 */
 
 #ifndef CONFIG_IOTHREAD

  reply	other threads:[~2011-03-06 18:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 21:26 [Qemu-devel] [PATCH 0/8] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 1/8] use eventfd for iothread Marcelo Tosatti
2010-02-26 12:35   ` [Qemu-devel] " Pierre Riteau
2010-02-22 21:26 ` [Qemu-devel] [PATCH 2/8] kvm: Fix eflags corruption in kvm mode Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 3/8] kvm: Kill CR3_CACHE feature references Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 4/8] block SIGCHLD in vcpu thread(s) Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 5/8] kvm specific wait_io_event Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 6/8] kvm: consume internal signal with sigtimedwait Marcelo Tosatti
2011-03-06 17:46   ` Andreas Färber
2011-03-06 18:59     ` Jan Kiszka [this message]
2010-02-22 21:26 ` [Qemu-devel] [PATCH 7/8] kvm: remove pre-entry exit_request check with iothread enabled Marcelo Tosatti
2010-02-22 21:26 ` [Qemu-devel] [PATCH 8/8] kvm-all.c: define smp_wmb and use it for coalesced mmio Marcelo Tosatti
2010-02-22 22:22 ` [Qemu-devel] Re: [PATCH 0/8] [GIT PULL] qemu-kvm.git uq/master queue Anthony Liguori

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=4D73D985.5020206@web.de \
    --to=jan.kiszka@web.de \
    --cc=aliguori@us.ibm.com \
    --cc=andreas.faerber@web.de \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).