From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/4] KVM: x86: Add VCPU substate for NMI states Date: Thu, 15 Oct 2009 17:09:26 +0900 Message-ID: <4AD6D8B6.3050003@redhat.com> References: <20091013160647.27006.58598.stgit@mchn012c.ww002.siemens.net> <20091013160648.27006.29041.stgit@mchn012c.ww002.siemens.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46234 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755286AbZJOIJ4 (ORCPT ); Thu, 15 Oct 2009 04:09:56 -0400 In-Reply-To: <20091013160648.27006.29041.stgit@mchn012c.ww002.siemens.net> Sender: kvm-owner@vger.kernel.org List-ID: On 10/14/2009 01:06 AM, Jan Kiszka wrote: > This plugs an NMI-related hole in the VCPU synchronization between > kernel and user space. So far, neither pending NMIs nor the inhibit NMI > mask was properly read/set which was able to cause problems on > vmsave/restore, live migration and system reset. Fix it by making use > of the new VCPU substate interface. > > > +struct kvm_nmi_state { > + __u8 pending; > + __u8 masked; > + __u8 pad1[2]; > +}; > Best to be conservative and use 64-bit alignment. Who knows what we might put after this someday. > @@ -513,6 +513,8 @@ struct kvm_x86_ops { > unsigned char *hypercall_addr); > void (*set_irq)(struct kvm_vcpu *vcpu); > void (*set_nmi)(struct kvm_vcpu *vcpu); > + int (*get_nmi_mask)(struct kvm_vcpu *vcpu); > + void (*set_nmi_mask)(struct kvm_vcpu *vcpu, int masked); > Prefer bool for booleans, please. Needs a KVM_CAP as well. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.