From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751867AbdKZRmB (ORCPT ); Sun, 26 Nov 2017 12:42:01 -0500 Received: from mail.skyhub.de ([5.9.137.197]:53790 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbdKZRl6 (ORCPT ); Sun, 26 Nov 2017 12:41:58 -0500 Date: Sun, 26 Nov 2017 18:41:49 +0100 From: Borislav Petkov To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Thomas Gleixner , "H . Peter Anvin" , Peter Zijlstra , Linus Torvalds Subject: Re: [PATCH 23/43] x86/mm/kaiser: Introduce user-mapped per-cpu areas Message-ID: <20171126174149.45jxcnsetodm32xl@pd.tnic> References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-24-mingo@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171124172411.19476-24-mingo@kernel.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 24, 2017 at 06:23:51PM +0100, Ingo Molnar wrote: > From: Dave Hansen > > These patches are based on work from a team at Graz University of > Technology posted here: https://github.com/IAIK/KAISER > > The KAISER approach keeps two copies of the page tables: one for running > in the kernel and one for running userspace. But, there are a few > structures that are needed for switching in and out of the kernel and > a good subset of *those* are per-cpu data. > > This patch creates a new kind of per-cpu data that is mapped and Never say "This patch" in the commit message of a patch. It is tautologically useless. > can be used no matter which copy of the page tables is active. > Users of this new section will be forthcoming. > > Thanks to Hugh Dickins for cleanups to this code. > > Signed-off-by: Dave Hansen > Signed-off-by: Thomas Gleixner > Cc: Linus Torvalds > Cc: Peter Zijlstra > Cc: daniel.gruss@iaik.tugraz.at > Cc: hughd@google.com > Cc: keescook@google.com > Cc: linux-mm@kvack.org > Cc: luto@kernel.org > Cc: michael.schwarz@iaik.tugraz.at > Cc: moritz.lipp@iaik.tugraz.at > Cc: richard.fellner@student.tugraz.at > Link: https://lkml.kernel.org/r/20171123003444.196CB6DB@viggo.jf.intel.com > Signed-off-by: Ingo Molnar > --- > include/asm-generic/vmlinux.lds.h | 7 +++++++ > include/linux/percpu-defs.h | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 37 insertions(+) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index bdcd1caae092..e12168936d3f 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -826,7 +826,14 @@ > */ > #define PERCPU_INPUT(cacheline) \ > VMLINUX_SYMBOL(__per_cpu_start) = .; \ > + VMLINUX_SYMBOL(__per_cpu_user_mapped_start) = .; \ > *(.data..percpu..first) \ > + . = ALIGN(cacheline); \ > + *(.data..percpu..user_mapped) \ > + *(.data..percpu..user_mapped..shared_aligned) \ > + . = ALIGN(PAGE_SIZE); \ > + *(.data..percpu..user_mapped..page_aligned) \ > + VMLINUX_SYMBOL(__per_cpu_user_mapped_end) = .; \ > . = ALIGN(PAGE_SIZE); \ > *(.data..percpu..page_aligned) \ > . = ALIGN(cacheline); \ > diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h > index 2d2096ba1cfe..752513674295 100644 > --- a/include/linux/percpu-defs.h > +++ b/include/linux/percpu-defs.h > @@ -35,6 +35,12 @@ > > #endif > > +#ifdef CONFIG_KAISER > +#define USER_MAPPED_SECTION "..user_mapped" > +#else > +#define USER_MAPPED_SECTION "" > +#endif > /* > * Base implementations of per-CPU variable declarations and definitions, where > * the section in which the variable is to be placed is provided by the > @@ -115,6 +121,12 @@ > #define DEFINE_PER_CPU(type, name) \ > DEFINE_PER_CPU_SECTION(type, name, "") > > +#define DECLARE_PER_CPU_USER_MAPPED(type, name) \ > + DECLARE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION) > + > +#define DEFINE_PER_CPU_USER_MAPPED(type, name) \ > + DEFINE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION) > + > /* > * Declaration/definition used for per-CPU variables that must come first in > * the set of variables. > @@ -144,6 +156,14 @@ > DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ > ____cacheline_aligned_in_smp > > +#define DECLARE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(type, name) \ > + DECLARE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION PER_CPU_SHARED_ALIGNED_SECTION) \ > + ____cacheline_aligned_in_smp > + > +#define DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(type, name) \ > + DEFINE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION PER_CPU_SHARED_ALIGNED_SECTION) \ > + ____cacheline_aligned_in_smp > + > #define DECLARE_PER_CPU_ALIGNED(type, name) \ > DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \ > ____cacheline_aligned > @@ -162,6 +182,16 @@ > #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ > DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \ > __aligned(PAGE_SIZE) > +/* > + * Declaration/definition used for per-CPU variables that must be page aligned and need to be mapped in user mode. > + */ WARNING: line over 100 characters #122: FILE: include/linux/percpu-defs.h:186: + * Declaration/definition used for per-CPU variables that must be page aligned and need to be mapped in user mode. > +#define DECLARE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(type, name) \ > + DECLARE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION"..page_aligned") \ > + __aligned(PAGE_SIZE) > + > +#define DEFINE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(type, name) \ > + DEFINE_PER_CPU_SECTION(type, name, USER_MAPPED_SECTION"..page_aligned") \ > + __aligned(PAGE_SIZE) > > /* > * Declaration/definition used for per-CPU variables that must be read mostly. > -- With that: Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.