Use asm-generic for mmu_context no-op functions
Subsystems (23)
Nicholas Piggin
reviewerPATCH 2/24 alpha: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/alpha/include/asm/mmu_context.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
arch/alpha/include/asm/mmu_context.h +4 -8
@@ -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_contextstatic 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_tlbstatic 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
Nicholas Piggin
reviewerPATCH 3/24 arc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/arc/include/asm/mmu_context.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arc/include/asm/mmu_context.h +8 -8
@@ -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_contextstatic 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_contextstatic inline void destroy_context (struct mm_struct *mm) {unsigned long flags;
@@ -153,13 +155,12 @@ 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 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 +169,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 · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 4/24 arm: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/arm/include/asm/mmu_context.h | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
arch/arm/include/asm/mmu_context.h +3 -23
@@ -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_contextstatic 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
Nicholas Piggin
reviewerPATCH 5/24 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
@@ -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,unsigned int cpu);#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_tlbstatic inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) {
@@ -244,12 +244,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
Nicholas Piggin
reviewerPATCH 6/24 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
@@ -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
Nicholas Piggin
reviewerPATCH 7/24 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
@@ -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_mmstatic 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
Nicholas Piggin
reviewerPATCH 8/24 ia64: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/ia64/include/asm/mmu_context.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
arch/ia64/include/asm/mmu_context.h +4 -13
@@ -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_contextstatic 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_mmstatic 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
Nicholas Piggin
reviewerPATCH 10/24 microblaze: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- 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
@@ -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_contextstatic 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_mmstatic 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
@@ -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
Nicholas Piggin
reviewerPATCH 11/24 mips: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/mips/include/asm/mmu_context.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/mips/include/asm/mmu_context.h +4 -7
@@ -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_contextstatic 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_contextstatic 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
Nicholas Piggin
reviewerPATCH 13/24 nios2: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/nios2/include/asm/mmu_context.h | 21 ++++----------------- arch/nios2/mm/mmu_context.c | 1 + 2 files changed, 5 insertions(+), 17 deletions(-)
arch/nios2/include/asm/mmu_context.h +4 -17
@@ -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_contextstatic 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_mmvoid activate_mm (struct mm_struct *prev,struct mm_struct *next); +#include <asm-generic/mmu_context.h> +#endif /* _ASM_NIOS2_MMU_CONTEXT_H */
arch/nios2/mm/mmu_context.c +1 -0
@@ -103,6 +103,7 @@ 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_mmvoid activate_mm (struct mm_struct *prev,struct mm_struct *next) { next->context =get_new_context ();
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 15/24 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
@@ -8,16 +8,13 @@#include <asm/pgalloc.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_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -27,6 +24,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)return 0 ; } +#define destroy_context destroy_contextstatic inline void destroy_context (struct mm_struct *mm) {
@@ -72,8 +70,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_mmstatic inline void activate_mm (struct mm_struct *prev,struct mm_struct *next) {/*
@@ -91,4 +88,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
Nicholas Piggin
reviewerPATCH 16/24 powerpc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/powerpc/include/asm/mmu_context.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
arch/powerpc/include/asm/mmu_context.h +7 -15
@@ -14,7 +14,9 @@/* * Most if the context management is out of line */ +#define init_new_context init_new_contextextern int init_new_context (struct task_struct *tsk,struct mm_struct *mm); +#define destroy_context destroy_contextextern void destroy_context (struct mm_struct *mm);#ifdef CONFIG_SPAPR_TCE_IOMMU struct mm_iommu_table_group_mem_t ;
@@ -237,27 +239,15 @@ 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. -*/ -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_tlbstatic 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);
@@ -300,5 +290,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
Nicholas Piggin
reviewerPATCH 17/24 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
@@ -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_mmstatic 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 · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 18/24 s390: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/s390/include/asm/mmu_context.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/s390/include/asm/mmu_context.h +4 -5
@@ -15,6 +15,7 @@#include <asm/ctl_reg.h> #include <asm-generic/mm_hooks.h> +#define init_new_context init_new_contextstatic 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_mmstatic 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
Nicholas Piggin
reviewerPATCH 19/24 sh: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- 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
@@ -85,6 +85,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_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -121,9 +122,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
@@ -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
Nicholas Piggin
reviewerPATCH 20/24 sparc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- 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
@@ -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_contextint 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_contextvoid 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
@@ -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_contextint init_new_context (struct task_struct *tsk,struct mm_struct *mm); +#define destroy_context destroy_contextvoid 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, strspin_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
Nicholas Piggin
reviewerPATCH 21/24 um: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/um/include/asm/mmu_context.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
arch/um/include/asm/mmu_context.h +5 -7
@@ -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_mmstatic 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_contextextern int init_new_context (struct task_struct *task,struct mm_struct *mm); +#define destroy_context destroy_contextextern void destroy_context (struct mm_struct *mm); +#include <asm-generic/mmu_context.h> +#endif
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 22/24 unicore32: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/unicore32/include/asm/mmu_context.h | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
arch/unicore32/include/asm/mmu_context.h +3 -21
@@ -18,24 +18,6 @@#include <asm/cacheflush.h> #include <asm/cpu-single.h> -#define init_new_context (tsk, mm) 0 - -#define destroy_context (mm) do { } while (0) - -/* -* 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
@@ -52,9 +34,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,cpu_switch_mm (next->pgd, next); } -#define deactivate_mm (tsk, mm) do { } while (0) -#define activate_mm (prev, next) switch_mm(prev, next, NULL) -/* * We are inserting a "fake" vma for the user-accessible vector page so * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
@@ -95,4 +74,7 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,/* by default, allow everything */ return true; } + +#include <asm-generic/mmu_context.h> +#endif
Signature · 1 line
2.23.0
Nicholas Piggin
reviewercover Use asm-generic for mmu_context no-op functions
It would be nice to be able to modify these or add a hook without updating all architectures, most of which just use noops.
There was some discussion around the lazy tlb switching vs membarrier barriers that may have needed changes here to fix (addition of an exit_lazy_tlb() function). I don't know whether that's what we will end up doing, but these are the prep patches I did for it which are still a good cleanup so I would like to mege them.
All arch patches depend on patch 1. If everybody is fine with it then Arnd could merge that one in this merge window then we do the rest of them in the next window?
Thanks,
Nick
Nicholas Piggin (24):
asm-generic: add generic 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
unicore32: 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 | 16 +++--- arch/arm/include/asm/mmu_context.h | 26 ++------- arch/arm64/include/asm/mmu_context.h | 7 ++- 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 | 47 +++------------- 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/nios2/mm/mmu_context.c | 1 + arch/openrisc/include/asm/mmu_context.h | 8 ++- arch/openrisc/mm/tlb.c | 2 + arch/parisc/include/asm/mmu_context.h | 12 ++--- arch/powerpc/include/asm/mmu_context.h | 22 +++----- 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/unicore32/include/asm/mmu_context.h | 24 ++------- 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 | 57 +++++++++++++++----- include/asm-generic/nommu_context.h | 19 +++++++ 32 files changed, 170 insertions(+), 318 deletions(-) create mode 100644 include/asm-generic/nommu_context.h
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 1/24 asm-generic: add generic 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/microblaze/include/asm/mmu_context.h | 2 +- arch/sh/include/asm/mmu_context.h | 2 +- include/asm-generic/mmu_context.h | 57 +++++++++++++++++------ include/asm-generic/nommu_context.h | 19 ++++++++ 4 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 include/asm-generic/nommu_context.h
arch/microblaze/include/asm/mmu_context.h +1 -1
@@ -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
@@ -134,7 +134,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 +43 -14
87 lines not on this page · raw message
include/asm-generic/nommu_context.h new file +19 -0
@@ -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> +#include <asm-generic/mmu_context.h> + +static inline void switch_mm (struct mm_struct *prev, +struct mm_struct *next, +struct task_struct *tsk) +{ +} + +#endif /* __ASM_GENERIC_NOMMU_H */
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 9/24 m68k: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/m68k/include/asm/mmu_context.h | 47 +++++------------------------ 1 file changed, 8 insertions(+), 39 deletions(-)
arch/m68k/include/asm/mmu_context.h +8 -39
@@ -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_contextstatic inline void destroy_context (struct mm_struct *mm) {if (mm->context !=NO_CONTEXT ) {
@@ -79,19 +76,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,set_context (tsk->mm->context, next->pgd); } -/* -* After we have set current->mm to a new value, this activates -* the context for the new mm so we see the new mappings. -*/ -static inline void activate_mm (struct mm_struct *active_mm, -struct mm_struct *mm) -{ -get_mmu_context (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 +160,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_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -210,8 +195,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_mmstatic inline void activate_mm (struct mm_struct *prev_mm,struct mm_struct *next_mm) {
@@ -224,6 +208,7 @@ static inline void activate_mm(struct mm_struct *prev_mm,#include <asm/page.h> #include <asm/pgalloc.h> +#define init_new_context init_new_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -231,8 +216,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 +283,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_mmstatic inline void activate_mm (struct mm_struct *prev_mm,struct mm_struct *next_mm) {
@@ -315,24 +297,11 @@ static inline void activate_mm(struct mm_struct *prev_mm,#endif -#else /* !CONFIG_MMU */ +#include <asm-generic/mmu_context.h> -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) -{ -} - -#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
Nicholas Piggin
reviewerPATCH 12/24 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
@@ -9,6 +9,7 @@#include <asm/proc-fns.h> #include <asm-generic/mm_hooks.h> +#define init_new_context init_new_contextstatic 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 9extern 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
Nicholas Piggin
reviewerPATCH 14/24 openrisc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- arch/openrisc/include/asm/mmu_context.h | 8 +++----- arch/openrisc/mm/tlb.c | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-)
arch/openrisc/include/asm/mmu_context.h +3 -5
@@ -17,13 +17,13 @@#include <asm-generic/mm_hooks.h> +#define init_new_context init_new_contextextern int init_new_context (struct task_struct *tsk,struct mm_struct *mm); +#define destroy_context destroy_contextextern 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
arch/openrisc/mm/tlb.c +2 -0
@@ -159,6 +159,7 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next,* instance. */ +#define init_new_context init_new_contextint init_new_context (struct task_struct *tsk,struct mm_struct *mm) { mm->context =NO_CONTEXT ;
@@ -170,6 +171,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)* drops it. */ +#define destroy_context destroy_contextvoid destroy_context (struct mm_struct *mm) {flush_tlb_mm (mm);
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH 23/24 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
@@ -92,12 +92,14 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next) }#endif +#define enter_lazy_tlb enter_lazy_tlbextern 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_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -117,6 +119,8 @@ static inline int init_new_context(struct task_struct *tsk,init_new_context_ldt (mm);return 0 ; } + +#define destroy_context destroy_contextstatic inline void destroy_context (struct mm_struct *mm) {destroy_context_ldt (mm);
@@ -215,4 +219,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
Nicholas Piggin
reviewerPATCH 24/24 xtensa: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas Piggin--- 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
@@ -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_contextstatic 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_contextstatic 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
@@ -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
Re: [PATCH 03/24] arc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 7 lines · Nicholas Piggin
/*
- * Called at the time ofexecve()to get a new ASID
- * Note the subtlety here:get_new_mmu_context()behaves differently here
- * vs. inswitch_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_mmdefaults toswitch_mmand is called at the time ofexecve()to
With activate_mm() definition actually gone, perhaps add "activate_mm() comes from generic code..." to provide next reader about the "spurious looking comment"
Quoted 10 lines
+ * get a new ASID Note the subtlety here:
get_new_mmu_context()behaves
+ * differently here vs. inswitch_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
*/arch/arc/include/asm/mmu_context.h +0
-1-#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
arch/arc/include/asm/mmu_context.h static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · line 171
Quoted 4 lines
arch/arc/include/asm/mmu_context.h +0
-1@@ -168,8 +169,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)
same for deactivate_mm()
Re: [PATCH 01/24] asm-generic: add generic versions of mmu context functions
In reply to Nicholas PigginQuoted 9 lines · Nicholas Piggin
Many of these are no-ops on many architectures, so extend
mmu_context.hto cover MMU and NOMMU, and split the NOMMU bits out tonommu_context.hinclude/asm-generic/mmu_context.h +2
-3-static inline void switch_mm (struct mm_struct *prev, -struct mm_struct *next, -struct task_struct *tsk) +/** +* activate_mm - called after exec switches the current task to a new mm, to switch to it
include/asm-generic/mmu_context.h line 61
Quoted 10 lines
include/asm-generic/mmu_context.h +8
-0+* @prev_mm: previous mm of this task +* @next_mm: new mm +*/ +#ifndef activate_mm +static inline void activate_mm (struct mm_struct *prev_mm, +struct mm_struct *next_mm) { +switch_mm (prev_mm, next_mm, current); } +#endif
Is activate_mm() really needed now. It seems most arches have
activate_mm(p, n) -> switch_mm(p, n, NULL)
And if we are passing current, that can be pushed inside switch_mm()
Quoted 3 lines
include/asm-generic/mmu_context.h +0
-2-static inline void activate_mm (struct mm_struct *prev_mm, -struct mm_struct *next_mm)
Re: [PATCH 06/24] csky: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 35 lines · 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
-6@@ -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 */ --2.23.0
Signature · 4 lines
Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/
Re: [PATCH 04/24] arm: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 25 lines · Nicholas Piggin
Cc Russell King <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- arch/arm/include/asm/mmu_context.h | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)arch/arm/include/asm/mmu_context.h +2
-1@@ -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_contextstatic 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
arch/arm/include/asm/mmu_context.h static inline void finish_arch_post_lock_switch(void) · line 99
Quoted 10 lines
arch/arm/include/asm/mmu_context.h +0
-7-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)
Actually this can also go away too.
ARM switch_mm(prev, next, tsk) -> check_and_switch_context(next, tsk) but latter doesn't use @tsk at all. With patch below, you can remove above as well...
-------->
From 672e0f78a94892794057a5a7542d85b71c1369c4 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Mon, 27 Jul 2020 21:12:42 -0700
Subject: [PATCH] ARM: mm: check_and_switch_context() doesn't use @tsk arg
--- arch/arm/include/asm/efi.h | 2 +- arch/arm/include/asm/mmu_context.h | 5 ++--- arch/arm/mm/context.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-)
arch/arm/include/asm/efi.h +0 -0
@@ -37,7 +37,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm,
efi_memory_desc_t *md);
static inline void efi_set_pgd(struct mm_struct *mm) {
- check_and_switch_context(mm, NULL);
+ check_and_switch_context(mm);
}
void efi_virtmap_load(void);
arch/arm/include/asm/mmu_context.h +1 -1
@@ -25,7 +25,7 @@ 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); +void check_and_switch_context (struct mm_struct *mm);static inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {
@@ -47,8 +47,7 @@ static inline void a15_erratum_get_cpumask(int this_cpu, struct
mm_struct *mm,
#ifdef CONFIG_MMU
-static inline void check_and_switch_context(struct mm_struct *mm,
- struct task_struct *tsk)
+static inline void check_and_switch_context(struct mm_struct *mm)
{
if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
__check_vmalloc_seq(mm);
arch/arm/mm/context.c +1 -1
@@ -234,7 +234,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)return asid | generation; } -void check_and_switch_context (struct mm_struct *mm,struct task_struct *tsk) +void check_and_switch_context (struct mm_struct *mm) {unsigned long flags;unsigned int cpu =smp_processor_id ();
Signature · 1 line
2.20.1
kernel test robot
build botRe: [PATCH 01/24] asm-generic: add generic versions of mmu context functions
In reply to Nicholas PigginI love your patch! Yet something to improve:
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on openrisc/for-next]
[also build test ERROR on sparc/master linus/master asm-generic/master v5.8-rc7 next-20200727] [cannot apply to nios2/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200728-113854 base: https://github.com/openrisc/linux.git for-next config: c6x-allyesconfig (attached as .config) compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from ./arch/c6x/include/generated/asm/mmu_context.h:1,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/core.c:9:
include/asm-generic/mmu_context.h: In function 'activate_mm':
>> include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from ./arch/c6x/include/generated/asm/mmu_context.h:1,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/rt.c:6:
include/asm-generic/mmu_context.h: In function 'activate_mm':
>> include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~ kernel//sched/rt.c: At top level:
kernel//sched/rt.c:668:6: warning: no previous prototype for 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
668 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/switch_mm +59 include/asm-generic/mmu_context.h
49
50 /**
51 * activate_mm - called after exec switches the current task to a new mm, to switch to it
52 * @prev_mm: previous mm of this task
53 * @next_mm: new mm
54 */
55 #ifndef activate_mm
56 static inline void activate_mm(struct mm_struct *prev_mm,
57 struct mm_struct *next_mm)
58 {
> 59 switch_mm(prev_mm, next_mm, current);
60 }
61 #endif
62 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Nicholas Piggin
reviewerRe: [PATCH 01/24] asm-generic: add generic versions of mmu context functions
In reply to Vineet GuptaExcerpts from Vineet Gupta's message of July 28, 2020 2:01 pm:
Quoted 24 lines · Nicholas Piggin
Quoted 9 lines
Many of these are no-ops on many architectures, so extend
mmu_context.hto cover MMU and NOMMU, and split the NOMMU bits out tonommu_context.hinclude/asm-generic/mmu_context.h +2
-3-static inline void switch_mm (struct mm_struct *prev, -struct mm_struct *next, -struct task_struct *tsk) +/** +* activate_mm - called after exec switches the current task to a new mm, to switch to it include/asm-generic/mmu_context.h line 61
Quoted 10 lines
include/asm-generic/mmu_context.h +8
-0+* @prev_mm: previous mm of this task +* @next_mm: new mm +*/ +#ifndef activate_mm +static inline void activate_mm (struct mm_struct *prev_mm, +struct mm_struct *next_mm) { +switch_mm (prev_mm, next_mm, current); } +#endif Is
activate_mm()really needed now. It seems most arches have
activate_mm(p, n)->switch_mm(p, n, NULL)
Quoted 1 line
And if we are passing current, that can be pushed inside
switch_mm()
Thanks for taking a look, I think there may be more consolidation like this possible, and certainly some of the arch patches could have gone a bit further.
I wanted to be fairly careful to make only quite trivial changes (only the obvious no-ops) for the first iteration, but once this is in the tree it should become a fair bit easier to do some of your suggestions.
There's a few things that make activate_mm->switch_mm not quite simple - alpha, nios2, parisc, s390, maybe x86.
Thanks,
Nick
Re: [PATCH 23/24] x86: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 6 lines · Nicholas Piggin
Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
Quoted 42 lines
--- arch/x86/include/asm/mmu_context.h | 6 ++++++ 1 file changed, 6 insertions(+)arch/x86/include/asm/mmu_context.h +6
-0@@ -92,12 +92,14 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next) }#endif +#define enter_lazy_tlb enter_lazy_tlbextern 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_contextstatic inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {@@ -117,6 +119,8 @@ static inline int init_new_context(struct task_struct *tsk,init_new_context_ldt (mm);return 0 ; } + +#define destroy_context destroy_contextstatic inline void destroy_context (struct mm_struct *mm) {destroy_context_ldt (mm);@@ -215,4 +219,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
kernel test robot
build botRe: [PATCH 01/24] asm-generic: add generic versions of mmu context functions
In reply to Nicholas PigginI love your patch! Yet something to improve:
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on openrisc/for-next]
[also build test ERROR on sparc-next/master sparc/master linus/master asm-generic/master xtensa/for_next v5.8-rc7 next-20200728] [cannot apply to nios2/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200728-113854 base: https://github.com/openrisc/linux.git for-next config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/process_32.c:26:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/process_32.c:26:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: error: conflicting types for 'switch_mm' [-Werror]
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/process_32.c:26:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
cc1: all warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/setup.c:44:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/setup.c:44:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: error: conflicting types for 'switch_mm' [-Werror]
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/setup.c:44:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
arch/sh/kernel/setup.c:248:12: error: no previous prototype for 'sh_fdt_init' [-Werror=missing-prototypes]
248 | void __ref sh_fdt_init(phys_addr_t dt_phys)
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/hw_breakpoint.c:21:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/hw_breakpoint.c:21:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: error: conflicting types for 'switch_mm' [-Werror]
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/hw_breakpoint.c:21:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~ arch/sh/kernel/hw_breakpoint.c:135:5: error: no previous prototype for 'arch_bp_generic_fields' [-Werror=missing-prototypes]
135 | int arch_bp_generic_fields(int sh_len, int sh_type,
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/cpu/init.c:14:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/cpu/init.c:14:
include/asm-generic/nommu_context.h: At top level:
>> include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from arch/sh/kernel/cpu/init.c:14:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
arch/sh/kernel/cpu/init.c:99:29: warning: no previous prototype for 'l2_cache_init' [-Wmissing-prototypes]
99 | void __attribute__ ((weak)) l2_cache_init(void)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from kernel/fork.c:101:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from kernel/fork.c:101:
include/asm-generic/nommu_context.h: At top level:
>> include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from kernel/fork.c:101:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from kernel/exit.c:69:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from kernel/exit.c:69:
include/asm-generic/nommu_context.h: At top level:
>> include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from kernel/exit.c:69:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
kernel/exit.c:1714:13: warning: no previous prototype for 'abort' [-Wmissing-prototypes]
1714 | __weak void abort(void)
| ^~~~~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from include/linux/mmu_context.h:5,
from kernel/sched/sched.h:54,
from kernel/sched/rt.c:6:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from include/linux/mmu_context.h:5,
from kernel/sched/sched.h:54,
from kernel/sched/rt.c:6:
include/asm-generic/nommu_context.h: At top level:
>> include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from include/linux/mmu_context.h:5,
from kernel/sched/sched.h:54,
from kernel/sched/rt.c:6:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~ kernel/sched/rt.c:668:6: warning: no previous prototype for 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
668 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from mm/nommu.c:43:
include/asm-generic/mmu_context.h: In function 'activate_mm':
include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/sh/include/asm/mmu_context.h:137,
from mm/nommu.c:43:
include/asm-generic/nommu_context.h: At top level:
>> include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
>> include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/sh/include/asm/mmu_context.h:137,
from mm/nommu.c:43:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~ mm/nommu.c:1665:15: warning: no previous prototype for 'arch_get_unmapped_area' [-Wmissing-prototypes]
1665 | unsigned long arch_get_unmapped_area(struct file *file, unsigned long addr,
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/switch_mm +13 include/asm-generic/nommu_context.h
12
> 13 static inline void switch_mm(struct mm_struct *prev,
14 struct mm_struct *next,
15 struct task_struct *tsk)
16 {
17 }
18 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Stafford Horne
maintainerRe: [PATCH 14/24] openrisc: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 31 lines · Nicholas Piggin
Cc Jonas Bonn <[email protected]>Cc Stefan Kristiansson <[email protected]>Cc Stafford Horne <[email protected]>Cc openrisc at lists.librecores.orgSigned-off-by Nicholas Piggin <[email protected]>--- arch/openrisc/include/asm/mmu_context.h | 8 +++----- arch/openrisc/mm/tlb.c | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-)arch/openrisc/include/asm/mmu_context.h +2
-2@@ -17,13 +17,13 @@#include <asm-generic/mm_hooks.h> +#define init_new_context init_new_contextextern int init_new_context (struct task_struct *tsk,struct mm_struct *mm); +#define destroy_context destroy_contextextern 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
arch/openrisc/include/asm/mmu_context.h extern void switch_mm(struct mm_struct *prev, struct mm_struct *next, · line 35
Quoted 7 lines
arch/openrisc/include/asm/mmu_context.h +1
-3@@ -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>
This looks ok.
Quoted 14 lines
arch/openrisc/include/asm/mmu_context.h +0
-0#endif arch/openrisc/mm/tlb.c +1
-0@@ -159,6 +159,7 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next,* instance. */ +#define init_new_context init_new_contextint init_new_context (struct task_struct *tsk,struct mm_struct *mm) { mm->context =NO_CONTEXT ;
arch/openrisc/mm/tlb.c int init_new_context(struct task_struct *tsk, struct mm_struct *mm) · line 177
Quoted 7 lines
arch/openrisc/mm/tlb.c +1
-0@@ -170,6 +171,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)* drops it. */ +#define destroy_context destroy_contextvoid destroy_context (struct mm_struct *mm) {flush_tlb_mm (mm);
I don't think we need the #define's in the .c file. Do we?
-Stafford
Quoted 3 lines
Signature · 1 line
2.23.0
kernel test robot
build botRe: [PATCH 09/24] m68k: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginI love your patch! Yet something to improve:
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on openrisc/for-next]
[also build test ERROR on sparc-next/master sparc/master linus/master asm-generic/master v5.8-rc7 next-20200729] [cannot apply to nios2/for-linus xtensa/for_next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200728-113854 base: https://github.com/openrisc/linux.git for-next config: m68k-randconfig-r005-20200729 (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:5,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/m68k/include/asm/current.h:16,
from include/linux/sched.h:12,
from kernel//sched/sched.h:5,
from kernel//sched/core.c:9:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra]
33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/core.c:9:
include/asm-generic/mmu_context.h: In function 'activate_mm':
>> include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/core.c:9:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/core.c:9:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
kernel//sched/core.c: In function 'ttwu_stat':
kernel//sched/core.c:2154:13: warning: variable 'rq' set but not used [-Wunused-but-set-variable]
2154 | struct rq *rq;
| ^~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/bug.h:5,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/m68k/include/asm/current.h:16,
from include/linux/sched.h:12,
from kernel//sched/sched.h:5,
from kernel//sched/loadavg.c:9:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra]
33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/loadavg.c:9:
include/asm-generic/mmu_context.h: In function 'activate_mm':
>> include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/loadavg.c:9:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/loadavg.c:9:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/asm-generic/bug.h:5,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/m68k/include/asm/current.h:16,
from include/linux/sched.h:12,
from kernel//sched/sched.h:5,
from kernel//sched/rt.c:6:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra]
33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/rt.c:6:
include/asm-generic/mmu_context.h: In function 'activate_mm':
>> include/asm-generic/mmu_context.h:59:2: error: implicit declaration of function 'switch_mm' [-Werror=implicit-function-declaration]
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~
In file included from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/rt.c:6:
include/asm-generic/nommu_context.h: At top level:
include/asm-generic/nommu_context.h:13:20: warning: conflicting types for 'switch_mm'
13 | static inline void switch_mm(struct mm_struct *prev,
| ^~~~~~~~~
include/asm-generic/nommu_context.h:13:20: error: static declaration of 'switch_mm' follows non-static declaration
In file included from include/asm-generic/nommu_context.h:11,
from arch/m68k/include/asm/mmu_context.h:304,
from include/linux/mmu_context.h:5,
from kernel//sched/sched.h:54,
from kernel//sched/rt.c:6:
include/asm-generic/mmu_context.h:59:2: note: previous implicit declaration of 'switch_mm' was here
59 | switch_mm(prev_mm, next_mm, current);
| ^~~~~~~~~ kernel//sched/rt.c:668:6: warning: no previous prototype for 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
668 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/switch_mm +59 include/asm-generic/mmu_context.h
5c01b46bb6bb8f2 Arnd Bergmann 2009-05-13 49
49435c52fb90a3c Nicholas Piggin 2020-07-28 50 /**
49435c52fb90a3c Nicholas Piggin 2020-07-28 51 * activate_mm - called after exec switches the current task to a new mm, to switch to it
49435c52fb90a3c Nicholas Piggin 2020-07-28 52 * @prev_mm: previous mm of this task
49435c52fb90a3c Nicholas Piggin 2020-07-28 53 * @next_mm: new mm
49435c52fb90a3c Nicholas Piggin 2020-07-28 54 */
49435c52fb90a3c Nicholas Piggin 2020-07-28 55 #ifndef activate_mm
49435c52fb90a3c Nicholas Piggin 2020-07-28 56 static inline void activate_mm(struct mm_struct *prev_mm,
49435c52fb90a3c Nicholas Piggin 2020-07-28 57 struct mm_struct *next_mm)
5c01b46bb6bb8f2 Arnd Bergmann 2009-05-13 58 {
49435c52fb90a3c Nicholas Piggin 2020-07-28 @59 switch_mm(prev_mm, next_mm, current);
5c01b46bb6bb8f2 Arnd Bergmann 2009-05-13 60 }
49435c52fb90a3c Nicholas Piggin 2020-07-28 61 #endif5c01b46bb6bb8f2 Arnd Bergmann 2009-05-13 62
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Re: [PATCH 17/24] riscv: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 40 lines · On Mon, 27 Jul 2020 20:33:58 PDT (-0700), [email protected] wrote:
Cc Paul Walmsley <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Albert Ou <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- arch/riscv/include/asm/mmu_context.h | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)arch/riscv/include/asm/mmu_context.h +1
-16@@ -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_mmstatic inline void activate_mm (struct mm_struct *prev,struct mm_struct *next) {
arch/riscv/include/asm/mmu_context.h line 28
Quoted 10 lines
arch/riscv/include/asm/mmu_context.h +1
-4switch_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 */
I'm assuming this is going in along with the others. Thanks!
RE: [PATCH 07/24] hexagon: use asm-generic/mmu_context.h for no-op implementations
In reply to Nicholas PigginQuoted 4 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Nicholas Piggin
Quoted 72 lines
Cc Brian Cain <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- arch/hexagon/include/asm/mmu_context.h | 33 ++++---------------------- 1 file changed, 5 insertions(+), 28 deletions(-)arch/hexagon/include/asm/mmu_context.h +2
-17@@ -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
- */arch/hexagon/include/asm/mmu_context.h +1
-6-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_mmstatic inline void activate_mm (struct mm_struct *prev,struct mm_struct *next) {arch/hexagon/include/asm/mmu_context.h +0
-0unsigned 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>arch/hexagon/include/asm/mmu_context.h +2
-1+#include <asm-generic/mmu_context.h> +#endif --2.23.0
Nicholas Piggin
reviewerRe: [PATCH 01/24] asm-generic: add generic versions of mmu context functions
In reply to Vineet GuptaExcerpts from Vineet Gupta's message of July 28, 2020 2:01 pm:
Quoted 15 lines · Nicholas Piggin
Quoted 14 lines
Many of these are no-ops on many architectures, so extend
mmu_context.hto cover MMU and NOMMU, and split the NOMMU bits out tonommu_context.hinclude/asm-generic/mmu_context.h +7
-3-static inline void switch_mm (struct mm_struct *prev, -struct mm_struct *next, -struct task_struct *tsk) +/** +* activate_mm - called after exec switches the current task to a new mm, to switch to it +* @prev_mm: previous mm of this task +* @next_mm: new mm +*/ +#ifndef activate_mm +static inline void activate_mm(struct mm_struct *prev_mm,
Quoted 8 lines
include/asm-generic/mmu_context.h line 61
Quoted 5 lines
include/asm-generic/mmu_context.h +3
-0+ struct mm_struct *next_mm) { +switch_mm (prev_mm, next_mm, current); } +#endif Is
activate_mm()really needed now. It seems most arches have
activate_mm(p, n)->switch_mm(p, n, NULL)
Alpha, nios2, parisc, s390, um, x86 have non-trivial differences, so it seems to be still needed.
Thanks,
Nick
Nicholas Piggin
reviewerRe: [PATCH 04/24] arm: use asm-generic/mmu_context.h for no-op implementations
In reply to Vineet GuptaExcerpts from Vineet Gupta's message of July 28, 2020 2:14 pm:
Quoted 34 lines · Nicholas Piggin
Quoted 33 lines
Cc Russell King <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- arch/arm/include/asm/mmu_context.h | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)arch/arm/include/asm/mmu_context.h +2
-7@@ -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_contextstatic 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 */
Quoted 7 lines
arch/arm/include/asm/mmu_context.h static inline void finish_arch_post_lock_switch(void) · line 99
Quoted 2 lines
arch/arm/include/asm/mmu_context.h +0
-1-#define destroy_context (mm) do { } while(0)#define activate_mm (prev,next) switch_mm(prev, next, NULL)Actually this can also go away too.
ARM
switch_mm(prev, next, tsk)->check_and_switch_context(next, tsk)but latter doesn't use @tsk at all. With patch below, you can remove above as well...
Thanks for reviewing. I did notice that might be possible but I was avoiding any change that wasn't completely trivial. It's a good point to continue consolidating and simplifying though.
Thanks,
Nick
Quoted 69 lines
-------->
From672e0f78a94892794057a5a7542d85b71c1369c4Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Mon, 27 Jul 2020 21:12:42 -0700
Subject: [PATCH] ARM: mm:check_and_switch_context()doesn't use @tsk argSigned-off-by Vineet Gupta <[email protected]>--- arch/arm/include/asm/efi.h | 2 +- arch/arm/include/asm/mmu_context.h | 5 ++--- arch/arm/mm/context.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-)arch/arm/include/asm/efi.h +1
-1@@ -37,7 +37,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);static inline void efi_set_pgd (struct mm_struct *mm) { -check_and_switch_context (mm,NULL ); +check_and_switch_context (mm); }void
efi_virtmap_load(void);arch/arm/include/asm/mmu_context.h +2
-3@@ -25,7 +25,7 @@ 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); +void check_and_switch_context (struct mm_struct *mm);static inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) {@@ -47,8 +47,7 @@ static inline void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,#ifdef CONFIG_MMU -static inline void check_and_switch_context (struct mm_struct *mm, -struct task_struct *tsk) +static inline void check_and_switch_context (struct mm_struct *mm) {if (unlikely (mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))arch/arm/include/asm/mmu_context.h +0
-0__check_vmalloc_seq (mm);arch/arm/mm/context.c +1
-1@@ -234,7 +234,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)return asid | generation; } -void check_and_switch_context (struct mm_struct *mm,struct task_struct *tsk) +void check_and_switch_context (struct mm_struct *mm) {unsigned long flags;unsigned int cpu =smp_processor_id ();Signature · 1 line
2.20.1
Nicholas Piggin
reviewerRe: [PATCH 14/24] openrisc: use asm-generic/mmu_context.h for no-op implementations
In reply to Stafford HorneExcerpts from Stafford Horne's message of July 29, 2020 9:45 pm:
Quoted 59 lines · Nicholas Piggin
Quoted 31 lines
Cc Jonas Bonn <[email protected]>Cc Stefan Kristiansson <[email protected]>Cc Stafford Horne <[email protected]>Cc openrisc at lists.librecores.orgSigned-off-by Nicholas Piggin <[email protected]>--- arch/openrisc/include/asm/mmu_context.h | 8 +++----- arch/openrisc/mm/tlb.c | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-)arch/openrisc/include/asm/mmu_context.h +2
-2@@ -17,13 +17,13 @@#include <asm-generic/mm_hooks.h> +#define init_new_context init_new_contextextern int init_new_context (struct task_struct *tsk,struct mm_struct *mm); +#define destroy_context destroy_contextextern 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 arch/openrisc/include/asm/mmu_context.h extern void switch_mm(struct mm_struct *prev, struct mm_struct *next, · line 35
Quoted 7 lines
arch/openrisc/include/asm/mmu_context.h +1
-3@@ -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> This looks ok.
Quoted 17 lines
arch/openrisc/include/asm/mmu_context.h +0
-0#endif arch/openrisc/mm/tlb.c +1
-0@@ -159,6 +159,7 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next,* instance. */ +#define init_new_context init_new_contextint init_new_context (struct task_struct *tsk,struct mm_struct *mm) { mm->context =NO_CONTEXT ;@@ -170,6 +171,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)* drops it. */
Quoted 6 lines
arch/openrisc/mm/tlb.c int init_new_context(struct task_struct *tsk, struct mm_struct *mm) · line 177
Quoted 4 lines
arch/openrisc/mm/tlb.c +1
-0+#define destroy_context destroy_contextvoid destroy_context (struct mm_struct *mm) {flush_tlb_mm (mm);I don't think we need the #define's in the .c file. Do we?
You're right, I fixed that and the same issue in another arch.
Thanks,
Nick