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@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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 -- 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