From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933214AbcBYQAm (ORCPT ); Thu, 25 Feb 2016 11:00:42 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34807 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932596AbcBYQAk (ORCPT ); Thu, 25 Feb 2016 11:00:40 -0500 Date: Thu, 25 Feb 2016 16:00:37 +0000 From: Matt Fleming To: Andy Lutomirski Cc: Sai Praneeth Prakhya , "Ravi V. Shankar" , Toshi Kani , Brian Gerst , Thomas Gleixner , Ingo Molnar , Linus Torvalds , Luis Rodriguez , Andrew Morton , Denys Vlasenko , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , Peter Zijlstra , Borislav Petkov , ricardo.neri@intel.com, Hugh Dickins , Ard Biesheuvel Subject: Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Message-ID: <20160225160037.GB2772@codeblueprint.co.uk> References: <1455712566-16727-4-git-send-email-matt@codeblueprint.co.uk> <1456275002.2781.41.camel@intel.com> <20160224141046.GA2603@codeblueprint.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Feb, at 08:39:56AM, Andy Lutomirski wrote: > > OK, although a comment might be nice. Something like this? --- >>From ac40fc0269d4d8cc9051982c177ee140d6e1b761 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 25 Feb 2016 15:54:50 +0000 Subject: [PATCH] x86/mm/pat: Document the (currently) EFI-only code path It's not at all obvious that populate_pgd() and friends are only executed when mapping EFI virtual memory regions or that no other pageattr callers pass a ->pgd value. Reported-by: Andy Lutomirski Cc: Borislav Petkov Cc: Sai Praneeth Prakhya Cc: Ingo Molnar Cc: Thomas Gleixner Cc: "H. Peter Anvin" Cc: Linus Torvalds Signed-off-by: Matt Fleming --- arch/x86/mm/pageattr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 14c38ae80409..8fee5b6f8f66 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -1125,8 +1125,14 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr) static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr, int primary) { - if (cpa->pgd) + if (cpa->pgd) { + /* + * Right now, we only execute this code path when mapping + * the EFI virtual memory map regions, no other users + * provide a ->pgd value. This may change in the future. + */ return populate_pgd(cpa, vaddr); + } /* * Ignore all non primary paths. -- 2.6.2