Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2001898ybv; Fri, 21 Feb 2020 07:07:56 -0800 (PST) X-Google-Smtp-Source: APXvYqzhZYGrGUwhxX6UNdLRpqyPlkS8HHdwXTHNzLNdzCUJV3ZxclmzDfZHNMDKf4KBEFFamFxz X-Received: by 2002:a9d:7511:: with SMTP id r17mr27751785otk.154.1582297676120; Fri, 21 Feb 2020 07:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582297676; cv=none; d=google.com; s=arc-20160816; b=o37nnHNQyLfxnkF/O3qGAsetmHyhN/jlrNHCAR7t/sas3B/S4r1zsqmdQntmeHMauX UXpqHFOHJ3M6L6qI7gddNBVUzaQujQhCuPTtS0Erlf0bZgxbMdtXrSQRm927J2Kfq64k P9GC3UNApRaBK27Fu6hNuySywePWBWp2UNElM04ohvBR3VJK05TMEHq1AYdjotdSwKxZ zyXAUojXas02DtRfNSJtgi+YFjJEnpIAxkjCw/EloRYe0QjKEKEXnYH8QpRzIHV2qCrn Wqcl1gwOs2HuR35Bh+s+A6uOP/k3R8Ci5XATx9fbIl+VEwwW8HkRfVlsfgDrKBwQoeQO vUVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nyykEe4zr5qARd9RW0ns4IbQHlFMMKIUvaKWqjWwjfc=; b=vRmxxiIQrN4TsD/g9KWShlTwIuFDTo0P3iA6GVG/Ih3cOcU5XM0zkWZIDo+iPKiptM EBeKVwONuKW9YvT59KrEvp5tglWx9z+taFJMmKRs+PN+R3mn7kcMVi5AnUJgKVE+/lZW z9M1BUep6H1ABE1NRlfULjgdxmpzqP50HE7HTKdcEDYfO1/VVUmh9yX7SJSdDnXrxOmh qvUUaS+95+GXwkeSWShl/QT3Gy7UXxx9HDasSkgbkNiPTr+v8gl6hnxYQ8JeenWT6JWp LGwyIW/5LjorktsbHXwiLDssMaD288nCAIn1zvK+yll7rMnNVvQIVIjMXn3kMdLehK3Z JkHA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si1610248otk.225.2020.02.21.07.07.32; Fri, 21 Feb 2020 07:07:56 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729128AbgBUPFN (ORCPT + 99 others); Fri, 21 Feb 2020 10:05:13 -0500 Received: from mga11.intel.com ([192.55.52.93]:12778 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728910AbgBUPFM (ORCPT ); Fri, 21 Feb 2020 10:05:12 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2020 07:05:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,468,1574150400"; d="scan'208";a="254843543" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by orsmga002.jf.intel.com with ESMTP; 21 Feb 2020 07:05:12 -0800 Date: Fri, 21 Feb 2020 07:05:12 -0800 From: Sean Christopherson To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Paolo Bonzini , Sasha Levin Subject: Re: [PATCH 4.19 009/191] KVM: nVMX: Use correct root level for nested EPT shadow page tables Message-ID: <20200221150512.GB12665@linux.intel.com> References: <20200221072250.732482588@linuxfoundation.org> <20200221072252.173149129@linuxfoundation.org> <20200221102949.GA14608@duo.ucw.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221102949.GA14608@duo.ucw.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2020 at 11:29:49AM +0100, Pavel Machek wrote: > Hi! > > > Hardcode the EPT page-walk level for L2 to be 4 levels, as KVM's MMU > > currently also hardcodes the page walk level for nested EPT to be 4 > > levels. The L2 guest is all but guaranteed to soft hang on its first > > instruction when L1 is using EPT, as KVM will construct 4-level page > > tables and then tell hardware to use 5-level page tables. > > I don't get it. 7/191 reverts the patch, then 9/191 reverts the > revert. Can we simply drop both 7 and 9, for exactly the same result? > > (Patch 8 is a unused file, so it does not change the picture). Patch 07 is reverting this patch from the same unused file, arch/x86/kvm/vmx/vmx.c[*]. The reason patch 07 looks like a normal diff is that a prior patch in 4.19.105 created the unused file (which is what's reverted by patch 08 here). Patch 09 reintroduces the fix for the correct file, arch/x86/kvm/vmx.c. [*] In upstream, vmx.c now lives in arch/x86/kvm/vmx/, but in 4.19 and earlier it lives in arch/x86/kvm/. > > Best regards, > Pavel > > > +++ b/arch/x86/kvm/vmx.c > > @@ -5302,6 +5302,9 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) > > > > static int get_ept_level(struct kvm_vcpu *vcpu) > > { > > + /* Nested EPT currently only supports 4-level walks. */ > > + if (is_guest_mode(vcpu) && nested_cpu_has_ept(get_vmcs12(vcpu))) > > + return 4; > > if (cpu_has_vmx_ept_5levels() && (cpuid_maxphyaddr(vcpu) > 48)) > > return 5; > > return 4; > > -- > > 2.20.1 > > > > > > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html