From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v2 4/4] KVM: x86: Add VCPU substate for NMI states Date: Mon, 19 Oct 2009 18:32:54 -0200 Message-ID: <20091019203254.GD17781@amt.cnet> References: <20091015170535.5076.91206.stgit@mchn012c.ww002.siemens.net> <20091015170536.5076.56790.stgit@mchn012c.ww002.siemens.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:23116 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753274AbZJSUc6 (ORCPT ); Mon, 19 Oct 2009 16:32:58 -0400 Content-Disposition: inline In-Reply-To: <20091015170536.5076.56790.stgit@mchn012c.ww002.siemens.net> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Oct 15, 2009 at 07:05:36PM +0200, 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. > > Signed-off-by: Jan Kiszka > --- > > Documentation/kvm/api.txt | 12 ++++++++++++ > arch/x86/include/asm/kvm.h | 7 +++++++ > arch/x86/include/asm/kvm_host.h | 2 ++ > arch/x86/kvm/svm.c | 22 ++++++++++++++++++++++ > arch/x86/kvm/vmx.c | 30 ++++++++++++++++++++++++++++++ > arch/x86/kvm/x86.c | 26 ++++++++++++++++++++++++++ > 6 files changed, 99 insertions(+), 0 deletions(-) > > diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt > index bee5bbd..e483edb 100644 > --- a/Documentation/kvm/api.txt > +++ b/Documentation/kvm/api.txt > @@ -848,3 +848,15 @@ Deprecates: KVM_GET/SET_CPUID2 > Architectures: x86 > Payload: struct kvm_lapic > Deprecates: KVM_GET/SET_LAPIC > + > +6.8 KVM_X86_VCPU_STATE_NMI > + > +Architectures: x86 > +Payload: struct kvm_nmi_state > +Deprecates: - > + > +struct kvm_nmi_state { > + __u8 pending; > + __u8 masked; > + __u8 pad1[6]; Don't you also have to save "nmi_injected", in case of failure during NMI delivery. BTW, what happens to exceptions that fail to be delivered? Can't see where they are saved/restored across migration.