generic asm: mman cleanup
Subsystems (10)
cover generic asm: mman cleanup
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(-)
Signature · 1 line
MST
PATCH 1/3 x86/mpx: tweak header name
Use linux/mman.h to make sure we get all mmap flags we need.
--- arch/x86/mm/mpx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/mpx.c +1 -1
@@ -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>
Signature · 1 line
MST
PATCH 2/2 arch: move common mmap flags to linux/mman.h
In reply to Michael S. TsirkinNow 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.
--- 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(-)
arch/alpha/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/mips/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/parisc/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/xtensa/include/uapi/asm/mman.h +1 -3
@@ -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 */
include/uapi/asm-generic/mman-common.h +1 -3
@@ -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 */
include/uapi/linux/mman.h +4 -0
@@ -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.
Signature · 1 line
MST
PATCH 2/3 drm: tweak header name
In reply to Michael S. TsirkinUse linux/mman.h to make sure we get all mmap flags we need.
--- include/drm/drmP.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/drm/drmP.h +1 -2
@@ -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>
Signature · 6 lines
MST _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 arch: move common mmap flags to linux/mman.h
In reply to Michael S. TsirkinNow 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.
--- 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(-)
arch/alpha/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/mips/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/parisc/include/uapi/asm/mman.h +1 -3
@@ -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 */
arch/xtensa/include/uapi/asm/mman.h +1 -3
@@ -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 */
include/uapi/asm-generic/mman-common.h +1 -3
@@ -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 */
include/uapi/linux/mman.h +4 -0
@@ -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.
Signature · 1 line
MST
Re: [PATCH 2/3] drm: tweak header name
In reply to Michael S. TsirkinQuoted 3 lines · Michael S. Tsirkin
Use
linux/mman.hto make sure we get all mmap flags we need.Signed-off-by Michael S. Tsirkin <[email protected]>
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
Quoted 21 lines
--- include/drm/drmP.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)include/drm/drmP.h +1
-2@@ -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> Signature · 1 line
MST
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 2/3] drm: tweak header name
Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Michael S. Tsirkin
Use
linux/mman.hto make sure we get all mmap flags we need.Signed-off-by Michael S. Tsirkin <[email protected]>
drmP.his 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 leavedrmP.hto 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?
Quoted 18 lines
Quoted 18 lines
--- include/drm/drmP.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)include/drm/drmP.h +1
-2@@ -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>
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
MSTSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Borislav Petkov
maintainerRe: [PATCH 1/3] x86/mpx: tweak header name
In reply to Michael S. TsirkinQuoted 1 line · Michael S. Tsirkin
Use
linux/mman.hto 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?
Quoted 15 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- arch/x86/mm/mpx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/mm/mpx.c +0
-0@@ -9,12 +9,12 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm_types.h>
arch/x86/mm/mpx.c line 20
Quoted 10 lines
arch/x86/mm/mpx.c +1
-1+#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.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Quoted 3 lines · Michael S. Tsirkin
Now that we have
MAP_SHARED,MAP_PRIVATEandMAP_SHARED_VALIDATEon 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?
Quoted 22 lines
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 tolinux/mman.harch/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(-)Signature · 1 line
MST
Signature · 2 lines
Sincerely yours, Mike.
Quoted 9 lines · Mike Rapoport
Quoted 3 lines · Michael S. Tsirkin
Now that we have
MAP_SHARED,MAP_PRIVATEandMAP_SHARED_VALIDATEon 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.husers 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.
Quoted 27 lines
Quoted 23 lines
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 tolinux/mman.harch/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(-)Signature · 1 line
MSTSignature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 1/3] x86/mpx: tweak header name
In reply to Borislav PetkovQuoted 5 lines · Borislav Petkov
Quoted 1 line · Michael S. Tsirkin
Use
linux/mman.hto make sure we get all mmap flags we need.Why,
asm/mman.his 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.
Quoted 33 lines
Quoted 15 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- arch/x86/mm/mpx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/mm/mpx.c +0
-0@@ -9,12 +9,12 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm_types.h> arch/x86/mm/mpx.c line 20
Quoted 10 lines
arch/x86/mm/mpx.c +1
-1+#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.
Signature · 4 lines
Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.
Re: [PATCH 1/3] x86/mpx: tweak header name
Quoted 7 lines · Michael S. Tsirkin
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Michael S. Tsirkin
Use
linux/mman.hto make sure we get all mmap flags we need.Why,
asm/mman.his not enough or is this fixing a build issue or what is that patch supposed to address?Coding style violation: if a
linux/foo.hexists then it must be included in preference toasm/foo.h
Huh, I don't see that one in Documentation/process/coding-style.rst
Quoted 3 lines
And the specific issue is that a follow-up patch moves code from
asm/mman.htolinux/mman.hso 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.
Borislav Petkov
maintainerRe: [PATCH 1/3] x86/mpx: tweak header name
In reply to Michael S. TsirkinQuoted 6 lines · Michael S. Tsirkin
Coding style violation: if a
linux/foo.hexists then it must be included in preference toasm/foo.hAnd the specific issue is that a follow-up patch moves code from
asm/mman.htolinux/mman.hso 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/[email protected]
so your patch might become obsolete by then. Depends on what goes first.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Re: [PATCH 1/3] x86/mpx: tweak header name
Quoted 8 lines · Borislav Petkov
Quoted 6 lines · Michael S. Tsirkin
Coding style violation: if a
linux/foo.hexists then it must be included in preference toasm/foo.hAnd the specific issue is that a follow-up patch moves code from
asm/mman.htolinux/mman.hso if any one was indirectly using this header it will now miss the symbols that are being moved.
Quoted 5 lines
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.
Quoted 1 line
Further, do you want an ACK only or should I pick this up?
If you can pick it up then great.
Quoted 14 lines
Finally, this whole file is going away:
https://lkml.kernel.org/r/[email protected]
so your patch might become obsolete by then. Depends on what goes first.
Thx.
Signature · 4 lines
Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.
Quoted 7 lines · Michael S. Tsirkin
Now that we have
MAP_SHARED,MAP_PRIVATEandMAP_SHARED_VALIDATEon 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.
Quoted 18 lines
Michael S. Tsirkin (3):
x86/mpx: tweak header name
drm: tweak header name
arch: move common mmap flags tolinux/mman.harch/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(-)Signature · 1 line
MST
Arnd Bergmann
maintainerQuoted 6 lines · Michael S. Tsirkin
Quoted 4 lines · Michael S. Tsirkin
Now that we have
MAP_SHARED,MAP_PRIVATEandMAP_SHARED_VALIDATEon all architectures, it probably makes sense to de-duplicate these and put them into a common header.
Quoted 7 lines
Quoted 3 lines
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