From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752327AbdDKXyg (ORCPT ); Tue, 11 Apr 2017 19:54:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34980 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379AbdDKXyd (ORCPT ); Tue, 11 Apr 2017 19:54:33 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21D27EEF0E Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 21D27EEF0E Date: Tue, 11 Apr 2017 19:54:29 -0400 (EDT) From: Paolo Bonzini To: Bandan Das Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, david@redhat.com Message-ID: <317734077.12913155.1491954869446.JavaMail.zimbra@redhat.com> In-Reply-To: References: <1490867732-16743-1-git-send-email-pbonzini@redhat.com> <1490867732-16743-5-git-send-email-pbonzini@redhat.com> Subject: Re: [PATCH 4/6] kvm: nVMX: support EPT accessed/dirty bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.4.164.1, 10.4.195.1] Thread-Topic: nVMX: support EPT accessed/dirty bits Thread-Index: c4cnjpLUB53MPbcJUkHEk/lwDDF3hw== X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 11 Apr 2017 23:54:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > From: "Bandan Das" > To: "Paolo Bonzini" > Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, david@redhat.com > Sent: Wednesday, April 12, 2017 7:35:16 AM > Subject: Re: [PATCH 4/6] kvm: nVMX: support EPT accessed/dirty bits > > Paolo Bonzini writes: > ... > > accessed_dirty = have_ad ? PT_GUEST_ACCESSED_MASK : 0; > > + > > + /* > > + * FIXME: on Intel processors, loads of the PDPTE registers for PAE > > paging > > + * by the MOV to CR instruction are treated as reads and do not cause the > > + * processor to set the dirty flag in tany EPT paging-structure entry. > > + */ > > Minor typo: "in any EPT paging-structure entry". > > > + nested_access = (have_ad ? PFERR_WRITE_MASK : 0) | PFERR_USER_MASK; > > + > > pt_access = pte_access = ACC_ALL; > > ++walker->level; > > > > @@ -338,7 +337,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker > > *walker, > > walker->pte_gpa[walker->level - 1] = pte_gpa; > > > > real_gfn = mmu->translate_gpa(vcpu, gfn_to_gpa(table_gfn), > > - PFERR_USER_MASK|PFERR_WRITE_MASK, > > + nested_access, > > &walker->fault); > > I can't seem to understand the significance of this change (or for that > matter what was before this change). > > mmu->translate_gpa() just returns gfn_to_gpa(table_gfn), right ? For EPT it is, you're right it's fishy. The "nested_access" should be computed in translate_nested_gpa, which is where kvm->arch.nested_mmu (non-EPT) requests to access kvm->arch.mmu (EPT). In practice we need to define a new function vcpu->arch.mmu.gva_to_gpa_nested that computes the nested_access and calls cpu->arch.mmu.gva_to_gpa. Thanks, Paolo