From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v2 4/4] KVM: x86: Add VCPU substate for NMI states Date: Mon, 19 Oct 2009 22:39:50 +0200 Message-ID: <20091019203950.GC8278@redhat.com> References: <20091015170535.5076.91206.stgit@mchn012c.ww002.siemens.net> <20091015170536.5076.56790.stgit@mchn012c.ww002.siemens.net> <20091019203254.GD17781@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kiszka , Avi Kivity , kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42167 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbZJSUju (ORCPT ); Mon, 19 Oct 2009 16:39:50 -0400 Content-Disposition: inline In-Reply-To: <20091019203254.GD17781@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Oct 19, 2009 at 06:32:54PM -0200, Marcelo Tosatti wrote: > 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. > The instruction that caused an exception will be re-executed after migration and exception will be regenerated. But I think we should migrate exception anyway for completeness. -- Gleb.