public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [patch 3/4] QEMU/KVM: ignore SIG_IPI signals in	userspace
Date: Tue, 08 Apr 2008 04:17:13 +0300	[thread overview]
Message-ID: <47FAC799.4010601@qumranet.com> (raw)
In-Reply-To: <20080407202624.GA4254@dmt>

Marcelo Tosatti wrote:
> On Sun, Apr 06, 2008 at 12:15:07PM +0300, Avi Kivity wrote:
>   
>> Marcelo Tosatti wrote:
>>     
>>> Otherwise a signal can be received in userspace and a vcpu goes back
>>> to the kernel while it should stay still.
>>>
>>> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>>>
>>> Index: kvm-userspace.io/qemu/qemu-kvm.c
>>> ===================================================================
>>> --- kvm-userspace.io.orig/qemu/qemu-kvm.c
>>> +++ kvm-userspace.io/qemu/qemu-kvm.c
>>> @@ -350,7 +350,6 @@ static void *ap_main_loop(void *_env)
>>>     vcpu->env = env;
>>>     vcpu->env->thread_id = kvm_get_thread_id();
>>>     sigfillset(&signals);
>>> -    sigdelset(&signals, SIG_IPI);
>>>     sigprocmask(SIG_BLOCK, &signals, NULL);
>>>     kvm_create_vcpu(kvm_context, env->cpu_index);
>>>     kvm_qemu_init_env(env);
>>>
>>>  
>>>       
>> Does this work with -no-kvm-irqchip?
>>     
>
> Yes. SIG_IPI was blocked before the IO thread.
>
>   

Okay (of course; it is blocked, but still dequeued by sigtimedwait).

>> I think we need to fix the kernel to handle random signals.  Otherwise 
>> even attaching a debugger can change guest behavior (I think).
>>     
>
> Well ptrace forces signals so SIGSTOP is delivered even though the child
> has blocked them.
>
> Attaching a debugger does change behaviour since SIGSTOP will send a
> vcpu back to userspace.
>
> Can you be more specific?
>
>   

I misunderstood. I thought something about a spurious signal being 
received in the kernel, dropping it out of hlt state, and confusing the 
guest; but the real issue is the signal getting lost completely if it is 
delivered to userspace instead of sigtimedwait(), which this patch fixes.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  reply	other threads:[~2008-04-08  1:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 18:22 [patch 0/4] fix SMP migration and savevm/loadvm Marcelo Tosatti
2008-04-05 18:22 ` [patch 1/4] QEMU/KVM: only use KVM apic registers if vm is running Marcelo Tosatti
2008-04-06  9:09   ` Avi Kivity
2008-04-05 18:22 ` [patch 2/4] QEMU/KVM: save and load mp state Marcelo Tosatti
2008-04-06  9:13   ` Avi Kivity
2008-04-05 18:22 ` [patch 3/4] QEMU/KVM: ignore SIG_IPI signals in userspace Marcelo Tosatti
2008-04-06  9:15   ` Avi Kivity
2008-04-07 20:26     ` Marcelo Tosatti
2008-04-08  1:17       ` Avi Kivity [this message]
2008-04-05 18:22 ` [patch 4/4] QEMU/KVM: dont read any bits from userspace APIC emulation if its done in-kernel Marcelo Tosatti
2008-04-06  9:18   ` Avi Kivity
2008-04-07 17:35     ` 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=47FAC799.4010601@qumranet.com \
    --to=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=mtosatti@redhat.com \
    /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