qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 06/18] kvm: Refactor qemu_kvm_eat_signals
Date: Mon, 10 Jan 2011 11:15:55 +0100	[thread overview]
Message-ID: <4D2ADC5B.1050308@redhat.com> (raw)
In-Reply-To: <8630ac717d7c3fefaf091b70feaf17e63c411c26.1294648329.git.jan.kiszka@web.de>

On 01/10/2011 09:31 AM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> We do not use the timeout, so drop its logic. As we always poll our
> signals, we do not need to drop the global lock. Removing those calls
> allows some further simplifications. Also fix the error processing of
> sigpending at this chance.
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
> ---
>   cpus.c |   23 +++++++----------------
>   1 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index bf0fb85..6da0f8f 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -617,31 +617,22 @@ static void sigbus_handler(int n, struct qemu_signalfd_siginfo *siginfo,
>       }
>   }
>
> -static void qemu_kvm_eat_signal(CPUState *env, int timeout)
> +static void qemu_kvm_eat_signals(CPUState *env)
>   {
> -    struct timespec ts;
> -    int r, e;
> +    struct timespec ts = { 0, 0 };
>       siginfo_t siginfo;
>       sigset_t waitset;
>       sigset_t chkset;
> -
> -    ts.tv_sec = timeout / 1000;
> -    ts.tv_nsec = (timeout % 1000) * 1000000;
> +    int r;
>
>       sigemptyset(&waitset);
>       sigaddset(&waitset, SIG_IPI);
>       sigaddset(&waitset, SIGBUS);
>
>       do {
> -        qemu_mutex_unlock(&qemu_global_mutex);
> -
>           r = sigtimedwait(&waitset,&siginfo,&ts);
> -        e = errno;
> -
> -        qemu_mutex_lock(&qemu_global_mutex);
> -
> -        if (r == -1&&  !(e == EAGAIN || e == EINTR)) {
> -            fprintf(stderr, "sigtimedwait: %s\n", strerror(e));
> +        if (r == -1&&  !(errno == EAGAIN || errno == EINTR)) {
> +            perror("sigtimedwait");
>               exit(1);
>           }
>
> @@ -657,7 +648,7 @@ static void qemu_kvm_eat_signal(CPUState *env, int timeout)
>
>           r = sigpending(&chkset);
>           if (r == -1) {
> -            fprintf(stderr, "sigpending: %s\n", strerror(e));
> +            perror("sigpending");
>               exit(1);
>           }
>       } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
> @@ -668,7 +659,7 @@ static void qemu_kvm_wait_io_event(CPUState *env)
>       while (!cpu_has_work(env))
>           qemu_cond_timedwait(env->halt_cond,&qemu_global_mutex, 1000);
>
> -    qemu_kvm_eat_signal(env, 0);
> +    qemu_kvm_eat_signals(env);
>       qemu_wait_io_event_common(env);
>   }
>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

  reply	other threads:[~2011-01-10 10:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10  8:31 [Qemu-devel] [PATCH 00/18] [uq/master] MCE & IO exit fixes, prepare for VCPU loop reuse Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 01/18] Revert "kvm: Drop return value of kvm_cpu_exec" Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 02/18] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 03/18] kvm: Provide sigbus services arch-independently Jan Kiszka
2011-01-10 10:13   ` [Qemu-devel] " Paolo Bonzini
2011-01-10 10:30     ` Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 04/18] Refactor signal setup functions in cpus.c Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 05/18] kvm: Set up signal mask also for !CONFIG_IOTHREAD Jan Kiszka
2011-01-10  8:31 ` [Qemu-devel] [PATCH 06/18] kvm: Refactor qemu_kvm_eat_signals Jan Kiszka
2011-01-10 10:15   ` Paolo Bonzini [this message]
2011-01-10  8:32 ` [Qemu-devel] [PATCH 07/18] kvm: Add MCE signal support for !CONFIG_IOTHREAD Jan Kiszka
2011-01-24 11:17   ` [Qemu-devel] " Marcelo Tosatti
2011-01-24 12:36     ` Jan Kiszka
2011-01-26  8:09       ` Jan Kiszka
2011-01-26 12:01         ` Marcelo Tosatti
2011-01-26 12:06           ` Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 08/18] kvm: Handle kvm_init_vcpu errors Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 09/18] Refactor kvm&tcg function names in cpus.c Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 10/18] Fix a few coding style violations " Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 11/18] Introduce VCPU self-signaling service Jan Kiszka
2011-01-24 11:47   ` [Qemu-devel] " Marcelo Tosatti
2011-01-24 12:36     ` Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 12/18] kvm: Move irqchip event processing out of inner loop Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 13/18] kvm: Unconditionally reenter kernel after IO exits Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 14/18] kvm: Remove static return code of kvm_handle_io Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 15/18] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 16/18] kvm: Separate TCG from KVM cpu execution Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 17/18] kvm: x86: Prepare VCPU loop for in-kernel irqchip Jan Kiszka
2011-01-10  8:32 ` [Qemu-devel] [PATCH 18/18] kvm: Drop return values from kvm_arch_pre/post_run Jan Kiszka
2011-01-10 10:10 ` [Qemu-devel] Re: [PATCH 00/18] [uq/master] MCE & IO exit fixes, prepare for VCPU loop reuse Jan Kiszka

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=4D2ADC5B.1050308@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --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).