From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 4/4] KVM: x86: Add VCPU substate for NMI states Date: Thu, 15 Oct 2009 11:22:41 +0200 Message-ID: <4AD6E9E1.1040704@siemens.com> References: <20091013160647.27006.58598.stgit@mchn012c.ww002.siemens.net> <20091013160648.27006.29041.stgit@mchn012c.ww002.siemens.net> <4AD6D8B6.3050003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from thoth.sbs.de ([192.35.17.2]:19442 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762575AbZJOJXb (ORCPT ); Thu, 15 Oct 2009 05:23:31 -0400 In-Reply-To: <4AD6D8B6.3050003@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > 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. OK. >> @@ -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. OK. > > Needs a KVM_CAP as well. KVM_CAP_VCPU_STATE will imply KVM_CAP_NMI_STATE, so I skipped the latter (user space code would use the former anyway to avoid yet another #ifdef layer). Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux