diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-11-18 13:23:49 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-11-19 05:54:13 -0500 |
commit | a1ea1c032b8f8c23d86ef4db6d061527e9417f19 (patch) | |
tree | e66aa84c5b7fde33207e251675ff119ac77be6b5 | |
parent | 68c009c4137927fd4ffd3e653bb5209d752c1d42 (diff) |
x86: Cleanly separate use of asm-generic/mm_hooks.h
asm-generic/mm_hooks.h provides some generic fillers for the 90%
of architectures that do not need to hook some mmap-manipulation
functions. A comment inside says:
> Define generic no-op hooks for arch_dup_mmap and
> arch_exit_mmap, to be included in asm-FOO/mmu_context.h
> for any arch FOO which doesn't need to hook these.
So, does x86 need to hook these? It depends on CONFIG_PARAVIRT.
We *conditionally* include this generic header if we have
CONFIG_PARAVIRT=n. That's madness.
With this patch, x86 stops using asm-generic/mmu_hooks.h entirely.
We use our own copies of the functions. The paravirt code
provides some stubs if it is disabled, and we always call those
stubs in our x86-private versions of arch_exit_mmap() and
arch_dup_mmap().
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/20141118182349.14567FA5@viggo.jf.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/include/asm/mmu_context.h | 13 | ||||
-rw-r--r-- | arch/x86/include/asm/paravirt.h | 16 |
2 files changed, 24 insertions, 5 deletions
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 00d4575d5409..be91d5736e08 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <asm/paravirt.h> | 12 | #include <asm/paravirt.h> |
13 | #include <asm/mpx.h> | 13 | #include <asm/mpx.h> |
14 | #ifndef CONFIG_PARAVIRT | 14 | #ifndef CONFIG_PARAVIRT |
15 | #include <asm-generic/mm_hooks.h> | ||
16 | |||
17 | static inline void paravirt_activate_mm(struct mm_struct *prev, | 15 | static inline void paravirt_activate_mm(struct mm_struct *prev, |
18 | struct mm_struct *next) | 16 | struct mm_struct *next) |
19 | { | 17 | { |
@@ -103,6 +101,17 @@ do { \ | |||
103 | } while (0) | 101 | } while (0) |
104 | #endif | 102 | #endif |
105 | 103 | ||
104 | static inline void arch_dup_mmap(struct mm_struct *oldmm, | ||
105 | struct mm_struct *mm) | ||
106 | { | ||
107 | paravirt_arch_dup_mmap(oldmm, mm); | ||
108 | } | ||
109 | |||
110 | static inline void arch_exit_mmap(struct mm_struct *mm) | ||
111 | { | ||
112 | paravirt_arch_exit_mmap(mm); | ||
113 | } | ||
114 | |||
106 | static inline void arch_bprm_mm_init(struct mm_struct *mm, | 115 | static inline void arch_bprm_mm_init(struct mm_struct *mm, |
107 | struct vm_area_struct *vma) | 116 | struct vm_area_struct *vma) |
108 | { | 117 | { |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index cd6e1610e29e..32444ae939ca 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -330,13 +330,13 @@ static inline void paravirt_activate_mm(struct mm_struct *prev, | |||
330 | PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next); | 330 | PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next); |
331 | } | 331 | } |
332 | 332 | ||
333 | static inline void arch_dup_mmap(struct mm_struct *oldmm, | 333 | static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm, |
334 | struct mm_struct *mm) | 334 | struct mm_struct *mm) |
335 | { | 335 | { |
336 | PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm); | 336 | PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm); |
337 | } | 337 | } |
338 | 338 | ||
339 | static inline void arch_exit_mmap(struct mm_struct *mm) | 339 | static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) |
340 | { | 340 | { |
341 | PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm); | 341 | PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm); |
342 | } | 342 | } |
@@ -986,5 +986,15 @@ extern void default_banner(void); | |||
986 | #endif /* __ASSEMBLY__ */ | 986 | #endif /* __ASSEMBLY__ */ |
987 | #else /* CONFIG_PARAVIRT */ | 987 | #else /* CONFIG_PARAVIRT */ |
988 | # define default_banner x86_init_noop | 988 | # define default_banner x86_init_noop |
989 | #ifndef __ASSEMBLY__ | ||
990 | static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm, | ||
991 | struct mm_struct *mm) | ||
992 | { | ||
993 | } | ||
994 | |||
995 | static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) | ||
996 | { | ||
997 | } | ||
998 | #endif /* __ASSEMBLY__ */ | ||
989 | #endif /* !CONFIG_PARAVIRT */ | 999 | #endif /* !CONFIG_PARAVIRT */ |
990 | #endif /* _ASM_X86_PARAVIRT_H */ | 1000 | #endif /* _ASM_X86_PARAVIRT_H */ |