qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Frediano Ziglio <freddy77@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Odd code in cpus.c
Date: Fri, 29 Jul 2011 10:49:01 +0200	[thread overview]
Message-ID: <4E3273FD.1020007@siemens.com> (raw)
In-Reply-To: <CAHt6W4dzm9aY7AMa9DbBLAOL6opAkuXNv9zRx7xNj24oMKr=hA@mail.gmail.com>

On 2011-07-29 10:34, Frediano Ziglio wrote:
> I  don't know that much this code however qemu_kvm_init_cpu_signals
> seems a bit strange and duplicate to me, in cpus.c
> 
> 
> static void qemu_kvm_init_cpu_signals(CPUState *env)
> {
>     int r;
>     sigset_t set;
>     struct sigaction sigact;
> 
>     memset(&sigact, 0, sizeof(sigact));
>     sigact.sa_handler = dummy_signal;
>     sigaction(SIG_IPI, &sigact, NULL);
> 
> #ifdef CONFIG_IOTHREAD
>     pthread_sigmask(SIG_BLOCK, NULL, &set);
>     sigdelset(&set, SIG_IPI);
>     sigdelset(&set, SIGBUS);
>     r = kvm_set_signal_mask(env, &set);
>     if (r) {
>         fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
>         exit(1);
>     }
> #else
>     sigemptyset(&set);
>     sigaddset(&set, SIG_IPI);
>     sigaddset(&set, SIGIO);
>     sigaddset(&set, SIGALRM);
>     pthread_sigmask(SIG_BLOCK, &set, NULL);
> 
>     pthread_sigmask(SIG_BLOCK, NULL, &set);
>     sigdelset(&set, SIGIO);
>     sigdelset(&set, SIGALRM);
> #endif
>     sigdelset(&set, SIG_IPI);
>     sigdelset(&set, SIGBUS);
>     r = kvm_set_signal_mask(env, &set);
>     if (r) {
>         fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
>         exit(1);
>     }
> }
> 
> 
> if CONFIG_IOTHREAD is set you get
> 
> 
> static void qemu_kvm_init_cpu_signals(CPUState *env)
> {
>     int r;
>     sigset_t set;
>     struct sigaction sigact;
> 
>     memset(&sigact, 0, sizeof(sigact));
>     sigact.sa_handler = dummy_signal;
>     sigaction(SIG_IPI, &sigact, NULL);
> 
>     pthread_sigmask(SIG_BLOCK, NULL, &set);
>     sigdelset(&set, SIG_IPI);
>     sigdelset(&set, SIGBUS);
>     r = kvm_set_signal_mask(env, &set);
>     if (r) {
>         fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
>         exit(1);
>     }
>     sigdelset(&set, SIG_IPI);
>     sigdelset(&set, SIGBUS);
>     r = kvm_set_signal_mask(env, &set);
>     if (r) {
>         fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
>         exit(1);
>     }
> }
> 
> 
> which seems to set kvm signal twice with same values (taking into
> account that in kvm_set_signal_mask the set is copied before the call
> to kvm_vcpu_ioctl).

Indeed. Harmless fortunately. I suspect the duplicate bits in the #ifdef
CONFIG_IOTHREAD block were simply forgotten. Paolo?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2011-07-29  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  8:34 [Qemu-devel] Odd code in cpus.c Frediano Ziglio
2011-07-29  8:49 ` Jan Kiszka [this message]
2011-07-29  8:51   ` Paolo Bonzini

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=4E3273FD.1020007@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=freddy77@gmail.com \
    --cc=pbonzini@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).