From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovH0wjw/JJT4zhR+z5F9OscmDmyG14G0/IhspCxmeoS26ClHHCLojkOr26Nfbu9SK5NEViL ARC-Seal: i=1; a=rsa-sha256; t=1516232616; cv=none; d=google.com; s=arc-20160816; b=SOAOJYLf1cL4i2xXeyvwN9de9YCw0op45JjGQsE8H8f9MDv1SND77lFeZh9LDvB+wb 7UdyTGHwpwUIDfLF9vVAx0KNpoaNgZHKO7az5ipfVMRxFazRMgWA6ZU6s83QzKLfTce0 bYA5rTcJOdeZCJLv6O1lNwue4D8sW4P7H+JWG2biKyQF0NcqfibhrSEcpk7Yol/TtK3C 7fKDtQq3ObBJI1Eto9p+oMpfuo17TTu6aDk6hmVwX2ohm5QfOoduFu/Io9rmDBH7KjWP xtHYBS9caOW0TbkNToPIm0KAI7ggTPbf1PzGVrOqHASYy6QIXRFcRo4NPDVGjQEHhacb 9cUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dmarc-filter:arc-authentication-results; bh=WDsJtGKpjTWfgGqwJlIXFOmu5jIXo4+f2t9jMll8Q7Y=; b=PMJIgnLtYNX4rtBb4grrUQU34jn6zk0kZ+U3oso2n8It34ONh5BITeIlF5p81aRLfV dHBRUfpDihO+1/hhqx5t31gptL0RG6DEZ8p8qwFvnx6n8RpRRrxAd+VWBsyvMfMlk9lo PRO2uf5iWNsflJelGEvKk/FcNVaIgQIKPbKOedrhNsQmzGDEXkh2aTUP5sfdQEhwOLVC fVc1OaiY8+DK2Nqae/57322lX2NRos685xybA+fNdl0sooXVV7q/3R+Ud3g/0WMEYW5f YEbP+Z6phY+ivxyBrfC7aQwiRPKiMTF9td+J+ofBylC0KA18rx0dwuAVM3Mg7Dxbbq94 dLcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of luto@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=luto@kernel.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of luto@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=luto@kernel.org DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B21552176E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org MIME-Version: 1.0 In-Reply-To: <1516120619-1159-9-git-send-email-joro@8bytes.org> References: <1516120619-1159-1-git-send-email-joro@8bytes.org> <1516120619-1159-9-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Wed, 17 Jan 2018 15:43:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/16] x86/pgtable/32: Allocate 8k page-tables when PTI is enabled To: Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Joerg Roedel Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589767842947222657?= X-GMAIL-MSGID: =?utf-8?q?1589885131609873982?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Tue, Jan 16, 2018 at 8:36 AM, Joerg Roedel wrote: > From: Joerg Roedel > > Allocate a kernel and a user page-table root when PTI is > enabled. Also allocate a full page per root for PAEm because > otherwise the bit to flip in cr3 to switch between them > would be non-constant, which creates a lot of hassle. > Keep that for a later optimization. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kernel/head_32.S | 23 ++++++++++++++++++----- > arch/x86/mm/pgtable.c | 11 ++++++----- > 2 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S > index c29020907886..fc550559bf58 100644 > --- a/arch/x86/kernel/head_32.S > +++ b/arch/x86/kernel/head_32.S > @@ -512,28 +512,41 @@ ENTRY(initial_code) > ENTRY(setup_once_ref) > .long setup_once > > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > +#define PGD_ALIGN (2 * PAGE_SIZE) > +#define PTI_USER_PGD_FILL 1024 > +#else > +#define PGD_ALIGN (PAGE_SIZE) > +#define PTI_USER_PGD_FILL 0 > +#endif > /* > * BSS section > */ > __PAGE_ALIGNED_BSS > - .align PAGE_SIZE > + .align PGD_ALIGN > #ifdef CONFIG_X86_PAE > .globl initial_pg_pmd > initial_pg_pmd: > .fill 1024*KPMDS,4,0 > + .fill PTI_USER_PGD_FILL,4,0 Couldn't this be simplified to just .align PGD_ALIGN, 0 without the .fill? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id 9B4AA6B0268 for ; Wed, 17 Jan 2018 18:43:36 -0500 (EST) Received: by mail-pf0-f198.google.com with SMTP id e26so15523482pfi.15 for ; Wed, 17 Jan 2018 15:43:36 -0800 (PST) Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id d9si5381198plj.186.2018.01.17.15.43.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 15:43:35 -0800 (PST) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B1222179F for ; Wed, 17 Jan 2018 23:43:35 +0000 (UTC) Received: by mail-it0-f43.google.com with SMTP id c16so11317940itc.5 for ; Wed, 17 Jan 2018 15:43:35 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1516120619-1159-9-git-send-email-joro@8bytes.org> References: <1516120619-1159-1-git-send-email-joro@8bytes.org> <1516120619-1159-9-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Wed, 17 Jan 2018 15:43:14 -0800 Message-ID: Subject: Re: [PATCH 08/16] x86/pgtable/32: Allocate 8k page-tables when PTI is enabled Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Joerg Roedel On Tue, Jan 16, 2018 at 8:36 AM, Joerg Roedel wrote: > From: Joerg Roedel > > Allocate a kernel and a user page-table root when PTI is > enabled. Also allocate a full page per root for PAEm because > otherwise the bit to flip in cr3 to switch between them > would be non-constant, which creates a lot of hassle. > Keep that for a later optimization. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kernel/head_32.S | 23 ++++++++++++++++++----- > arch/x86/mm/pgtable.c | 11 ++++++----- > 2 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S > index c29020907886..fc550559bf58 100644 > --- a/arch/x86/kernel/head_32.S > +++ b/arch/x86/kernel/head_32.S > @@ -512,28 +512,41 @@ ENTRY(initial_code) > ENTRY(setup_once_ref) > .long setup_once > > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > +#define PGD_ALIGN (2 * PAGE_SIZE) > +#define PTI_USER_PGD_FILL 1024 > +#else > +#define PGD_ALIGN (PAGE_SIZE) > +#define PTI_USER_PGD_FILL 0 > +#endif > /* > * BSS section > */ > __PAGE_ALIGNED_BSS > - .align PAGE_SIZE > + .align PGD_ALIGN > #ifdef CONFIG_X86_PAE > .globl initial_pg_pmd > initial_pg_pmd: > .fill 1024*KPMDS,4,0 > + .fill PTI_USER_PGD_FILL,4,0 Couldn't this be simplified to just .align PGD_ALIGN, 0 without the .fill? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org