linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: tglx@linutronix.de
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Dave Hansen <dave@sr71.net>,
	dave.hansen@linux.intel.com
Subject: [PATCH 2/3] x86: cleanly separate use of asm-generic/mm_hooks.h
Date: Tue, 18 Nov 2014 10:23:49 -0800	[thread overview]
Message-ID: <20141118182349.14567FA5@viggo.jf.intel.com> (raw)
In-Reply-To: <20141118182342.64D1B3A5@viggo.jf.intel.com>


From: Dave Hansen <dave.hansen@linux.intel.com>

asm-generic/mm_hooks.h provides some generic fillers for the 90%
of architectures that do not need to hook some mmap-mainipulation
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: x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
---

 b/arch/x86/include/asm/mmu_context.h |   13 +++++++++++--
 b/arch/x86/include/asm/paravirt.h    |   16 +++++++++++++---
 2 files changed, 24 insertions(+), 5 deletions(-)

diff -puN arch/x86/include/asm/mmu_context.h~dmess-x86-mmu_hooks arch/x86/include/asm/mmu_context.h
--- a/arch/x86/include/asm/mmu_context.h~dmess-x86-mmu_hooks	2014-11-18 09:14:18.998070191 -0800
+++ b/arch/x86/include/asm/mmu_context.h	2014-11-18 09:14:19.002070371 -0800
@@ -12,8 +12,6 @@
 #include <asm/paravirt.h>
 #include <asm/mpx.h>
 #ifndef CONFIG_PARAVIRT
-#include <asm-generic/mm_hooks.h>
-
 static inline void paravirt_activate_mm(struct mm_struct *prev,
 					struct mm_struct *next)
 {
@@ -103,6 +101,17 @@ do {						\
 } while (0)
 #endif
 
+static inline void arch_dup_mmap(struct mm_struct *oldmm,
+				 struct mm_struct *mm)
+{
+	paravirt_arch_dup_mmap(oldmm, mm);
+}
+
+static inline void arch_exit_mmap(struct mm_struct *mm)
+{
+	paravirt_arch_exit_mmap(mm);
+}
+
 static inline void arch_bprm_mm_init(struct mm_struct *mm,
 		struct vm_area_struct *vma)
 {
diff -puN arch/x86/include/asm/paravirt.h~dmess-x86-mmu_hooks arch/x86/include/asm/paravirt.h
--- a/arch/x86/include/asm/paravirt.h~dmess-x86-mmu_hooks	2014-11-18 09:14:18.999070236 -0800
+++ b/arch/x86/include/asm/paravirt.h	2014-11-18 09:14:19.003070416 -0800
@@ -330,13 +330,13 @@ static inline void paravirt_activate_mm(
 	PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next);
 }
 
-static inline void arch_dup_mmap(struct mm_struct *oldmm,
-				 struct mm_struct *mm)
+static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,
+					  struct mm_struct *mm)
 {
 	PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm);
 }
 
-static inline void arch_exit_mmap(struct mm_struct *mm)
+static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
 {
 	PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm);
 }
@@ -986,5 +986,15 @@ extern void default_banner(void);
 #endif /* __ASSEMBLY__ */
 #else  /* CONFIG_PARAVIRT */
 # define default_banner x86_init_noop
+#ifndef __ASSEMBLY__
+static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,
+					  struct mm_struct *mm)
+{
+}
+
+static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
+{
+}
+#endif /* __ASSEMBLY__ */
 #endif /* !CONFIG_PARAVIRT */
 #endif /* _ASM_X86_PARAVIRT_H */
_

  parent reply	other threads:[~2014-11-18 18:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 18:23 [PATCH 0/3] x86: MPX fixes for tip Dave Hansen
2014-11-18 18:23 ` [PATCH 1/3] x86 mpx: change return type of get_reg_offset() Dave Hansen
2014-11-19 10:57   ` [tip:x86/mpx] x86 mpx: Change " tip-bot for Dave Hansen
2014-11-18 18:23 ` Dave Hansen [this message]
2014-11-19 10:57   ` [tip:x86/mpx] x86: Cleanly separate use of asm-generic/mm_hooks.h tip-bot for Dave Hansen
2014-11-18 18:23 ` [PATCH 3/3] make arch_unmap()/etc... available to all architectures Dave Hansen
2014-11-19 10:58   ` [tip:x86/mpx] mm: Make arch_unmap()/bprm_mm_init() " tip-bot for Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141118182349.14567FA5@viggo.jf.intel.com \
    --to=dave@sr71.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).