From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751463AbcGNOuT (ORCPT ); Thu, 14 Jul 2016 10:50:19 -0400 Received: from smtp.citrix.com ([66.165.176.89]:44363 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051AbcGNOuP (ORCPT ); Thu, 14 Jul 2016 10:50:15 -0400 X-IronPort-AV: E=Sophos;i="5.28,363,1464652800"; d="scan'208";a="366245581" Subject: Re: [PATCH 4/4] x86: use pte_none() to test for empty PTE To: Dave Hansen , Vlastimil Babka , Dave Hansen , References: <20160708001909.FB2443E2@viggo.jf.intel.com> <20160708001915.813703D9@viggo.jf.intel.com> <71d7b63a-45dd-c72d-a277-03124b0053ae@suse.cz> <5787A0A2.4070406@intel.com> CC: , , , , , , , , Boris Ostrovsky , Juergen Gross From: David Vrabel X-Enigmail-Draft-Status: N1110 Message-ID: <5787A6A2.3000807@citrix.com> Date: Thu, 14 Jul 2016 15:50:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <5787A0A2.4070406@intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/07/16 15:24, Dave Hansen wrote: > On 07/14/2016 06:47 AM, Vlastimil Babka wrote: >> So, this might be just because I know next to nothing about (para)virt, >> but... >> >> in arch/x86/include/asm/paravirt.h, pte_val is implemented via some >> pvops, which suggests that obtaining a pte value is different than just >> reading it from memory. But I don't see pte_none() defined to be using >> this on paravirt, and it shares (before patch 2/4) the "return !pte.pte" >> implementation, AFAICS? >> >> So that itself is suspicious to me. And now that this patches does >> things like this: >> >> - if (pte_val(*pte)) { >> + if (!pte_none(*pte)) { >> >> So previously on paravirt these tests would read pte via the pvops, and >> now they won't. Is that OK? > > I've cc'd a few Xen guys. I think they're the only ones that would care. > > But, as far as I can tell, the Xen pte_val() will take a _PAGE_PRESENT > PTE and muck with it. But its answer will never differ for an all 0 PTE > from !pte_none() because that PTE does not have _PAGE_PRESENT set. > > It does seem fragile that Xen is doing it this way, but I guess it works. Xen PV guests never plays games with non-present PTEs so, for the series, wrt Xen: Acked-by: David Vrabel FWIW, present PTEs have a hardware-specified meaning where-as non-present PTEs do not, so I'm not sure I'd view Xen PV guests making this distinct as "fragile". David