From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kai Huang Subject: Re: [PATCH 01/10] VMX: Enable EPT A/D bit support Date: Fri, 10 Apr 2015 14:40:58 +0800 Message-ID: <5527707A.9070906@linux.intel.com> References: <1427423754-11841-1-git-send-email-kai.huang@linux.intel.com> <1427423754-11841-2-git-send-email-kai.huang@linux.intel.com> <20150409112125.GE17031@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150409112125.GE17031@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: yang.z.zhang@intel.com, andrew.cooper3@citrix.com, kevin.tian@intel.com, jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 04/09/2015 07:21 PM, Tim Deegan wrote: > At 10:35 +0800 on 27 Mar (1427452545), Kai Huang wrote: >> @@ -233,6 +233,9 @@ static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry, >> if ( !ept_set_middle_entry(p2m, &new_ept) ) >> return 0; >> >> + /* It's better to copy A bit of Middle entry from original entry */ >> + new_ept.a = ept_entry->a; > Shouldn't this A bit always be set to 1? After all we're not using it > for anything, and it doesn't mean the same thing as the A bit in the > superpage entry did. This is the statement in Intel's SDM: "Whenever the processor uses an EPT paging-structure entry as part of guest-physical-address translation, it sets the accessed flag in that entry (if it is not already set)". In my understanding, once the guest-physical-address is used by processor, all EPT entries used for that translation will have their A bits set, from top level entry to leaf entry, therefore A bits of EPT entries for one translation should be consistent, in which case looks it's reasonable to inherit A bit from superpage's leaf entry to middle entry of new shattered 4K pages. Do I have misunderstanding on this? But this is really not an important issue, and we can safely set A bit of middle entry to 1. It is Yang's idea that it's better to inherit it. Yang, would you comment here? > > In fact, thinking about that, we should probably be setting _all_ the > A bits to 1, even in leaf entries, to avoid the overhead of the MMU > having to write them later. I suppose you mean A bits of leaf entries of new shattered 4K pages? Yes we can, but looks it's more reasonable to inherit according to original A bit of super page. But as I said, I don't think A bit matters a lot, so I am OK with both. Maybe others can provide some comments here? Thanks, -Kai > > Cheers, > > Tim.