linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/mm/kaiser: a couple of KAISER mapping fixes
@ 2017-11-28  4:10 Josh Poimboeuf
  2017-11-28  4:10 ` [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section Josh Poimboeuf
  2017-11-28  4:10 ` [PATCH 2/2] x86/mm/kaiser: Don't map the IRQ stack in user space Josh Poimboeuf
  0 siblings, 2 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2017-11-28  4:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Dave Hansen, Andy Lutomirski, Ingo Molnar,
	Borislav Petkov, Brian Gerst, Denys Vlasenko, H . Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Rik van Riel, daniel.gruss,
	hughd, keescook, linux-mm, michael.schwarz, moritz.lipp,
	richard.fellner

On top of the tip KAISER patches.

Josh Poimboeuf (2):
  x86/mm/kaiser: Remove unused user-mapped page-aligned section
  x86/mm/kaiser: Don't map the IRQ stack in user space

 include/asm-generic/vmlinux.lds.h |  6 ++----
 include/linux/percpu-defs.h       | 10 ----------
 2 files changed, 2 insertions(+), 14 deletions(-)

-- 
2.13.6

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section
  2017-11-28  4:10 [PATCH 0/2] x86/mm/kaiser: a couple of KAISER mapping fixes Josh Poimboeuf
@ 2017-11-28  4:10 ` Josh Poimboeuf
  2017-11-28  9:20   ` Peter Zijlstra
  2017-11-28  4:10 ` [PATCH 2/2] x86/mm/kaiser: Don't map the IRQ stack in user space Josh Poimboeuf
  1 sibling, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2017-11-28  4:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Dave Hansen, Andy Lutomirski, Ingo Molnar,
	Borislav Petkov, Brian Gerst, Denys Vlasenko, H . Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Rik van Riel, daniel.gruss,
	hughd, keescook, linux-mm, michael.schwarz, moritz.lipp,
	richard.fellner

The '.data..percpu..user_mapped..page_aligned' section isn't used
anywhere.  Remove it and its related macros.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/asm-generic/vmlinux.lds.h |  2 --
 include/linux/percpu-defs.h       | 10 ----------
 2 files changed, 12 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e12168936d3f..386f8846d9e9 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -831,8 +831,6 @@
 	. = 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)					\
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 752513674295..40ea19ccf1ec 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -182,16 +182,6 @@
 #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.
- */
-#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.
-- 
2.13.6

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] x86/mm/kaiser: Don't map the IRQ stack in user space
  2017-11-28  4:10 [PATCH 0/2] x86/mm/kaiser: a couple of KAISER mapping fixes Josh Poimboeuf
  2017-11-28  4:10 ` [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section Josh Poimboeuf
@ 2017-11-28  4:10 ` Josh Poimboeuf
  1 sibling, 0 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2017-11-28  4:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Dave Hansen, Andy Lutomirski, Ingo Molnar,
	Borislav Petkov, Brian Gerst, Denys Vlasenko, H . Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Rik van Riel, daniel.gruss,
	hughd, keescook, linux-mm, michael.schwarz, moritz.lipp,
	richard.fellner

The '.data..percpu..first' section, which contains the IRQ software
stack, is included in the percpu user-mapped data area.

The IRQ stack is a software stack which is switched to *after* the CR3
switch, so it doesn't make sense to map it in user space.

Unmap it, and make sure the user-mapped area is page-aligned so it can
be mapped cleanly.

Fixes: 7d1b4c99a605 ("x86/mm/kaiser: Introduce user-mapped per-CPU areas")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/asm-generic/vmlinux.lds.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 386f8846d9e9..45d2fbb081c6 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -826,9 +826,9 @@
  */
 #define PERCPU_INPUT(cacheline)						\
 	VMLINUX_SYMBOL(__per_cpu_start) = .;				\
-	VMLINUX_SYMBOL(__per_cpu_user_mapped_start) = .;		\
 	*(.data..percpu..first)						\
-	. = ALIGN(cacheline);						\
+	. = ALIGN(PAGE_SIZE);						\
+	VMLINUX_SYMBOL(__per_cpu_user_mapped_start) = .;		\
 	*(.data..percpu..user_mapped)					\
 	*(.data..percpu..user_mapped..shared_aligned)			\
 	VMLINUX_SYMBOL(__per_cpu_user_mapped_end) = .;			\
-- 
2.13.6

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section
  2017-11-28  4:10 ` [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section Josh Poimboeuf
@ 2017-11-28  9:20   ` Peter Zijlstra
  2017-11-28 12:43     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2017-11-28  9:20 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: linux-kernel, Thomas Gleixner, Dave Hansen, Andy Lutomirski,
	Ingo Molnar, Borislav Petkov, Brian Gerst, Denys Vlasenko,
	H . Peter Anvin, Linus Torvalds, Rik van Riel, daniel.gruss,
	hughd, keescook, linux-mm, michael.schwarz, moritz.lipp,
	richard.fellner

On Mon, Nov 27, 2017 at 10:10:12PM -0600, Josh Poimboeuf wrote:
> The '.data..percpu..user_mapped..page_aligned' section isn't used
> anywhere.  Remove it and its related macros.

With my patches:

  arch/x86/events/intel/ds.c:DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct debug_store, cpu_debug_store);

is the only user left of any of that.

I suppose we could just allocate a whole page for that and use
kaiser_add_mapping() for it. Then we can remove all of
DEFINE_.*_USER_MAPPED().

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section
  2017-11-28  9:20   ` Peter Zijlstra
@ 2017-11-28 12:43     ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2017-11-28 12:43 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: linux-kernel, Thomas Gleixner, Dave Hansen, Andy Lutomirski,
	Ingo Molnar, Borislav Petkov, Brian Gerst, Denys Vlasenko,
	H . Peter Anvin, Linus Torvalds, Rik van Riel, daniel.gruss,
	hughd, keescook, linux-mm, michael.schwarz, moritz.lipp,
	richard.fellner

On Tue, Nov 28, 2017 at 10:20:25AM +0100, Peter Zijlstra wrote:
> On Mon, Nov 27, 2017 at 10:10:12PM -0600, Josh Poimboeuf wrote:
> > The '.data..percpu..user_mapped..page_aligned' section isn't used
> > anywhere.  Remove it and its related macros.
> 
> With my patches:
> 
>   arch/x86/events/intel/ds.c:DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct debug_store, cpu_debug_store);
> 
> is the only user left of any of that.
> 
> I suppose we could just allocate a whole page for that and use
> kaiser_add_mapping() for it. Then we can remove all of
> DEFINE_.*_USER_MAPPED().

Or we could field it a spot in the cpu_entry_area I suppose.

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-28 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  4:10 [PATCH 0/2] x86/mm/kaiser: a couple of KAISER mapping fixes Josh Poimboeuf
2017-11-28  4:10 ` [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section Josh Poimboeuf
2017-11-28  9:20   ` Peter Zijlstra
2017-11-28 12:43     ` Peter Zijlstra
2017-11-28  4:10 ` [PATCH 2/2] x86/mm/kaiser: Don't map the IRQ stack in user space Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).