Skip to contentSkip to conversation

Use asm-generic for mmu_context no-op functions

PATCH Applied Nicholas Piggin 8 participants 35 messages Sep 1, 2020 – Oct 19, 2020

Subsystems (22)
lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

v3 cover Use asm-generic for mmu_context no-op functions

It would be nice to be able to modify mmu_context functions or add a hook without updating all architectures, many of which will be no-ops.

The motivation for this series is a change to lazy mmu handling, but this series stands on its own as a good cleanup whether or not we end up making that change.

Since v2:
- Fixed build failure on arm64 (fingers crossed), did more cross compiling.
- Accounted for feedback and added acks (thanks all).

Arnd, most of the main archs have acks, and I asked for ack/nack from ones which are missing. We could give those a bit more time then merge.

Thanks,
Nick

Nicholas Piggin (23):
asm-generic: add generic MMU versions of mmu context functions
alpha: use asm-generic/mmu_context.h for no-op implementations
arc: use asm-generic/mmu_context.h for no-op implementations
arm: use asm-generic/mmu_context.h for no-op implementations
arm64: use asm-generic/mmu_context.h for no-op implementations
csky: use asm-generic/mmu_context.h for no-op implementations
hexagon: use asm-generic/mmu_context.h for no-op implementations
ia64: use asm-generic/mmu_context.h for no-op implementations
m68k: use asm-generic/mmu_context.h for no-op implementations
microblaze: use asm-generic/mmu_context.h for no-op implementations
mips: use asm-generic/mmu_context.h for no-op implementations
nds32: use asm-generic/mmu_context.h for no-op implementations
nios2: use asm-generic/mmu_context.h for no-op implementations
openrisc: use asm-generic/mmu_context.h for no-op implementations
parisc: use asm-generic/mmu_context.h for no-op implementations
powerpc: use asm-generic/mmu_context.h for no-op implementations
riscv: use asm-generic/mmu_context.h for no-op implementations
s390: use asm-generic/mmu_context.h for no-op implementations
sh: use asm-generic/mmu_context.h for no-op implementations
sparc: use asm-generic/mmu_context.h for no-op implementations
um: use asm-generic/mmu_context.h for no-op implementations
x86: use asm-generic/mmu_context.h for no-op implementations
xtensa: use asm-generic/mmu_context.h for no-op implementations

 arch/alpha/include/asm/mmu_context.h         | 12 ++--
 arch/arc/include/asm/mmu_context.h           | 17 +++---
 arch/arm/include/asm/mmu_context.h           | 26 +--------
 arch/arm64/include/asm/mmu_context.h         |  7 +--
 arch/c6x/include/asm/mmu_context.h           |  6 ++
 arch/csky/include/asm/mmu_context.h          |  8 +--
 arch/hexagon/include/asm/mmu_context.h       | 33 ++---------
 arch/ia64/include/asm/mmu_context.h          | 17 ++----
 arch/m68k/include/asm/mmu_context.h          | 37 +++----------
 arch/microblaze/include/asm/mmu_context.h    |  2 +-
 arch/microblaze/include/asm/mmu_context_mm.h |  8 +--
 arch/microblaze/include/asm/processor.h      |  3 -
 arch/mips/include/asm/mmu_context.h          | 11 ++--
 arch/nds32/include/asm/mmu_context.h         | 10 +---
 arch/nios2/include/asm/mmu_context.h         | 21 ++-----
 arch/openrisc/include/asm/mmu_context.h      |  8 +--
 arch/parisc/include/asm/mmu_context.h        | 12 ++--
 arch/powerpc/include/asm/mmu_context.h       | 13 +++--
 arch/riscv/include/asm/mmu_context.h         | 22 +-------
 arch/s390/include/asm/mmu_context.h          |  9 ++-
 arch/sh/include/asm/mmu_context.h            |  7 +--
 arch/sh/include/asm/mmu_context_32.h         |  9 ---
 arch/sparc/include/asm/mmu_context_32.h      | 10 ++--
 arch/sparc/include/asm/mmu_context_64.h      | 10 ++--
 arch/um/include/asm/mmu_context.h            | 12 ++--
 arch/x86/include/asm/mmu_context.h           |  6 ++
 arch/xtensa/include/asm/mmu_context.h        | 11 +---
 arch/xtensa/include/asm/nommu_context.h      | 26 +--------
 include/asm-generic/mmu_context.h            | 58 +++++++++++++++-----
 include/asm-generic/nommu_context.h          | 19 +++++++
 30 files changed, 174 insertions(+), 276 deletions(-)
 create mode 100644 arch/c6x/include/asm/mmu_context.h
 create mode 100644 include/asm-generic/nommu_context.h
Signature · 1 line
2.23.0
author reviewer
#1 lore raw

PATCH v3 1/23 asm-generic: add generic MMU versions of mmu context functions

Many of these are no-ops on many architectures, so extend mmu_context.h to cover MMU and NOMMU, and split the NOMMU bits out to nommu_context.h

---
 arch/c6x/include/asm/mmu_context.h        |  6 +++
 arch/microblaze/include/asm/mmu_context.h |  2 +-
 arch/sh/include/asm/mmu_context.h         |  2 +-
 include/asm-generic/mmu_context.h         | 58 +++++++++++++++++------
 include/asm-generic/nommu_context.h       | 19 ++++++++
 5 files changed, 71 insertions(+), 16 deletions(-)
 create mode 100644 arch/c6x/include/asm/mmu_context.h
 create mode 100644 include/asm-generic/nommu_context.h
arch/c6x/include/asm/mmu_context.h new file +6 -0
new file mode 100644
index 000000000000..d2659d0a3297
@@ -0,0 +1,6 @@
+#ifndef _ASM_C6X_MMU_CONTEXT_H
+#define _ASM_C6X_MMU_CONTEXT_H
+
+#include <asm-generic/nommu_context.h>
+
+#endif /* _ASM_C6X_MMU_CONTEXT_H */
arch/microblaze/include/asm/mmu_context.h +1 -1
index f74f9da07fdc..34004efb3def 100644
@@ -2,5 +2,5 @@
 #ifdef CONFIG_MMU
 # include <asm/mmu_context_mm.h>
 #else
-# include <asm-generic/mmu_context.h>
+# include <asm-generic/nommu_context.h>
 #endif
arch/sh/include/asm/mmu_context.h +1 -1
index f664e51e8a15..461b1304580b 100644
@@ -133,7 +133,7 @@ static inline void switch_mm(struct mm_struct *prev,
 #define set_TTB(pgd)			do { } while (0)
 #define get_TTB()			(0)
 
-#include <asm-generic/mmu_context.h>
+#include <asm-generic/nommu_context.h>
 
 #endif /* CONFIG_MMU */
 
include/asm-generic/mmu_context.h +44 -14

88 lines not on this page · raw message

include/asm-generic/nommu_context.h new file +19 -0
new file mode 100644
index 000000000000..4f916f9e16cd
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_GENERIC_NOMMU_H
+#define __ASM_GENERIC_NOMMU_H
+
+/*
+ * Generic hooks for NOMMU architectures, which do not need to do
+ * anything special here.
+ */
+#include <asm-generic/mm_hooks.h>
+
+static inline void switch_mm(struct mm_struct *prev,
+			struct mm_struct *next,
+			struct task_struct *tsk)
+{
+}
+
+#include <asm-generic/mmu_context.h>
+
+#endif /* __ASM_GENERIC_NOMMU_H */
Signature · 1 line
2.23.0
author reviewer
#2 lore raw

PATCH v3 2/23 alpha: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
Cc Richard Henderson <[email protected]>
Cc Ivan Kokshaysky <[email protected]>
Cc Matt Turner <[email protected]>

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/alpha/include/asm/mmu_context.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/alpha/include/asm/mmu_context.h +4 -8
index 6d7d9bc1b4b8..4eea7c616992 100644
@@ -214,8 +214,6 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
 	tbiap();
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
 #ifdef CONFIG_ALPHA_GENERIC
 # define switch_mm(a,b,c)	alpha_mv.mv_switch_mm((a),(b),(c))
 # define activate_mm(x,y)	alpha_mv.mv_activate_mm((x),(y))
@@ -229,6 +227,7 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
 # endif
 #endif
 
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -242,12 +241,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 	return 0;
 }
 
-extern inline void
-destroy_context(struct mm_struct *mm)
-{
-	/* Nothing to do.  */
-}
-
+#define enter_lazy_tlb enter_lazy_tlb
 static inline void
 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
@@ -255,6 +249,8 @@ enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 	  = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
 }
 
+#include <asm-generic/mmu_context.h>
+
 #ifdef __MMU_EXTERN_INLINE
 #undef __EXTERN_INLINE
 #undef __MMU_EXTERN_INLINE
Signature · 1 line
2.23.0
maintainer Acked-by on v3 2/23
#3 lore raw

Re: [PATCH v3 02/23] alpha: use asm-generic/mmu_context.h for no-op implementations

Quoted 10 lines · Nicholas Piggin
Cc Richard Henderson <[email protected]>
Cc Ivan Kokshaysky <[email protected]>
Cc Matt Turner <[email protected]>

---

Please ack or nack if you object to this being mered via Arnd's tree.

That would be great.

author reviewer
#4 lore raw

PATCH v3 3/23 arc: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/arc/include/asm/mmu_context.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
arch/arc/include/asm/mmu_context.h +9 -8
index 3a5e6a5b9ed6..df164066e172 100644
@@ -102,6 +102,7 @@ static inline void get_new_mmu_context(struct mm_struct *mm)
  * Initialize the context related info for a new mm_struct
  * instance.
  */
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -113,6 +114,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 	return 0;
 }
 
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	unsigned long flags;
@@ -153,13 +155,13 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 }
 
 /*
- * Called at the time of execve() to get a new ASID
- * Note the subtlety here: get_new_mmu_context() behaves differently here
- * vs. in switch_mm(). Here it always returns a new ASID, because mm has
- * an unallocated "initial" value, while in latter, it moves to a new ASID,
- * only if it was unallocated
+ * activate_mm defaults (in asm-generic) to switch_mm and is called at the
+ * time of execve() to get a new ASID Note the subtlety here:
+ * get_new_mmu_context() behaves differently here vs. in switch_mm(). Here
+ * it always returns a new ASID, because mm has an unallocated "initial"
+ * value, while in latter, it moves to a new ASID, only if it was
+ * unallocated
  */
-#define activate_mm(prev, next)		switch_mm(prev, next, NULL)
 
 /* it seemed that deactivate_mm( ) is a reasonable place to do book-keeping
  * for retiring-mm. However destroy_context( ) still needs to do that because
@@ -168,8 +170,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  * there is a good chance that task gets sched-out/in, making it's ASID valid
  * again (this teased me for a whole day).
  */
-#define deactivate_mm(tsk, mm)   do { } while (0)
 
-#define enter_lazy_tlb(mm, tsk)
+#include <asm-generic/mmu_context.h>
 
 #endif /* __ASM_ARC_MMU_CONTEXT_H */
Signature · 7 lines
2.23.0


_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Acked-by on v3 3/23
#5 lore raw

Re: [PATCH v3 03/23] arc: use asm-generic/mmu_context.h for no-op implementations

Quoted 3 lines · Nicholas Piggin

Thx,
-Vineet

Quoted 59 lines

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/arc/include/asm/mmu_context.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
arch/arc/include/asm/mmu_context.h +9 -8
index 3a5e6a5b9ed6..df164066e172 100644
@@ -102,6 +102,7 @@ static inline void get_new_mmu_context(struct mm_struct *mm)
  * Initialize the context related info for a new mm_struct
  * instance.
  */
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -113,6 +114,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 	return 0;
 }
 
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	unsigned long flags;
@@ -153,13 +155,13 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 }
 
 /*
- * Called at the time of execve() to get a new ASID
- * Note the subtlety here: get_new_mmu_context() behaves differently here
- * vs. in switch_mm(). Here it always returns a new ASID, because mm has
- * an unallocated "initial" value, while in latter, it moves to a new ASID,
- * only if it was unallocated
+ * activate_mm defaults (in asm-generic) to switch_mm and is called at the
+ * time of execve() to get a new ASID Note the subtlety here:
+ * get_new_mmu_context() behaves differently here vs. in switch_mm(). Here
+ * it always returns a new ASID, because mm has an unallocated "initial"
+ * value, while in latter, it moves to a new ASID, only if it was
+ * unallocated
  */
-#define activate_mm(prev, next)		switch_mm(prev, next, NULL)
 
 /* it seemed that deactivate_mm( ) is a reasonable place to do book-keeping
  * for retiring-mm. However destroy_context( ) still needs to do that because
@@ -168,8 +170,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  * there is a good chance that task gets sched-out/in, making it's ASID valid
  * again (this teased me for a whole day).
  */
-#define deactivate_mm(tsk, mm)   do { } while (0)
 
-#define enter_lazy_tlb(mm, tsk)
+#include <asm-generic/mmu_context.h>
 
 #endif /* __ASM_ARC_MMU_CONTEXT_H */
author reviewer
#6 lore raw

PATCH v3 4/23 arm: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/arm/include/asm/mmu_context.h | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)
arch/arm/include/asm/mmu_context.h +3 -23
index f99ed524fe41..84e58956fcab 100644
@@ -26,6 +26,8 @@ void __check_vmalloc_seq(struct mm_struct *mm);
 #ifdef CONFIG_CPU_HAS_ASID
 
 void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
+
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -92,32 +94,10 @@ static inline void finish_arch_post_lock_switch(void)
 
 #endif	/* CONFIG_MMU */
 
-static inline int
-init_new_context(struct task_struct *tsk, struct mm_struct *mm)
-{
-	return 0;
-}
-
-
 #endif	/* CONFIG_CPU_HAS_ASID */
 
-#define destroy_context(mm)		do { } while(0)
 #define activate_mm(prev,next)		switch_mm(prev, next, NULL)
 
-/*
- * This is called when "tsk" is about to enter lazy TLB mode.
- *
- * mm:  describes the currently active mm context
- * tsk: task which is entering lazy tlb
- * cpu: cpu number which is entering lazy tlb
- *
- * tsk->mm will be NULL
- */
-static inline void
-enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 /*
  * This is the actual mm switch as far as the scheduler
  * is concerned.  No registers are touched.  We avoid
@@ -149,6 +129,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
 #endif
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
+#include <asm-generic/mmu_context.h>
 
 #endif
Signature · 1 line
2.23.0
author reviewer
#7 lore raw

PATCH v3 5/23 arm64: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/arm64/include/asm/mmu_context.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/include/asm/mmu_context.h +3 -4
index f2d7537d6f83..fe2862aa1dad 100644
@@ -174,7 +174,6 @@ static inline void cpu_replace_ttbr1(pgd_t *pgdp)
  * Setting a reserved TTBR0 or EPD0 would work, but it all gets ugly when you
  * take CPU migration into account.
  */
-#define destroy_context(mm)		do { } while(0)
 void check_and_switch_context(struct mm_struct *mm);
 
 #define init_new_context(tsk,mm)	({ atomic64_set(&(mm)->context.id, 0); 0; })
@@ -202,6 +201,7 @@ static inline void update_saved_ttbr0(struct task_struct *tsk,
 }
 #endif
 
+#define enter_lazy_tlb enter_lazy_tlb
 static inline void
 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
@@ -242,12 +242,11 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	update_saved_ttbr0(tsk, next);
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-#define activate_mm(prev,next)	switch_mm(prev, next, current)
-
 void verify_cpu_asid_bits(void);
 void post_ttbr_update_workaround(void);
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* !__ASM_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#8 lore raw

PATCH v3 6/23 csky: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/csky/include/asm/mmu_context.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/csky/include/asm/mmu_context.h +3 -5
index abdf1f1cb6ec..b227d29393a8 100644
@@ -24,11 +24,6 @@
 #define cpu_asid(mm)		(atomic64_read(&mm->context.asid) & ASID_MASK)
 
 #define init_new_context(tsk,mm)	({ atomic64_set(&(mm)->context.asid, 0); 0; })
-#define activate_mm(prev,next)		switch_mm(prev, next, current)
-
-#define destroy_context(mm)		do {} while (0)
-#define enter_lazy_tlb(mm, tsk)		do {} while (0)
-#define deactivate_mm(tsk, mm)		do {} while (0)
 
 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
 
@@ -46,4 +41,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
 
 	flush_icache_deferred(next);
 }
+
+#include <asm-generic/mmu_context.h>
+
 #endif /* __ASM_CSKY_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#9 lore raw

PATCH v3 7/23 hexagon: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/hexagon/include/asm/mmu_context.h | 33 ++++----------------------
 1 file changed, 5 insertions(+), 28 deletions(-)
arch/hexagon/include/asm/mmu_context.h +5 -28
index cdc4adc0300a..81947764c47d 100644
@@ -15,39 +15,13 @@
 #include <asm/pgalloc.h>
 #include <asm/mem-layout.h>
 
-static inline void destroy_context(struct mm_struct *mm)
-{
-}
-
 /*
  * VM port hides all TLB management, so "lazy TLB" isn't very
  * meaningful.  Even for ports to architectures with visble TLBs,
  * this is almost invariably a null function.
+ *
+ * mm->context is set up by pgd_alloc, so no init_new_context required.
  */
-static inline void enter_lazy_tlb(struct mm_struct *mm,
-	struct task_struct *tsk)
-{
-}
-
-/*
- * Architecture-specific actions, if any, for memory map deactivation.
- */
-static inline void deactivate_mm(struct task_struct *tsk,
-	struct mm_struct *mm)
-{
-}
-
-/**
- * init_new_context - initialize context related info for new mm_struct instance
- * @tsk: pointer to a task struct
- * @mm: pointer to a new mm struct
- */
-static inline int init_new_context(struct task_struct *tsk,
-					struct mm_struct *mm)
-{
-	/* mm->context is set up by pgd_alloc */
-	return 0;
-}
 
 /*
  *  Switch active mm context
@@ -74,6 +48,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 /*
  *  Activate new memory map for task
  */
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 {
 	unsigned long flags;
@@ -86,4 +61,6 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 /*  Generic hooks for arch_dup_mmap and arch_exit_mmap  */
 #include <asm-generic/mm_hooks.h>
 
+#include <asm-generic/mmu_context.h>
+
 #endif
Signature · 1 line
2.23.0
author reviewer
#10 lore raw

PATCH v3 8/23 ia64: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/ia64/include/asm/mmu_context.h | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
arch/ia64/include/asm/mmu_context.h +4 -13
index 2da0e2eb036b..87a0d5bc11ef 100644
@@ -49,11 +49,6 @@ DECLARE_PER_CPU(u8, ia64_need_tlb_flush);
 extern void mmu_context_init (void);
 extern void wrap_mmu_context (struct mm_struct *mm);
 
-static inline void
-enter_lazy_tlb (struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 /*
  * When the context counter wraps around all TLBs need to be flushed because
  * an old context number might have been reused. This is signalled by the
@@ -116,6 +111,7 @@ get_mmu_context (struct mm_struct *mm)
  * Initialize context number to some sane value.  MM is guaranteed to be a
  * brand-new address-space, so no TLB flushing is needed, ever.
  */
+#define init_new_context init_new_context
 static inline int
 init_new_context (struct task_struct *p, struct mm_struct *mm)
 {
@@ -123,12 +119,6 @@ init_new_context (struct task_struct *p, struct mm_struct *mm)
 	return 0;
 }
 
-static inline void
-destroy_context (struct mm_struct *mm)
-{
-	/* Nothing to do.  */
-}
-
 static inline void
 reload_context (nv_mm_context_t context)
 {
@@ -178,11 +168,10 @@ activate_context (struct mm_struct *mm)
 	} while (unlikely(context != mm->context));
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
 /*
  * Switch from address space PREV to address space NEXT.
  */
+#define activate_mm activate_mm
 static inline void
 activate_mm (struct mm_struct *prev, struct mm_struct *next)
 {
@@ -196,5 +185,7 @@ activate_mm (struct mm_struct *prev, struct mm_struct *next)
 
 #define switch_mm(prev_mm,next_mm,next_task)	activate_mm(prev_mm, next_mm)
 
+#include <asm-generic/mmu_context.h>
+
 # endif /* ! __ASSEMBLY__ */
 #endif /* _ASM_IA64_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#11 lore raw

PATCH v3 9/23 m68k: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/m68k/include/asm/mmu_context.h | 37 +++++++----------------------
 1 file changed, 9 insertions(+), 28 deletions(-)
arch/m68k/include/asm/mmu_context.h +9 -28
index 993fd7e37069..d12d8a9032f6 100644
@@ -5,10 +5,6 @@
 #include <asm-generic/mm_hooks.h>
 #include <linux/mm_types.h>
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 #ifdef CONFIG_MMU
 
 #if defined(CONFIG_COLDFIRE)
@@ -58,6 +54,7 @@ static inline void get_mmu_context(struct mm_struct *mm)
 /*
  * We're finished using the context for an address space.
  */
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	if (mm->context != NO_CONTEXT) {
@@ -83,6 +80,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *active_mm,
 	struct mm_struct *mm)
 {
@@ -90,8 +88,6 @@ static inline void activate_mm(struct mm_struct *active_mm,
 	set_context(mm->context, mm->pgd);
 }
 
-#define deactivate_mm(tsk, mm) do { } while (0)
-
 #define prepare_arch_switch(next) load_ksp_mmu(next)
 
 static inline void load_ksp_mmu(struct task_struct *task)
@@ -176,6 +172,7 @@ extern unsigned long get_free_context(struct mm_struct *mm);
 extern void clear_context(unsigned long context);
 
 /* set the context for a new task to unmapped */
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -210,8 +207,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	activate_context(tsk->mm);
 }
 
-#define deactivate_mm(tsk, mm)	do { } while (0)
-
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev_mm,
 			       struct mm_struct *next_mm)
 {
@@ -224,6 +220,7 @@ static inline void activate_mm(struct mm_struct *prev_mm,
 #include <asm/page.h>
 #include <asm/cacheflush.h>
 
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -231,8 +228,6 @@ static inline int init_new_context(struct task_struct *tsk,
 	return 0;
 }
 
-#define destroy_context(mm)		do { } while(0)
-
 static inline void switch_mm_0230(struct mm_struct *mm)
 {
 	unsigned long crp[2] = {
@@ -300,8 +295,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
 	}
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev_mm,
 			       struct mm_struct *next_mm)
 {
@@ -315,24 +309,11 @@ static inline void activate_mm(struct mm_struct *prev_mm,
 
 #endif
 
-#else /* !CONFIG_MMU */
-
-static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
-{
-	return 0;
-}
-
-
-static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
-{
-}
+#include <asm-generic/mmu_context.h>
 
-#define destroy_context(mm)	do { } while (0)
-#define deactivate_mm(tsk,mm)	do { } while (0)
+#else /* !CONFIG_MMU */
 
-static inline void activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
-{
-}
+#include <asm-generic/nommu_context.h>
 
 #endif /* CONFIG_MMU */
 #endif /* __M68K_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#12 lore raw

PATCH v3 10/23 microblaze: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

Wire asm-generic/mmu_context.h to provide generic empty hooks for arch code simplification.

---
 arch/microblaze/include/asm/mmu_context_mm.h | 8 ++++----
 arch/microblaze/include/asm/processor.h      | 3 ---
 2 files changed, 4 insertions(+), 7 deletions(-)
arch/microblaze/include/asm/mmu_context_mm.h +4 -4
index a1c7dd48454c..c2c77f708455 100644
@@ -33,10 +33,6 @@
    to represent all kernel pages as shared among all contexts.
  */
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 # define NO_CONTEXT	256
 # define LAST_CONTEXT	255
 # define FIRST_CONTEXT	1
@@ -105,6 +101,7 @@ static inline void get_mmu_context(struct mm_struct *mm)
 /*
  * We're finished using the context for an address space.
  */
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	if (mm->context != NO_CONTEXT) {
@@ -126,6 +123,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *active_mm,
 			struct mm_struct *mm)
 {
@@ -136,5 +134,7 @@ static inline void activate_mm(struct mm_struct *active_mm,
 
 extern void mmu_context_init(void);
 
+#include <asm-generic/mmu_context.h>
+
 # endif /* __KERNEL__ */
 #endif /* _ASM_MICROBLAZE_MMU_CONTEXT_H */
arch/microblaze/include/asm/processor.h +0 -3
index 1ff5a82b76b6..616211871a6e 100644
@@ -122,9 +122,6 @@ unsigned long get_wchan(struct task_struct *p);
 #  define KSTK_EIP(task)	(task_pc(task))
 #  define KSTK_ESP(task)	(task_sp(task))
 
-/* FIXME */
-#  define deactivate_mm(tsk, mm)	do { } while (0)
-
 #  define STACK_TOP	TASK_SIZE
 #  define STACK_TOP_MAX	STACK_TOP
 
Signature · 1 line
2.23.0
author reviewer
#13 lore raw

PATCH v3 11/23 mips: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/mips/include/asm/mmu_context.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
arch/mips/include/asm/mmu_context.h +4 -7
index cddead91acd4..ed9f2d748f63 100644
@@ -124,10 +124,6 @@ static inline void set_cpu_context(unsigned int cpu,
 #define cpu_asid(cpu, mm) \
 	(cpu_context((cpu), (mm)) & cpu_asid_mask(&cpu_data[cpu]))
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 extern void get_new_mmu_context(struct mm_struct *mm);
 extern void check_mmu_context(struct mm_struct *mm);
 extern void check_switch_mmu_context(struct mm_struct *mm);
@@ -136,6 +132,7 @@ extern void check_switch_mmu_context(struct mm_struct *mm);
  * Initialize the context related info for a new mm_struct
  * instance.
  */
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -180,14 +177,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  * Destroy context related info for an mm_struct that is about
  * to be put to rest.
  */
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	dsemul_mm_cleanup(mm);
 }
 
-#define activate_mm(prev, next)	switch_mm(prev, next, current)
-#define deactivate_mm(tsk, mm)	do { } while (0)
-
 static inline void
 drop_mmu_context(struct mm_struct *mm)
 {
@@ -237,4 +232,6 @@ drop_mmu_context(struct mm_struct *mm)
 	local_irq_restore(flags);
 }
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* _ASM_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
maintainer Acked-by on v3 11/23
#14 lore raw

Re: [PATCH v3 11/23] mips: use asm-generic/mmu_context.h for no-op implementations

Quoted 10 lines · Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/mips/include/asm/mmu_context.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
author reviewer
#15 lore raw

PATCH v3 12/23 nds32: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/nds32/include/asm/mmu_context.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
arch/nds32/include/asm/mmu_context.h +2 -8
index b8fd3d189fdc..c651bc8cacdc 100644
@@ -9,6 +9,7 @@
 #include <asm/proc-fns.h>
 #include <asm-generic/mm_hooks.h>
 
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -16,8 +17,6 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 	return 0;
 }
 
-#define destroy_context(mm)	do { } while(0)
-
 #define CID_BITS	9
 extern spinlock_t cid_lock;
 extern unsigned int cpu_last_cid;
@@ -47,10 +46,6 @@ static inline void check_context(struct mm_struct *mm)
 		__new_context(mm);
 }
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 			     struct task_struct *tsk)
 {
@@ -62,7 +57,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	}
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-#define activate_mm(prev,next)	switch_mm(prev, next, NULL)
+#include <asm-generic/mmu_context.h>
 
 #endif
Signature · 1 line
2.23.0
author reviewer
#16 lore raw

PATCH v3 13/23 nios2: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/nios2/include/asm/mmu_context.h | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
arch/nios2/include/asm/mmu_context.h +4 -17
index 78ab3dacf579..4f99ed09b5a7 100644
@@ -26,16 +26,13 @@ extern unsigned long get_pid_from_context(mm_context_t *ctx);
  */
 extern pgd_t *pgd_current;
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 /*
  * Initialize the context related info for a new mm_struct instance.
  *
  * Set all new contexts to 0, that way the generation will never match
  * the currently running generation when this context is switched in.
  */
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 					struct mm_struct *mm)
 {
@@ -43,26 +40,16 @@ static inline int init_new_context(struct task_struct *tsk,
 	return 0;
 }
 
-/*
- * Destroy context related info for an mm_struct that is about
- * to be put to rest.
- */
-static inline void destroy_context(struct mm_struct *mm)
-{
-}
-
 void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 		struct task_struct *tsk);
 
-static inline void deactivate_mm(struct task_struct *tsk,
-				struct mm_struct *mm)
-{
-}
-
 /*
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
+#define activate_mm activate_mm
 void activate_mm(struct mm_struct *prev, struct mm_struct *next);
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* _ASM_NIOS2_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#17 lore raw

PATCH v3 14/23 openrisc: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
Cc Jonas Bonn <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Stafford Horne <[email protected]>
Cc openrisc at lists.librecores.org

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/openrisc/include/asm/mmu_context.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/openrisc/include/asm/mmu_context.h +3 -5
index ced577542e29..a6702384c77d 100644
@@ -17,13 +17,13 @@
 
 #include <asm-generic/mm_hooks.h>
 
+#define init_new_context init_new_context
 extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
+#define destroy_context destroy_context
 extern void destroy_context(struct mm_struct *mm);
 extern void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 		      struct task_struct *tsk);
 
-#define deactivate_mm(tsk, mm)	do { } while (0)
-
 #define activate_mm(prev, next) switch_mm((prev), (next), NULL)
 
 /* current active pgd - this is similar to other processors pgd
@@ -32,8 +32,6 @@ extern void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 
 extern volatile pgd_t *current_pgd[]; /* defined in arch/openrisc/mm/fault.c */
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
+#include <asm-generic/mmu_context.h>
 
 #endif
Signature · 1 line
2.23.0
author reviewer
#18 lore raw

PATCH v3 15/23 parisc: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/parisc/include/asm/mmu_context.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/parisc/include/asm/mmu_context.h +6 -6
index cb5f2f730421..46f8c22c5977 100644
@@ -7,16 +7,13 @@
 #include <linux/atomic.h>
 #include <asm-generic/mm_hooks.h>
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 /* on PA-RISC, we actually have enough contexts to justify an allocator
  * for them.  prumpf */
 
 extern unsigned long alloc_sid(void);
 extern void free_sid(unsigned long);
 
+#define init_new_context init_new_context
 static inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -26,6 +23,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 	return 0;
 }
 
+#define destroy_context destroy_context
 static inline void
 destroy_context(struct mm_struct *mm)
 {
@@ -71,8 +69,7 @@ static inline void switch_mm(struct mm_struct *prev,
 }
 #define switch_mm_irqs_off switch_mm_irqs_off
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 {
 	/*
@@ -90,4 +87,7 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 
 	switch_mm(prev,next,current);
 }
+
+#include <asm-generic/mmu_context.h>
+
 #endif
Signature · 1 line
2.23.0
author reviewer
#19 lore raw

PATCH v3 16/23 powerpc: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/powerpc/include/asm/mmu_context.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/mmu_context.h +8 -5
index 7f3658a97384..a3a12a8341b2 100644
@@ -14,7 +14,9 @@
 /*
  * Most if the context management is out of line
  */
+#define init_new_context init_new_context
 extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
+#define destroy_context destroy_context
 extern void destroy_context(struct mm_struct *mm);
 #ifdef CONFIG_SPAPR_TCE_IOMMU
 struct mm_iommu_table_group_mem_t;
@@ -235,27 +237,26 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 }
 #define switch_mm_irqs_off switch_mm_irqs_off
 
-
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
 /*
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 {
 	switch_mm(prev, next, current);
 }
 
 /* We don't currently use enter_lazy_tlb() for anything */
+#ifdef CONFIG_PPC_BOOK3E_64
+#define enter_lazy_tlb enter_lazy_tlb
 static inline void enter_lazy_tlb(struct mm_struct *mm,
 				  struct task_struct *tsk)
 {
 	/* 64-bit Book3E keeps track of current PGD in the PACA */
-#ifdef CONFIG_PPC_BOOK3E_64
 	get_paca()->pgd = NULL;
-#endif
 }
+#endif
 
 extern void arch_exit_mmap(struct mm_struct *mm);
 
@@ -298,5 +299,7 @@ static inline int arch_dup_mmap(struct mm_struct *oldmm,
 	return 0;
 }
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_POWERPC_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#20 lore raw

PATCH v3 17/23 riscv: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/riscv/include/asm/mmu_context.h | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
arch/riscv/include/asm/mmu_context.h +2 -20
index 67c463812e2d..250defa06f3a 100644
@@ -13,34 +13,16 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 
-static inline void enter_lazy_tlb(struct mm_struct *mm,
-	struct task_struct *task)
-{
-}
-
-/* Initialize context-related info for a new mm_struct */
-static inline int init_new_context(struct task_struct *task,
-	struct mm_struct *mm)
-{
-	return 0;
-}
-
-static inline void destroy_context(struct mm_struct *mm)
-{
-}
-
 void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	struct task_struct *task);
 
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev,
 			       struct mm_struct *next)
 {
 	switch_mm(prev, next, NULL);
 }
 
-static inline void deactivate_mm(struct task_struct *task,
-	struct mm_struct *mm)
-{
-}
+#include <asm-generic/mmu_context.h>
 
 #endif /* _ASM_RISCV_MMU_CONTEXT_H */
Signature · 7 lines
2.23.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author reviewer
#21 lore raw

PATCH v3 18/23 s390: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Christian Borntraeger <[email protected]>

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/s390/include/asm/mmu_context.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
arch/s390/include/asm/mmu_context.h +4 -5
index c9f3d8a52756..66f9cf0a07e3 100644
@@ -15,6 +15,7 @@
 #include <asm/ctl_reg.h>
 #include <asm-generic/mm_hooks.h>
 
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -69,8 +70,6 @@ static inline int init_new_context(struct task_struct *tsk,
 	return 0;
 }
 
-#define destroy_context(mm)             do { } while (0)
-
 static inline void set_user_asce(struct mm_struct *mm)
 {
 	S390_lowcore.user_asce = mm->context.asce;
@@ -125,9 +124,7 @@ static inline void finish_arch_post_lock_switch(void)
 	set_fs(current->thread.mm_segment);
 }
 
-#define enter_lazy_tlb(mm,tsk)	do { } while (0)
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *prev,
                                struct mm_struct *next)
 {
@@ -136,4 +133,6 @@ static inline void activate_mm(struct mm_struct *prev,
 	set_user_asce(next);
 }
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* __S390_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#22 lore raw

PATCH v3 19/23 sh: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/sh/include/asm/mmu_context.h    | 5 ++---
 arch/sh/include/asm/mmu_context_32.h | 9 ---------
 2 files changed, 2 insertions(+), 12 deletions(-)
arch/sh/include/asm/mmu_context.h +2 -3
index 461b1304580b..78eef4e7d5df 100644
@@ -84,6 +84,7 @@ static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
  * Initialize the context related info for a new mm_struct
  * instance.
  */
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -120,9 +121,7 @@ static inline void switch_mm(struct mm_struct *prev,
 			activate_context(next, cpu);
 }
 
-#define activate_mm(prev, next)		switch_mm((prev),(next),NULL)
-#define deactivate_mm(tsk,mm)		do { } while (0)
-#define enter_lazy_tlb(mm,tsk)		do { } while (0)
+#include <asm-generic/mmu_context.h>
 
 #else
 
arch/sh/include/asm/mmu_context_32.h +0 -9
index 71bf12ef1f65..bc5034fa6249 100644
@@ -2,15 +2,6 @@
 #ifndef __ASM_SH_MMU_CONTEXT_32_H
 #define __ASM_SH_MMU_CONTEXT_32_H
 
-/*
- * Destroy context related info for an mm_struct that is about
- * to be put to rest.
- */
-static inline void destroy_context(struct mm_struct *mm)
-{
-	/* Do nothing */
-}
-
 #ifdef CONFIG_CPU_HAS_PTEAEX
 static inline void set_asid(unsigned long asid)
 {
Signature · 1 line
2.23.0
maintainer Acked-by on v3 19/23
#23 lore raw

Re: [PATCH v3 19/23] sh: use asm-generic/mmu_context.h for no-op implementations

Quoted 8 lines · Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

Quoted 50 lines
 arch/sh/include/asm/mmu_context.h    | 5 ++---
 arch/sh/include/asm/mmu_context_32.h | 9 ---------
 2 files changed, 2 insertions(+), 12 deletions(-)
arch/sh/include/asm/mmu_context.h +2 -3
index 461b1304580b..78eef4e7d5df 100644
@@ -84,6 +84,7 @@ static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
  * Initialize the context related info for a new mm_struct
  * instance.
  */
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -120,9 +121,7 @@ static inline void switch_mm(struct mm_struct *prev,
 			activate_context(next, cpu);
 }
 
-#define activate_mm(prev, next)		switch_mm((prev),(next),NULL)
-#define deactivate_mm(tsk,mm)		do { } while (0)
-#define enter_lazy_tlb(mm,tsk)		do { } while (0)
+#include <asm-generic/mmu_context.h>
 
 #else
 
arch/sh/include/asm/mmu_context_32.h +0 -9
index 71bf12ef1f65..bc5034fa6249 100644
@@ -2,15 +2,6 @@
 #ifndef __ASM_SH_MMU_CONTEXT_32_H
 #define __ASM_SH_MMU_CONTEXT_32_H
 
-/*
- * Destroy context related info for an mm_struct that is about
- * to be put to rest.
- */
-static inline void destroy_context(struct mm_struct *mm)
-{
-	/* Do nothing */
-}
-
 #ifdef CONFIG_CPU_HAS_PTEAEX
 static inline void set_asid(unsigned long asid)
 {
Signature · 1 line
2.23.0
author reviewer
#24 lore raw

PATCH v3 20/23 sparc: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/sparc/include/asm/mmu_context_32.h | 10 ++++------
 arch/sparc/include/asm/mmu_context_64.h | 10 +++++-----
 2 files changed, 9 insertions(+), 11 deletions(-)
arch/sparc/include/asm/mmu_context_32.h +4 -6
index 7ddcb8badf70..509043f81560 100644
@@ -6,13 +6,10 @@
 
 #include <asm-generic/mm_hooks.h>
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 /* Initialize a new mmu context.  This is invoked when a new
  * address space instance (unique or shared) is instantiated.
  */
+#define init_new_context init_new_context
 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
 
 /* Destroy a dead context.  This occurs when mmput drops the
@@ -20,17 +17,18 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
  * all the page tables have been flushed.  Our job is to destroy
  * any remaining processor-specific state.
  */
+#define destroy_context destroy_context
 void destroy_context(struct mm_struct *mm);
 
 /* Switch the current MM context. */
 void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm,
 	       struct task_struct *tsk);
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
 /* Activate a new MM instance for the current task. */
 #define activate_mm(active_mm, mm) switch_mm((active_mm), (mm), NULL)
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* !(__ASSEMBLY__) */
 
 #endif /* !(__SPARC_MMU_CONTEXT_H) */
arch/sparc/include/asm/mmu_context_64.h +5 -5
index 312fcee8df2b..7a8380c63aab 100644
@@ -16,17 +16,16 @@
 #include <asm-generic/mm_hooks.h>
 #include <asm/percpu.h>
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
 extern spinlock_t ctx_alloc_lock;
 extern unsigned long tlb_context_cache;
 extern unsigned long mmu_context_bmap[];
 
 DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm);
 void get_new_mmu_context(struct mm_struct *mm);
+
+#define init_new_context init_new_context
 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
+#define destroy_context destroy_context
 void destroy_context(struct mm_struct *mm);
 
 void __tsb_context_switch(unsigned long pgd_pa,
@@ -136,7 +135,6 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
 	spin_unlock_irqrestore(&mm->context.lock, flags);
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
 #define activate_mm(active_mm, mm) switch_mm(active_mm, mm, NULL)
 
 #define  __HAVE_ARCH_START_CONTEXT_SWITCH
@@ -187,6 +185,8 @@ static inline void finish_arch_post_lock_switch(void)
 	}
 }
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* !(__ASSEMBLY__) */
 
 #endif /* !(__SPARC64_MMU_CONTEXT_H) */
Signature · 1 line
2.23.0
author reviewer
#25 lore raw

PATCH v3 21/23 um: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
Cc Jeff Dike <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Anton Ivanov <[email protected]>

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/um/include/asm/mmu_context.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
arch/um/include/asm/mmu_context.h +5 -7
index 17ddd4edf875..f8a100770691 100644
@@ -37,10 +37,9 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,
  * end asm-generic/mm_hooks.h functions
  */
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
 extern void force_flush_all(void);
 
+#define activate_mm activate_mm
 static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
 {
 	/*
@@ -66,13 +65,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	}
 }
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, 
-				  struct task_struct *tsk)
-{
-}
-
+#define init_new_context init_new_context
 extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
 
+#define destroy_context destroy_context
 extern void destroy_context(struct mm_struct *mm);
 
+#include <asm-generic/mmu_context.h>
+
 #endif
Signature · 7 lines
2.23.0


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
author reviewer
#26 lore raw

PATCH v3 22/23 x86: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin
---
 arch/x86/include/asm/mmu_context.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/include/asm/mmu_context.h +6 -0
index d98016b83755..36afcbea6a9f 100644
@@ -91,12 +91,14 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next)
 }
 #endif
 
+#define enter_lazy_tlb enter_lazy_tlb
 extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk);
 
 /*
  * Init a new mm.  Used on mm copies, like at fork()
  * and on mm's that are brand-new, like at execve().
  */
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
 {
@@ -116,6 +118,8 @@ static inline int init_new_context(struct task_struct *tsk,
 	init_new_context_ldt(mm);
 	return 0;
 }
+
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	destroy_context_ldt(mm);
@@ -214,4 +218,6 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,
 
 unsigned long __get_current_cr3_fast(void);
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* _ASM_X86_MMU_CONTEXT_H */
Signature · 1 line
2.23.0
author reviewer
#27 lore raw

PATCH v3 23/23 xtensa: use asm-generic/mmu_context.h for no-op implementations

In reply to Nicholas Piggin

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/xtensa/include/asm/mmu_context.h   | 11 +++--------
 arch/xtensa/include/asm/nommu_context.h | 26 +------------------------
 2 files changed, 4 insertions(+), 33 deletions(-)
arch/xtensa/include/asm/mmu_context.h +3 -8
index 74923ef3b228..e337ba9686e9 100644
@@ -111,6 +111,7 @@ static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
  * to -1 says the process has never run on any core.
  */
 
+#define init_new_context init_new_context
 static inline int init_new_context(struct task_struct *tsk,
 		struct mm_struct *mm)
 {
@@ -136,24 +137,18 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 		activate_context(next, cpu);
 }
 
-#define activate_mm(prev, next)	switch_mm((prev), (next), NULL)
-#define deactivate_mm(tsk, mm)	do { } while (0)
-
 /*
  * Destroy context related info for an mm_struct that is about
  * to be put to rest.
  */
+#define destroy_context destroy_context
 static inline void destroy_context(struct mm_struct *mm)
 {
 	invalidate_page_directory();
 }
 
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-	/* Nothing to do. */
-
-}
+#include <asm-generic/mmu_context.h>
 
 #endif /* CONFIG_MMU */
 #endif /* _XTENSA_MMU_CONTEXT_H */
arch/xtensa/include/asm/nommu_context.h +1 -25
index 37251b2ef871..7c9d1918dc41 100644
@@ -7,28 +7,4 @@ static inline void init_kio(void)
 {
 }
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
-static inline int init_new_context(struct task_struct *tsk,struct mm_struct *mm)
-{
-	return 0;
-}
-
-static inline void destroy_context(struct mm_struct *mm)
-{
-}
-
-static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
-{
-}
-
-static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
-				struct task_struct *tsk)
-{
-}
-
-static inline void deactivate_mm(struct task_struct *tsk, struct mm_struct *mm)
-{
-}
+#include <asm-generic/nommu_context.h>
Signature · 1 line
2.23.0
maintainer Acked-by on v3 23/23
#28 lore raw

Re: [PATCH v3 23/23] xtensa: use asm-generic/mmu_context.h for no-op implementations

Quoted 5 lines · Nicholas Piggin
Quoted 8 lines

---

Please ack or nack if you object to this being mered via Arnd's tree.

 arch/xtensa/include/asm/mmu_context.h   | 11 +++--------
 arch/xtensa/include/asm/nommu_context.h | 26 +------------------------
 2 files changed, 4 insertions(+), 33 deletions(-)
Signature · 2 lines
Thanks.
-- Max
maintainer Applied
#29 lore raw
In reply to Nicholas Piggin
Quoted 8 lines · Nicholas Piggin

It would be nice to be able to modify mmu_context functions or add a hook without updating all architectures, many of which will be no-ops.

The motivation for this series is a change to lazy mmu handling, but this series stands on its own as a good cleanup whether or not we end up making that change.

[...]

Applied to asm-generic, thanks!

[01/23] asm-generic: add generic MMU versions of mmu context functions
(no commit info)
[02/23] alpha: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[03/23] arc: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[04/23] arm: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[05/23] arm64: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[06/23] csky: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[07/23] hexagon: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[08/23] ia64: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[09/23] m68k: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[10/23] microblaze: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[11/23] mips: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[12/23] nds32: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[13/23] nios2: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[14/23] openrisc: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[15/23] parisc: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[16/23] powerpc: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[17/23] riscv: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[18/23] s390: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[19/23] sh: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[20/23] sparc: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[21/23] um: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[22/23] x86: use asm-generic/mmu_context.h for no-op implementations
(no commit info)
[23/23] xtensa: use asm-generic/mmu_context.h for no-op implementations
(no commit info)

Arnd

maintainer
#30 lore raw
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines · Nicholas Piggin

It would be nice to be able to modify mmu_context functions or add a hook without updating all architectures, many of which will be no-ops.

Quoted 7 lines
Quoted 5 lines

The motivation for this series is a change to lazy mmu handling, but this series stands on its own as a good cleanup whether or not we end up making that change.

[...]

Applied to asm-generic, thanks!

Hi Nick,

I just noticed a fatal mistake I made when pushing it to the branch on kernel.org: I used to have both a 'master' and an 'asm-generic' branch in asm-generic.git but tried to remove the 'master' one as there is not really any point in having two.

Unfortunately I forgot to check which one of the two was part of linux-next, and it was the other one, so none of the patches I picked up ever saw any wider testing aside from the 0day bot building it (successfully).

Are there other changes that depend on this? If not, I would just wait until -rc1 and then either push the branch correctly or rebase the patches on that first, to avoid pushing something that did not see the necessary testing.

Arnd

#31 lore raw

Hi Arnd,

Quoted 27 lines · On Fri, 9 Oct 2020 16:01:22 +0200 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines · Nicholas Piggin

It would be nice to be able to modify mmu_context functions or add a hook without updating all architectures, many of which will be no-ops.

Quoted 7 lines
Quoted 5 lines

The motivation for this series is a change to lazy mmu handling, but this series stands on its own as a good cleanup whether or not we end up making that change.

[...]

Applied to asm-generic, thanks!

Hi Nick,

I just noticed a fatal mistake I made when pushing it to the branch on kernel.org: I used to have both a 'master' and an 'asm-generic' branch in asm-generic.git but tried to remove the 'master' one as there is not really any point in having two.

Unfortunately I forgot to check which one of the two was part of linux-next, and it was the other one, so none of the patches I picked up ever saw any wider testing aside from the 0day bot building it (successfully).

Quoted 4 lines

Are there other changes that depend on this? If not, I would just wait until -rc1 and then either push the branch correctly or rebase the patches on that first, to avoid pushing something that did not see the necessary testing.

If it is useful enough (or important enough), then put in in your linux-next included branch, but don't ask Linus to merge it until the second week of the merge window ... no worse than some other stuff I see :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#32 lore raw
Quoted 11 lines · Stephen Rothwell
Quoted 4 lines · On Fri, 9 Oct 2020 16:01:22 +0200 Arnd Bergmann <[email protected]> wrote:

Are there other changes that depend on this? If not, I would just wait until -rc1 and then either push the branch correctly or rebase the patches on that first, to avoid pushing something that did not see the necessary testing.

If it is useful enough (or important enough), then put in in your linux-next included branch, but don't ask Linus to merge it until the second week of the merge window ... no worse than some other stuff I see :-(

By itself, it's a nice cleanup, but it doesn't provide any immediate benefit over the previous state, while potentially introducing a regression in one of the less tested architectures.

The question to me is really whether Nick has any pending work that he would like to submit after this branch is merged into mainline.

Arnd

#33 lore raw

Hi Arnd,

Quoted 9 lines · On Sat, 10 Oct 2020 10:25:11 +0200 Arnd Bergmann <[email protected]> wrote:
Quoted 7 lines · Stephen Rothwell
Quoted 4 lines · On Fri, 9 Oct 2020 16:01:22 +0200 Arnd Bergmann <[email protected]> wrote:

Are there other changes that depend on this? If not, I would just wait until -rc1 and then either push the branch correctly or rebase the patches on that first, to avoid pushing something that did not see the necessary testing.

Quoted 8 lines
Quoted 4 lines

If it is useful enough (or important enough), then put in in your linux-next included branch, but don't ask Linus to merge it until the second week of the merge window ... no worse than some other stuff I see :-(

By itself, it's a nice cleanup, but it doesn't provide any immediate benefit over the previous state, while potentially introducing a regression in one of the less tested architectures.

OK.

Quoted 3 lines

The question to me is really whether Nick has any pending work that he would like to submit after this branch is merged into mainline.

Signature · 2 lines
Cheers,
Stephen Rothwell
author reviewer
#34 lore raw
In reply to Arnd Bergmann

Excerpts from Arnd Bergmann's message of October 10, 2020 6:25 pm:

Quoted 13 lines · Stephen Rothwell
Quoted 11 lines · On Fri, 9 Oct 2020 16:01:22 +0200 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines

Are there other changes that depend on this? If not, I would just wait until -rc1 and then either push the branch correctly or rebase the patches on that first, to avoid pushing something that did not see the necessary testing.

If it is useful enough (or important enough), then put in in your linux-next included branch, but don't ask Linus to merge it until the second week of the merge window ... no worse than some other stuff I see :-(

Quoted 7 lines

By itself, it's a nice cleanup, but it doesn't provide any immediate benefit over the previous state, while potentially introducing a regression in one of the less tested architectures.

The question to me is really whether Nick has any pending work that he would like to submit after this branch is merged into mainline.

Not for this merge window but I was hoping to submit something for improving lazy tlb handling in the next one.

Thanks,
Nick