All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Yang, Sheng" <sheng.yang@intel.com>
Cc: Gleb Natapov <gleb@qumranet.com>, kvm-devel <kvm@vger.kernel.org>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [PATCH 10/11] VMX: work around lacking VNMI support
Date: Tue, 23 Sep 2008 17:15:01 +0200	[thread overview]
Message-ID: <48D907F5.2000401@siemens.com> (raw)
In-Reply-To: <200809231708.09617.sheng.yang@intel.com>

Yang, Sheng wrote:
> On Tuesday 23 September 2008 17:00:21 Gleb Natapov wrote:
>> On Tue, Sep 23, 2008 at 10:57:40AM +0200, Jan Kiszka wrote:
>>> Gleb Natapov wrote:
>>>> On Tue, Sep 23, 2008 at 10:46:38AM +0200, Jan Kiszka wrote:
>>>>> Gleb Natapov wrote:
>>>>>> On Mon, Sep 22, 2008 at 09:59:07AM +0200, Jan Kiszka wrote:
>>>>>>> @@ -2356,6 +2384,19 @@ static void vmx_inject_nmi(struct kvm_vc
>>>>>>>  {
>>>>>>>          struct vcpu_vmx *vmx = to_vmx(vcpu);
>>>>>>>
>>>>>>> +        if (!cpu_has_virtual_nmis()) {
>>>>>>> +                /*
>>>>>>> +                 * Tracking the NMI-blocked state in software is
>>>>>>> built upon +                 * finding the next open IRQ window.
>>>>>>> This, in turn, depends on +                 * well-behaving guests:
>>>>>>> They have to keep IRQs disabled at +                 * least as long
>>>>>>> as the NMI handler runs. Otherwise we may +                 * cause
>>>>>>> NMI nesting, maybe breaking the guest. But as this is +             
>>>>>>>    * highly unlikely, we can live with the residual risk. +         
>>>>>>>        */
>>>>>>> +                vmx->soft_vnmi_blocked = 1;
>>>>>>> +                vmx->vnmi_blocked_time = 0;
>>>>>>> +        }
>>>>>>> +
>>>>>> We still get here with vmx->soft_vnmi_blocked = 1. Trying to find out
>>>>>> how.
>>>>> We should only come along here with vnmi blocked on reinjection (after
>>>>> a fault on calling the handler).
>>>> I see that nmi_injected is never cleared and it is check before calling
>>>> vmx_inject_nmi();
>>> That should happen in vmx_complete_interrupts, but only if the exit
>>> takes place after the NMI has been successfully delivered to the guest
>>> (which is not the case if invoking the handler raises an exception). So
>>> far for the theory...
>> Okey, I have this one in dmesg:
>> kvm_handle_exit: unexpected, valid vectoring info and exit reason is 0x9
>>
> Oh... Another task switch issue...

Maybe that pending vector is #2, the NMI that is supposed to trigger the
task switch?

> 
> I think it's may not be a issue import by this patchset? Seems need more 
> debug... 
> 
> The patchset is OK for me, except I don't know when we would need that timeout 
> one (buggy guest?...), and we may also root cause this issue or ensure that 
> it's not a regression.

The timeout is indeed for buggy guests:

disable_irqs();
spin_endlessly();

Linux, e.g., needs more than one watchdog NMI over this code to detect
that there is a lock-up. With soft-VNMIs + their timeouts, this
detection will take longer then in reality, but it will still work. And
one second is large enough to practically avoid breaking into a running
NMI handler (unless the guest is totally screwed and spins inside that
handler).

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2008-09-23 15:15 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  7:44 [PATCH 0/11] Fix&Enhance NMI support for KVM - v3 Jan Kiszka
2008-09-22  7:58 ` [PATCH 1/11] VMX: include all IRQ window exits in statistics Jan Kiszka
2008-09-22  7:58 ` [PATCH 2/11] VMX: refactor/fix IRQ and NMI injectability determination Jan Kiszka
2008-09-22  7:58 ` [PATCH 3/11] VMX: refactor IRQ and NMI window enabling Jan Kiszka
2008-09-22  7:58 ` [PATCH 5/11] kvm-x86: Enable NMI Watchdog via in-kernel PIT source Jan Kiszka
2008-09-22  7:58 ` [PATCH 6/11] kvm-x86: VCPU with pending NMI is runnabled Jan Kiszka
2008-09-22  7:58 ` [PATCH 7/11] kvm: kick NMI receiving VCPU Jan Kiszka
2008-09-22  7:58 ` [PATCH 8/11] kvm-x86: Support for user space injected NMIs Jan Kiszka
2008-09-22  7:59 ` [PATCH 9/11] VMX: Provide support " Jan Kiszka
2008-09-23  6:28   ` Yang, Sheng
2008-09-23 15:42     ` Jan Kiszka
2008-09-22  7:59 ` [PATCH 10/11] VMX: work around lacking VNMI support Jan Kiszka
2008-09-22 14:15   ` Gleb Natapov
2008-09-23  8:46     ` Jan Kiszka
2008-09-23  8:50       ` Gleb Natapov
2008-09-23  8:57         ` Jan Kiszka
2008-09-23  9:00           ` Gleb Natapov
2008-09-23  9:08             ` Yang, Sheng
2008-09-23  9:15               ` Gleb Natapov
2008-09-23  9:24                 ` Yang, Sheng
2008-09-23  9:26                   ` Gleb Natapov
2008-09-23  9:37                     ` Yang, Sheng
2008-09-23  9:42                       ` Yang, Sheng
2008-09-23  9:45                         ` Gleb Natapov
2008-09-23  9:50                           ` Yang, Sheng
2008-09-24 12:40                             ` Jan Kiszka
2008-09-24 12:44                               ` Avi Kivity
2008-09-24 12:50                               ` Gleb Natapov
2008-09-24 12:56                                 ` Jan Kiszka
2008-09-24 13:02                                   ` Gleb Natapov
2008-09-24 13:08                                     ` Jan Kiszka
2008-09-24 13:24                                       ` Gleb Natapov
2008-09-24 13:33                                         ` Jan Kiszka
2008-09-24 13:35                                           ` Gleb Natapov
2008-09-24 13:35                                           ` Avi Kivity
2008-09-24 14:07                                         ` Jan Kiszka
2008-09-24 14:19                                           ` Avi Kivity
2008-09-24 13:11                                     ` Jan Kiszka
2008-09-24 13:17                                       ` Gleb Natapov
2008-09-24 13:20                                         ` Gleb Natapov
2008-09-24 13:39                                           ` Jan Kiszka
2008-09-24 14:48                                     ` Gleb Natapov
2008-09-23  9:27                 ` Yang, Sheng
2008-09-23 15:15               ` Jan Kiszka [this message]
2008-09-25  9:41   ` Jan Kiszka
2008-09-25 10:31     ` Avi Kivity
2008-09-25 14:22       ` Jan Kiszka
2008-09-27 10:57         ` Avi Kivity
2008-09-22  7:59 ` [PATCH 11/11] kvm: Enable NMI support for userspace irqchip Jan Kiszka
2008-09-22  8:00 ` [PATCH 4/11] VMX: fix real-mode NMI support 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=48D907F5.2000401@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=gleb@qumranet.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng.yang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.