From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v2 5/8] KVM: nVMX: Fix guest CR3 read-back on VM-exit Date: Tue, 6 Aug 2013 14:44:01 +0300 Message-ID: <20130806114401.GV8218@redhat.com> References: <0816baee846f9c8f4d54c6738b2582a95f9c56a3.1375778397.git.jan.kiszka@web.de> <20130806101236.GN8218@redhat.com> <5200CF33.3000307@web.de> <20130806103103.GQ8218@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , kvm , Xiao Guangrong , Jun Nakajima , Yang Zhang , Arthur Chunqi Li To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:64156 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755812Ab3HFLoJ (ORCPT ); Tue, 6 Aug 2013 07:44:09 -0400 Content-Disposition: inline In-Reply-To: <20130806103103.GQ8218@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 06, 2013 at 01:31:03PM +0300, Gleb Natapov wrote: > On Tue, Aug 06, 2013 at 12:25:55PM +0200, Jan Kiszka wrote: > > On 2013-08-06 12:12, Gleb Natapov wrote: > > > On Tue, Aug 06, 2013 at 10:39:59AM +0200, Jan Kiszka wrote: > > >> From: Jan Kiszka > > >> > > >> If nested EPT is enabled, the L2 guest may change CR3 without any exits. > > >> We therefore have to read the current value from the VMCS when switching > > >> to L1. However, if paging wasn't enabled, L0 tracks L2's CR3, and > > >> GUEST_CR3 rather contains the real-mode identity map. So we need to > > >> retrieve CR3 from the architectural state after conditionally updating > > >> it - and this is what kvm_read_cr3 does. > > >> > > > I have a headache from trying to think about it already, but shouldn't > > > L1 be the one who setups identity map for L2? I traced what > > > vmcs_read64(GUEST_CR3)/kvm_read_cr3(vcpu) return here and do not see > > > different values in real mode. > > > > Did you try with my patches applied and unrestricted guest mode in use? > > > No, for that I need to setup nested environment on the machine that > support unrestricted guest first :) > Did that. I see unrestricted guest is enabled in L1, but still do not see different values. -- Gleb.