From: Paolo Bonzini Subject: Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Date: Tue, 28 Jun 2016 22:17:54 +0200 Message-ID: References: <1467088360-10186-1-git-send-email-bsd@redhat.com> <1467088360-10186-2-git-send-email-bsd@redhat.com> <55601232-c941-74e8-f740-fd09e9e8a6ae@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, guangrong.xiao@linux.intel.com, linux-kernel@vger.kernel.org To: Bandan Das Return-path: Received: from mail-wm0-f41.google.com ([74.125.82.41]:37668 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcF1USM (ORCPT ); Tue, 28 Jun 2016 16:18:12 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 28/06/2016 19:33, Bandan Das wrote: >>> >> static int is_shadow_present_pte(u64 pte) >>> >> { >>> >> - return pte & PT_PRESENT_MASK && !is_mmio_spte(pte); >>> >> + return pte & (PT_PRESENT_MASK | shadow_x_mask) && >>> >> + !is_mmio_spte(pte); >> > >> > This should really be pte & 7 when using EPT. But this is okay as an >> > alternative to a new shadow_present_mask. > I could revive shadow_xonly_valid probably... Anyway, for now I will > add a TODO comment here. It's okay to it like this, because the only invalid PTEs reaching this point are those that is_mmio_spte filters away. Hence you'll never get -W- PTEs here, and pte & 7 is really the same as how you wrote it. It's pretty clever, and doesn't need a TODO at all. :) Paolo