Received: by 10.223.176.5 with SMTP id f5csp1643785wra; Wed, 31 Jan 2018 09:21:15 -0800 (PST) X-Google-Smtp-Source: AH8x226k6IOP08ha4RUYup+VU2vjj0omn/TUjQJJjeHWT8NEuq4aaaVcy+hJ2j9HuF2SCH6ZvCE0 X-Received: by 10.99.120.66 with SMTP id t63mr26885036pgc.375.1517419275335; Wed, 31 Jan 2018 09:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517419275; cv=none; d=google.com; s=arc-20160816; b=RqebgRtOJaUBed3ETk3Y1YCwPLNDhOd6b3IpMd+VJrA4WT1zvp2ACI/Edtc1NH0/Yk dqXGF0e0tQ6VhFvEXVPeqonMIMYIFFrT7n12gWYIGoOvazqNZRK1jl4BfYmy0JuSu3Bu hticL1MYbd1p1VlSZ+gZph8+rqipA8I5XcJqrAD9s1D0vQ9xwWBcdwOjTiJYL2Ypj7YY v+f15G9T6K9AKNSCSS+BW1qaZQ6WoPuMpA/Pd5Dl+7MSsl9tTDb7susQRPP2ex0Woo9N ZplHrcDOIbxCwpRaduMwzT24AsdanmQ5DgahKSVWa7e1MLBC3X6FuN2FZ7E7ZZhDeb8L O+mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=t1ub42nsM3G6A5Xh+wpeCpy7o3qvQ2uVaiWXdj/BUwY=; b=SLRxxcWLfjYYKrLYWRNkDo0lbjYHCnKv1sBJKQRPduvf+F6Ga0EtfGUymPtF4Db6Xm Xg+7L8WjDxOVN/1ar0pvk4pcEJBWG9Sh1g2zhREWn9nUualt9jxs+hn04qkDea9Stqp9 rvgeqFw9GhCJDSQlN6Hy6swlxTz1fCoPGvIIVZzgzKs1oGZ3I68yyNjaOmENpYi0H6dk mxRZ2H1lffBc5Cmue0ApyUzEb0sfV1a0sZ5MI/+TohK2shAubvZKcW9JIdI6NqvfFxhN iCPR5SqkxEAJTO5k82LJsQUabu+0hxZJFvWrFoH17iOQ3J8r33JRSzfJqMn3eadlmRFA aEIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si2576063pfl.262.2018.01.31.09.21.00; Wed, 31 Jan 2018 09:21:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753133AbeAaRRS (ORCPT + 99 others); Wed, 31 Jan 2018 12:17:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48584 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbeAaRRR (ORCPT ); Wed, 31 Jan 2018 12:17:17 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81423883C2; Wed, 31 Jan 2018 17:17:17 +0000 (UTC) Received: from [10.36.116.69] (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03DE860621; Wed, 31 Jan 2018 17:17:15 +0000 (UTC) Subject: Re: [PATCH] KVM: nVMX: preserve SECONDARY_EXEC_DESC without UMIP To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20180131171250.29568-1-rkrcmar@redhat.com> From: Paolo Bonzini Message-ID: <9a4039a3-9352-15f7-1917-0bef13e2f085@redhat.com> Date: Wed, 31 Jan 2018 12:17:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180131171250.29568-1-rkrcmar@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 31 Jan 2018 17:17:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/01/2018 12:12, Radim Krčmář wrote: > L1 might want to use SECONDARY_EXEC_DESC, so we must not clear the VMCS > bit if UMIP is not being emulated. > > We must still set the bit when emulating UMIP as the feature can be > passed to L2 where L0 will do the emulation and because L2 can change > CR4 without a VM exit, we should clear the bit if UMIP is disabled. > > Fixes: 0367f205a3b7 ("KVM: vmx: add support for emulating UMIP") > Signed-off-by: Radim Krčmář > --- > I haven't tested emulated UMIP (yet) nor machines with UMIP, but at > least kvm-unit-tests don't throw an error anymore. > > arch/x86/kvm/vmx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 438802d0b01d..b1e554a74b34 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4379,7 +4379,8 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) > vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL, > SECONDARY_EXEC_DESC); > hw_cr4 &= ~X86_CR4_UMIP; > - } else > + } else if (!is_guest_mode(vcpu) || > + !nested_cpu_has2(get_vmcs12(vcpu), SECONDARY_EXEC_DESC)) > vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, > SECONDARY_EXEC_DESC); > > Reviewed-by: Paolo Bonzini