qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and


From: Lai Jiangshan
Subject: Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation
Date: Mon, 17 Oct 2011 17:40:49 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4

On 10/16/2011 05:39 PM, Avi Kivity wrote:
> On 10/14/2011 11:03 AM, Lai Jiangshan wrote:
>> Currently, NMI interrupt is blindly sent to all the vCPUs when NMI
>> button event happens. This doesn't properly emulate real hardware on
>> which NMI button event triggers LINT1. Because of this, NMI is sent to
>> the processor even when LINT1 is masked in LVT. For example, this
>> causes the problem that kdump initiated by NMI sometimes doesn't work
>> on KVM, because kdump assumes NMI is masked on CPUs other than CPU0.
>>
>> With this patch, we introduce introduce KVM_SET_LINT1,
>> and we can use KVM_SET_LINT1 to correctly emulate NMI button
>> without change the old KVM_NMI behavior.
>>  
>> @@ -759,6 +762,8 @@ struct kvm_clock_data {
>>  #define KVM_CREATE_SPAPR_TCE          _IOW(KVMIO,  0xa8, struct 
>> kvm_create_spapr_tce)
>>  /* Available with KVM_CAP_RMA */
>>  #define KVM_ALLOCATE_RMA      _IOR(KVMIO,  0xa9, struct kvm_allocate_rma)
>> +/* Available with KVM_CAP_SET_LINT1 for x86 */
>> +#define KVM_SET_LINT1                 _IO(KVMIO,   0xaa)
>>  
>>
> 
> LINT1 may have been programmed as a level -triggered interrupt instead
> of edge triggered (NMI or interrupt).  We can use the ioctl argument for
> the level (and pressing the NMI button needs to pulse the level to 1 and
> back to 0).
> 

Hi, Avi, Jan,

Which approach you prefer to?
I need to know the result before wasting too much time to respin
the approach.

1) Fix KVM_NMI emulation approach  (which is v3 patchset)
        - It directly fixes the problem and matches the
          real hard ware more, but it changes KVM_NMI bahavior.
        - Require both kernel-site and userspace-site fix.

2) Get the LAPIC state from kernel irqchip, and inject NMI if it is allowed
   (which is v4 patchset)
        - Simple, don't changes any kernel behavior.
        - Only need the userspace-site fix

3) Add KVM_SET_LINT1 approach (which is v5 patchset)
        - don't changes the kernel's KVM_NMI behavior.
        - much complex
        - Require both kernel-site and userspace-site fix.
        - userspace-site should also handle the !KVM_SET_LINT1
          condition, it uses all the 2) approach' code. it means
          this approach equals the 2) approach + KVM_SET_LINT1 ioctl.

This is an urgent bug of us, we need to settle it down soon.

Thanks,
Lai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]