Skip to contentSkip to conversation

x86/mm/kaiser: a couple of KAISER mapping fixes

PATCH In review Josh Poimboeuf 2 participants 5 messages Nov 28, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover x86/mm/kaiser: a couple of KAISER mapping fixes

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(-)
Signature · 7 lines
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH 1/2 x86/mm/kaiser: Remove unused user-mapped page-aligned section

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

---
 include/asm-generic/vmlinux.lds.h |  2 --
 include/linux/percpu-defs.h       | 10 ----------
 2 files changed, 12 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -2
index e12168936d3f..386f8846d9e9 100644
@@ -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)					\
include/linux/percpu-defs.h +0 -10
index 752513674295..40ea19ccf1ec 100644
@@ -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.
Signature · 7 lines
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw

Re: [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section

Quoted 2 lines · Josh Poimboeuf

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

Re: [PATCH 1/2] x86/mm/kaiser: Remove unused user-mapped page-aligned section

Quoted 6 lines · Peter Zijlstra
Quoted 2 lines · Josh Poimboeuf

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

With my patches:

Quoted 7 lines
  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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

PATCH 2/2 x86/mm/kaiser: Don't map the IRQ stack in user space

In reply to Josh Poimboeuf

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")
---
 include/asm-generic/vmlinux.lds.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +2 -2
index 386f8846d9e9..45d2fbb081c6 100644
@@ -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) = .;			\
Signature · 7 lines
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>