linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] generic asm: mman cleanup
@ 2019-02-08  6:02 Michael S. Tsirkin
  2019-02-08  6:02 ` [PATCH 1/3] x86/mpx: tweak header name Michael S. Tsirkin
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08  6:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Arnd Bergmann

Now that we have MAP_SHARED, MAP_PRIVATE and MAP_SHARED_VALIDATE on all
architectures, it probably makes sense to de-duplicate these
and put them into a common header.

Please review and consider merging though the generic tree.

Build tested on x86 only. Has been in linux-next for a while now.

Michael S. Tsirkin (3):
  x86/mpx: tweak header name
  drm: tweak header name
  arch: move common mmap flags to linux/mman.h

 arch/alpha/include/uapi/asm/mman.h     | 4 +---
 arch/mips/include/uapi/asm/mman.h      | 4 +---
 arch/parisc/include/uapi/asm/mman.h    | 4 +---
 arch/x86/mm/mpx.c                      | 2 +-
 arch/xtensa/include/uapi/asm/mman.h    | 4 +---
 include/drm/drmP.h                     | 3 +--
 include/uapi/asm-generic/mman-common.h | 4 +---
 include/uapi/linux/mman.h              | 4 ++++
 8 files changed, 11 insertions(+), 18 deletions(-)

-- 
MST


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
@ 2019-02-08  6:02 ` Michael S. Tsirkin
  2019-02-08 15:42   ` Borislav Petkov
  2019-02-08  6:02 ` [PATCH 2/2] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08  6:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Arnd Bergmann, Dave Hansen, Andy Lutomirski,
	Peter Zijlstra, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, x86

Use linux/mman.h to make sure we get all mmap flags we need.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/x86/mm/mpx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
index de1851d15699..c805db6236b4 100644
--- a/arch/x86/mm/mpx.c
+++ b/arch/x86/mm/mpx.c
@@ -9,12 +9,12 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/mm_types.h>
+#include <linux/mman.h>
 #include <linux/syscalls.h>
 #include <linux/sched/sysctl.h>
 
 #include <asm/insn.h>
 #include <asm/insn-eval.h>
-#include <asm/mman.h>
 #include <asm/mmu_context.h>
 #include <asm/mpx.h>
 #include <asm/processor.h>
-- 
MST


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] arch: move common mmap flags to linux/mman.h
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
  2019-02-08  6:02 ` [PATCH 1/3] x86/mpx: tweak header name Michael S. Tsirkin
@ 2019-02-08  6:02 ` Michael S. Tsirkin
  2019-02-08  6:02 ` [PATCH 2/3] drm: tweak header name Michael S. Tsirkin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08  6:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Arnd Bergmann, Richard Henderson, Ivan Kokshaysky,
	Matt Turner, Ralf Baechle, Paul Burton, James Hogan,
	James E.J. Bottomley, Helge Deller, Chris Zankel, Max Filippov,
	linux-alpha, linux-mips, linux-parisc, linux-xtensa

Now that we have 3 mmap flags shared by all architectures,
let's move them into the common header.

This will help discourage future architectures from duplicating code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/alpha/include/uapi/asm/mman.h     | 4 +---
 arch/mips/include/uapi/asm/mman.h      | 4 +---
 arch/parisc/include/uapi/asm/mman.h    | 4 +---
 arch/xtensa/include/uapi/asm/mman.h    | 4 +---
 include/uapi/asm-generic/mman-common.h | 4 +---
 include/uapi/linux/mman.h              | 4 ++++
 6 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h
index f9d4e6b6d4bd..ac23379b7a87 100644
--- a/arch/alpha/include/uapi/asm/mman.h
+++ b/arch/alpha/include/uapi/asm/mman.h
@@ -10,9 +10,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x0f		/* Mask for type of mapping (OSF/1 is _wrong_) */
 #define MAP_FIXED	0x100		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x10		/* don't use a file */
diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
index 3035ca499cd8..c2b40969eb1f 100644
--- a/arch/mips/include/uapi/asm/mman.h
+++ b/arch/mips/include/uapi/asm/mman.h
@@ -27,9 +27,7 @@
 /*
  * Flags for mmap
  */
-#define MAP_SHARED	0x001		/* Share changes */
-#define MAP_PRIVATE	0x002		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x003	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x00f		/* Mask for type of mapping */
 #define MAP_FIXED	0x010		/* Interpret addr exactly */
 
diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 870fbf8c7088..c98162f494db 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -10,9 +10,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x2b		/* Mask for type of mapping, includes bits 0x08 and 0x20 */
 #define MAP_FIXED	0x04		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x10		/* don't use a file */
diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
index 58f29a9d895d..be726062412b 100644
--- a/arch/xtensa/include/uapi/asm/mman.h
+++ b/arch/xtensa/include/uapi/asm/mman.h
@@ -34,9 +34,7 @@
 /*
  * Flags for mmap
  */
-#define MAP_SHARED	0x001		/* Share changes */
-#define MAP_PRIVATE	0x002		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x003	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x00f		/* Mask for type of mapping */
 #define MAP_FIXED	0x010		/* Interpret addr exactly */
 
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index e7ee32861d51..abd238d0f7a4 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -15,9 +15,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x0f		/* Mask for type of mapping */
 #define MAP_FIXED	0x10		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x20		/* don't use a file */
diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h
index d0f515d53299..fc1a64c3447b 100644
--- a/include/uapi/linux/mman.h
+++ b/include/uapi/linux/mman.h
@@ -12,6 +12,10 @@
 #define OVERCOMMIT_ALWAYS		1
 #define OVERCOMMIT_NEVER		2
 
+#define MAP_SHARED	0x01		/* Share changes */
+#define MAP_PRIVATE	0x02		/* Changes are private */
+#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+
 /*
  * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
  * size other than the default is desired.  See hugetlb_encode.h.
-- 
MST


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] drm: tweak header name
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
  2019-02-08  6:02 ` [PATCH 1/3] x86/mpx: tweak header name Michael S. Tsirkin
  2019-02-08  6:02 ` [PATCH 2/2] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
@ 2019-02-08  6:02 ` Michael S. Tsirkin
  2019-02-08  8:56   ` Daniel Vetter
  2019-02-08  6:03 ` [PATCH 3/3] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08  6:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Airlie, Daniel Vetter, dri-devel

Use linux/mman.h to make sure we get all mmap flags we need.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/drm/drmP.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index bdb0d5548f39..a3184416ddc5 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -57,8 +57,7 @@
 #include <linux/workqueue.h>
 #include <linux/dma-fence.h>
 #include <linux/module.h>
-
-#include <asm/mman.h>
+#include <linux/mman.h>
 #include <asm/pgalloc.h>
 #include <linux/uaccess.h>
 
-- 
MST


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] arch: move common mmap flags to linux/mman.h
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2019-02-08  6:02 ` [PATCH 2/3] drm: tweak header name Michael S. Tsirkin
@ 2019-02-08  6:03 ` Michael S. Tsirkin
  2019-02-08 18:12 ` [PATCH 0/3] generic asm: mman cleanup Mike Rapoport
  2019-02-11  4:20 ` Michael S. Tsirkin
  5 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08  6:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Arnd Bergmann, Richard Henderson, Ivan Kokshaysky,
	Matt Turner, Ralf Baechle, Paul Burton, James Hogan,
	James E.J. Bottomley, Helge Deller, Chris Zankel, Max Filippov,
	linux-alpha, linux-mips, linux-parisc, linux-xtensa

Now that we have 3 mmap flags shared by all architectures,
let's move them into the common header.

This will help discourage future architectures from duplicating code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/alpha/include/uapi/asm/mman.h     | 4 +---
 arch/mips/include/uapi/asm/mman.h      | 4 +---
 arch/parisc/include/uapi/asm/mman.h    | 4 +---
 arch/xtensa/include/uapi/asm/mman.h    | 4 +---
 include/uapi/asm-generic/mman-common.h | 4 +---
 include/uapi/linux/mman.h              | 4 ++++
 6 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h
index f9d4e6b6d4bd..ac23379b7a87 100644
--- a/arch/alpha/include/uapi/asm/mman.h
+++ b/arch/alpha/include/uapi/asm/mman.h
@@ -10,9 +10,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x0f		/* Mask for type of mapping (OSF/1 is _wrong_) */
 #define MAP_FIXED	0x100		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x10		/* don't use a file */
diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
index 3035ca499cd8..c2b40969eb1f 100644
--- a/arch/mips/include/uapi/asm/mman.h
+++ b/arch/mips/include/uapi/asm/mman.h
@@ -27,9 +27,7 @@
 /*
  * Flags for mmap
  */
-#define MAP_SHARED	0x001		/* Share changes */
-#define MAP_PRIVATE	0x002		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x003	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x00f		/* Mask for type of mapping */
 #define MAP_FIXED	0x010		/* Interpret addr exactly */
 
diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 870fbf8c7088..c98162f494db 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -10,9 +10,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x2b		/* Mask for type of mapping, includes bits 0x08 and 0x20 */
 #define MAP_FIXED	0x04		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x10		/* don't use a file */
diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
index 58f29a9d895d..be726062412b 100644
--- a/arch/xtensa/include/uapi/asm/mman.h
+++ b/arch/xtensa/include/uapi/asm/mman.h
@@ -34,9 +34,7 @@
 /*
  * Flags for mmap
  */
-#define MAP_SHARED	0x001		/* Share changes */
-#define MAP_PRIVATE	0x002		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x003	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x00f		/* Mask for type of mapping */
 #define MAP_FIXED	0x010		/* Interpret addr exactly */
 
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index e7ee32861d51..abd238d0f7a4 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -15,9 +15,7 @@
 #define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
 #define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
 
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+/* 0x01 - 0x03 are defined in linux/mman.h */
 #define MAP_TYPE	0x0f		/* Mask for type of mapping */
 #define MAP_FIXED	0x10		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x20		/* don't use a file */
diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h
index d0f515d53299..fc1a64c3447b 100644
--- a/include/uapi/linux/mman.h
+++ b/include/uapi/linux/mman.h
@@ -12,6 +12,10 @@
 #define OVERCOMMIT_ALWAYS		1
 #define OVERCOMMIT_NEVER		2
 
+#define MAP_SHARED	0x01		/* Share changes */
+#define MAP_PRIVATE	0x02		/* Changes are private */
+#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
+
 /*
  * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
  * size other than the default is desired.  See hugetlb_encode.h.
-- 
MST


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] drm: tweak header name
  2019-02-08  6:02 ` [PATCH 2/3] drm: tweak header name Michael S. Tsirkin
@ 2019-02-08  8:56   ` Daniel Vetter
  2019-02-08 12:55     ` Michael S. Tsirkin
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Vetter @ 2019-02-08  8:56 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Maarten Lankhorst,
	Maxime Ripard, Sean Paul, David Airlie, Daniel Vetter, dri-devel

On Fri, Feb 08, 2019 at 01:02:58AM -0500, Michael S. Tsirkin wrote:
> Use linux/mman.h to make sure we get all mmap flags we need.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

drmP.h is seriously deprecated (and a monster mess). If this fixes
anything, I think would be better to include the right header in the right
places, and leave drmP.h to die quietly ...

What exactly does this fix?
-Daniel

> ---
>  include/drm/drmP.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index bdb0d5548f39..a3184416ddc5 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -57,8 +57,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/dma-fence.h>
>  #include <linux/module.h>
> -
> -#include <asm/mman.h>
> +#include <linux/mman.h>
>  #include <asm/pgalloc.h>
>  #include <linux/uaccess.h>
>  
> -- 
> MST
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] drm: tweak header name
  2019-02-08  8:56   ` Daniel Vetter
@ 2019-02-08 12:55     ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08 12:55 UTC (permalink / raw)
  To: linux-kernel, linux-arch, Arnd Bergmann, Maarten Lankhorst,
	Maxime Ripard, Sean Paul, David Airlie, dri-devel

On Fri, Feb 08, 2019 at 09:56:59AM +0100, Daniel Vetter wrote:
> On Fri, Feb 08, 2019 at 01:02:58AM -0500, Michael S. Tsirkin wrote:
> > Use linux/mman.h to make sure we get all mmap flags we need.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> drmP.h is seriously deprecated (and a monster mess). If this fixes
> anything, I think would be better to include the right header in the right
> places, and leave drmP.h to die quietly ...
> 
> What exactly does this fix?
> -Daniel

I don't know. I am moving flags from asm/mman.h and if there
are direct users which there should not be, some code
might break. Even if it's a bad header people copy
code around, so why leave wrong examples there?
What's the harm in being proactive?


> > ---
> >  include/drm/drmP.h | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index bdb0d5548f39..a3184416ddc5 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -57,8 +57,7 @@
> >  #include <linux/workqueue.h>
> >  #include <linux/dma-fence.h>
> >  #include <linux/module.h>
> > -
> > -#include <asm/mman.h>
> > +#include <linux/mman.h>
> >  #include <asm/pgalloc.h>
> >  #include <linux/uaccess.h>
> >  
> > -- 
> > MST
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08  6:02 ` [PATCH 1/3] x86/mpx: tweak header name Michael S. Tsirkin
@ 2019-02-08 15:42   ` Borislav Petkov
  2019-02-08 21:43     ` Michael S. Tsirkin
  0 siblings, 1 reply; 16+ messages in thread
From: Borislav Petkov @ 2019-02-08 15:42 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Fri, Feb 08, 2019 at 01:02:53AM -0500, Michael S. Tsirkin wrote:
> Use linux/mman.h to make sure we get all mmap flags we need.

Why, asm/mman.h is not enough or is this fixing a build issue or what is that
patch supposed to address?

> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  arch/x86/mm/mpx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
> index de1851d15699..c805db6236b4 100644
> --- a/arch/x86/mm/mpx.c
> +++ b/arch/x86/mm/mpx.c
> @@ -9,12 +9,12 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/mm_types.h>
> +#include <linux/mman.h>
>  #include <linux/syscalls.h>
>  #include <linux/sched/sysctl.h>
>  
>  #include <asm/insn.h>
>  #include <asm/insn-eval.h>
> -#include <asm/mman.h>
>  #include <asm/mmu_context.h>
>  #include <asm/mpx.h>
>  #include <asm/processor.h>
> -- 

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] generic asm: mman cleanup
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2019-02-08  6:03 ` [PATCH 3/3] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
@ 2019-02-08 18:12 ` Mike Rapoport
  2019-02-08 21:19   ` Michael S. Tsirkin
  2019-02-11  4:20 ` Michael S. Tsirkin
  5 siblings, 1 reply; 16+ messages in thread
From: Mike Rapoport @ 2019-02-08 18:12 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, linux-arch, Arnd Bergmann

On Fri, Feb 08, 2019 at 01:02:51AM -0500, Michael S. Tsirkin wrote:
> Now that we have MAP_SHARED, MAP_PRIVATE and MAP_SHARED_VALIDATE on all
> architectures, it probably makes sense to de-duplicate these
> and put them into a common header.

I like the idea, but it seems there are more asm/mman.h users than just mpx
and drm.

Any reason only those were updated to include linux/mman.h?

 
> Please review and consider merging though the generic tree.
> 
> Build tested on x86 only. Has been in linux-next for a while now.
> 
> Michael S. Tsirkin (3):
>   x86/mpx: tweak header name
>   drm: tweak header name
>   arch: move common mmap flags to linux/mman.h
> 
>  arch/alpha/include/uapi/asm/mman.h     | 4 +---
>  arch/mips/include/uapi/asm/mman.h      | 4 +---
>  arch/parisc/include/uapi/asm/mman.h    | 4 +---
>  arch/x86/mm/mpx.c                      | 2 +-
>  arch/xtensa/include/uapi/asm/mman.h    | 4 +---
>  include/drm/drmP.h                     | 3 +--
>  include/uapi/asm-generic/mman-common.h | 4 +---
>  include/uapi/linux/mman.h              | 4 ++++
>  8 files changed, 11 insertions(+), 18 deletions(-)
> 
> -- 
> MST
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] generic asm: mman cleanup
  2019-02-08 18:12 ` [PATCH 0/3] generic asm: mman cleanup Mike Rapoport
@ 2019-02-08 21:19   ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08 21:19 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: linux-kernel, linux-arch, Arnd Bergmann

On Fri, Feb 08, 2019 at 08:12:47PM +0200, Mike Rapoport wrote:
> On Fri, Feb 08, 2019 at 01:02:51AM -0500, Michael S. Tsirkin wrote:
> > Now that we have MAP_SHARED, MAP_PRIVATE and MAP_SHARED_VALIDATE on all
> > architectures, it probably makes sense to de-duplicate these
> > and put them into a common header.
> 
> I like the idea, but it seems there are more asm/mman.h users than just mpx
> and drm.
> 
> Any reason only those were updated to include linux/mman.h?


They are all .c files. So since they keep building I know
nothing else will break. Fixing them would be an unrelated
cleanup.



>  
> > Please review and consider merging though the generic tree.
> > 
> > Build tested on x86 only. Has been in linux-next for a while now.
> > 
> > Michael S. Tsirkin (3):
> >   x86/mpx: tweak header name
> >   drm: tweak header name
> >   arch: move common mmap flags to linux/mman.h
> > 
> >  arch/alpha/include/uapi/asm/mman.h     | 4 +---
> >  arch/mips/include/uapi/asm/mman.h      | 4 +---
> >  arch/parisc/include/uapi/asm/mman.h    | 4 +---
> >  arch/x86/mm/mpx.c                      | 2 +-
> >  arch/xtensa/include/uapi/asm/mman.h    | 4 +---
> >  include/drm/drmP.h                     | 3 +--
> >  include/uapi/asm-generic/mman-common.h | 4 +---
> >  include/uapi/linux/mman.h              | 4 ++++
> >  8 files changed, 11 insertions(+), 18 deletions(-)
> > 
> > -- 
> > MST
> > 
> 
> -- 
> Sincerely yours,
> Mike.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08 15:42   ` Borislav Petkov
@ 2019-02-08 21:43     ` Michael S. Tsirkin
  2019-02-08 21:50       ` Dave Hansen
  2019-02-08 21:52       ` Borislav Petkov
  0 siblings, 2 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-08 21:43 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Fri, Feb 08, 2019 at 04:42:39PM +0100, Borislav Petkov wrote:
> On Fri, Feb 08, 2019 at 01:02:53AM -0500, Michael S. Tsirkin wrote:
> > Use linux/mman.h to make sure we get all mmap flags we need.
> 
> Why, asm/mman.h is not enough or is this fixing a build issue or what is that
> patch supposed to address?

Coding style violation: if a linux/foo.h exists then it must
be included in preference to asm/foo.h

And the specific issue is that a follow-up patch moves code from
asm/mman.h to linux/mman.h so if any one was indirectly using
this header it will now miss the symbols that are being moved.





> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  arch/x86/mm/mpx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
> > index de1851d15699..c805db6236b4 100644
> > --- a/arch/x86/mm/mpx.c
> > +++ b/arch/x86/mm/mpx.c
> > @@ -9,12 +9,12 @@
> >  #include <linux/kernel.h>
> >  #include <linux/slab.h>
> >  #include <linux/mm_types.h>
> > +#include <linux/mman.h>
> >  #include <linux/syscalls.h>
> >  #include <linux/sched/sysctl.h>
> >  
> >  #include <asm/insn.h>
> >  #include <asm/insn-eval.h>
> > -#include <asm/mman.h>
> >  #include <asm/mmu_context.h>
> >  #include <asm/mpx.h>
> >  #include <asm/processor.h>
> > -- 
> 
> Thx.
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08 21:43     ` Michael S. Tsirkin
@ 2019-02-08 21:50       ` Dave Hansen
  2019-02-08 21:52       ` Borislav Petkov
  1 sibling, 0 replies; 16+ messages in thread
From: Dave Hansen @ 2019-02-08 21:50 UTC (permalink / raw)
  To: Michael S. Tsirkin, Borislav Petkov
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On 2/8/19 1:43 PM, Michael S. Tsirkin wrote:
> On Fri, Feb 08, 2019 at 04:42:39PM +0100, Borislav Petkov wrote:
>> On Fri, Feb 08, 2019 at 01:02:53AM -0500, Michael S. Tsirkin wrote:
>>> Use linux/mman.h to make sure we get all mmap flags we need.
>> Why, asm/mman.h is not enough or is this fixing a build issue or what is that
>> patch supposed to address?
> Coding style violation: if a linux/foo.h exists then it must
> be included in preference to asm/foo.h

Huh, I don't see that one in Documentation/process/coding-style.rst

> And the specific issue is that a follow-up patch moves code from
> asm/mman.h to linux/mman.h so if any one was indirectly using
> this header it will now miss the symbols that are being moved.

Fair enough.  But, if this is the real reason, it belongs in the changelog.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08 21:43     ` Michael S. Tsirkin
  2019-02-08 21:50       ` Dave Hansen
@ 2019-02-08 21:52       ` Borislav Petkov
  2019-02-10  0:20         ` Michael S. Tsirkin
  1 sibling, 1 reply; 16+ messages in thread
From: Borislav Petkov @ 2019-02-08 21:52 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Fri, Feb 08, 2019 at 04:43:37PM -0500, Michael S. Tsirkin wrote:
> Coding style violation: if a linux/foo.h exists then it must
> be included in preference to asm/foo.h
> 
> And the specific issue is that a follow-up patch moves code from
> asm/mman.h to linux/mman.h so if any one was indirectly using
> this header it will now miss the symbols that are being moved.

Ok, so first of all, this should be your commit message - not what you
have there now.

Then, please send full patchsets to recipients - I have only this patch
in my mbox and have no clue what the whole patchset is addressing.

Further, do you want an ACK only or should I pick this up?

Finally, this whole file is going away:

https://lkml.kernel.org/r/7de5232f-4bc1-5c85-00d5-cb646462577f@intel.com

so your patch might become obsolete by then. Depends on what goes first.

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] x86/mpx: tweak header name
  2019-02-08 21:52       ` Borislav Petkov
@ 2019-02-10  0:20         ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-10  0:20 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, linux-arch, Arnd Bergmann, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Fri, Feb 08, 2019 at 10:52:32PM +0100, Borislav Petkov wrote:
> On Fri, Feb 08, 2019 at 04:43:37PM -0500, Michael S. Tsirkin wrote:
> > Coding style violation: if a linux/foo.h exists then it must
> > be included in preference to asm/foo.h
> > 
> > And the specific issue is that a follow-up patch moves code from
> > asm/mman.h to linux/mman.h so if any one was indirectly using
> > this header it will now miss the symbols that are being moved.
> 
> Ok, so first of all, this should be your commit message - not what you
> have there now.
> 
> Then, please send full patchsets to recipients - I have only this patch
> in my mbox and have no clue what the whole patchset is addressing.

I can copy you on all patches, sure.

> Further, do you want an ACK only or should I pick this up?


If you can pick it up then great.

> Finally, this whole file is going away:
> 
> https://lkml.kernel.org/r/7de5232f-4bc1-5c85-00d5-cb646462577f@intel.com
> 
> so your patch might become obsolete by then. Depends on what goes first.
> 
> Thx.


> -- 
> Regards/Gruss,
>     Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] generic asm: mman cleanup
  2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
                   ` (4 preceding siblings ...)
  2019-02-08 18:12 ` [PATCH 0/3] generic asm: mman cleanup Mike Rapoport
@ 2019-02-11  4:20 ` Michael S. Tsirkin
  2019-02-18 14:03   ` Arnd Bergmann
  5 siblings, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2019-02-11  4:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Arnd Bergmann

On Fri, Feb 08, 2019 at 01:02:51AM -0500, Michael S. Tsirkin wrote:
> Now that we have MAP_SHARED, MAP_PRIVATE and MAP_SHARED_VALIDATE on all
> architectures, it probably makes sense to de-duplicate these
> and put them into a common header.
> 
> Please review and consider merging though the generic tree.
> 
> Build tested on x86 only. Has been in linux-next for a while now.

Arnd, would you consider merging at least the cleanups 2/3 and 3/3?
In linux-next they had no ill effects and make things
slightly cleaner IMO.


> Michael S. Tsirkin (3):
>   x86/mpx: tweak header name
>   drm: tweak header name
>   arch: move common mmap flags to linux/mman.h
> 
>  arch/alpha/include/uapi/asm/mman.h     | 4 +---
>  arch/mips/include/uapi/asm/mman.h      | 4 +---
>  arch/parisc/include/uapi/asm/mman.h    | 4 +---
>  arch/x86/mm/mpx.c                      | 2 +-
>  arch/xtensa/include/uapi/asm/mman.h    | 4 +---
>  include/drm/drmP.h                     | 3 +--
>  include/uapi/asm-generic/mman-common.h | 4 +---
>  include/uapi/linux/mman.h              | 4 ++++
>  8 files changed, 11 insertions(+), 18 deletions(-)
> 
> -- 
> MST
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] generic asm: mman cleanup
  2019-02-11  4:20 ` Michael S. Tsirkin
@ 2019-02-18 14:03   ` Arnd Bergmann
  0 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2019-02-18 14:03 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Linux Kernel Mailing List, linux-arch

On Mon, Feb 11, 2019 at 5:20 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Feb 08, 2019 at 01:02:51AM -0500, Michael S. Tsirkin wrote:
> > Now that we have MAP_SHARED, MAP_PRIVATE and MAP_SHARED_VALIDATE on all
> > architectures, it probably makes sense to de-duplicate these
> > and put them into a common header.
> >
> > Please review and consider merging though the generic tree.
> >
> > Build tested on x86 only. Has been in linux-next for a while now.
>
> Arnd, would you consider merging at least the cleanups 2/3 and 3/3?
> In linux-next they had no ill effects and make things
> slightly cleaner IMO.

I applied patches 2 and 3 now, sorry for the late reply.

     Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-02-18 14:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08  6:02 [PATCH 0/3] generic asm: mman cleanup Michael S. Tsirkin
2019-02-08  6:02 ` [PATCH 1/3] x86/mpx: tweak header name Michael S. Tsirkin
2019-02-08 15:42   ` Borislav Petkov
2019-02-08 21:43     ` Michael S. Tsirkin
2019-02-08 21:50       ` Dave Hansen
2019-02-08 21:52       ` Borislav Petkov
2019-02-10  0:20         ` Michael S. Tsirkin
2019-02-08  6:02 ` [PATCH 2/2] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
2019-02-08  6:02 ` [PATCH 2/3] drm: tweak header name Michael S. Tsirkin
2019-02-08  8:56   ` Daniel Vetter
2019-02-08 12:55     ` Michael S. Tsirkin
2019-02-08  6:03 ` [PATCH 3/3] arch: move common mmap flags to linux/mman.h Michael S. Tsirkin
2019-02-08 18:12 ` [PATCH 0/3] generic asm: mman cleanup Mike Rapoport
2019-02-08 21:19   ` Michael S. Tsirkin
2019-02-11  4:20 ` Michael S. Tsirkin
2019-02-18 14:03   ` Arnd Bergmann

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).