Skip to contentSkip to conversation

mm, vmalloc: fix vmalloc users tracking properly

PATCH In review Michal Hocko 4 participants 9 messages May 9, 2017 – May 10, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm, vmalloc: fix vmalloc users tracking properly

From: Michal Hocko <[email protected]>

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

---

Hi Linus and Andrew,
it seems that this one slipped through cracks as well. Kbuild robot has quickly noticed that my original fix doesn't compile on m68k [1] and I've provided fix [2] at the time but it seems Andrew has missed it and sent the wrong one which got merged. Other users have noticed as well [3].

This is a full revert along with the fix. I can split it to a revert and the new fix if you prefer. Just let me know.

[1] http://lkml.kernel.org/r/201705030806.pzzQRBiN%[email protected]
[2] http://lkml.kernel.org/r/[email protected]
[3] http://lkml.kernel.org/r/[email protected]

 include/linux/vmalloc.h | 19 +++++++------------
 mm/util.c               |  3 ++-
 mm/vmalloc.c            | 18 +++++++++++++++++-
 3 files changed, 26 insertions(+), 14 deletions(-)
include/linux/vmalloc.h +7 -12
index 0328ce003992..4a0fabeb1e92 100644
@@ -6,7 +6,6 @@
 #include <linux/list.h>
 #include <linux/llist.h>
 #include <asm/page.h>		/* pgprot_t */
-#include <asm/pgtable.h>	/* PAGE_KERNEL */
 #include <linux/rbtree.h>
 
 struct vm_area_struct;		/* vma defining user mapping in mm_types.h */
@@ -82,23 +81,19 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
 			pgprot_t prot, unsigned long vm_flags, int node,
 			const void *caller);
 #ifndef CONFIG_MMU
-extern void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags);
+extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
+static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
+{
+	return __vmalloc_node_flags(size, node, flags);
+}
 #else
-extern void *__vmalloc_node(unsigned long size, unsigned long align,
-			    gfp_t gfp_mask, pgprot_t prot,
-			    int node, const void *caller);
-
 /*
  * We really want to have this inlined due to caller tracking. This
  * function is used by the highlevel vmalloc apis and so we want to track
  * their callers and inlining will achieve that.
  */
-static inline void *__vmalloc_node_flags(unsigned long size,
-					int node, gfp_t flags)
-{
-	return __vmalloc_node(size, 1, flags, PAGE_KERNEL,
-					node, __builtin_return_address(0));
-}
+extern void *__vmalloc_node_flags_caller(unsigned long size,
+					int node, gfp_t flags, void* caller);
 #endif
 
 extern void vfree(const void *addr);
mm/util.c +2 -1
index 718154debc87..464df3489903 100644
@@ -382,7 +382,8 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node)
 	if (ret || size <= PAGE_SIZE)
 		return ret;
 
-	return __vmalloc_node_flags(size, node, flags);
+	return __vmalloc_node_flags_caller(size, node, flags,
+			__builtin_return_address(0));
 }
 EXPORT_SYMBOL(kvmalloc_node);
 
mm/vmalloc.c +17 -1
index 1dda6d8a200a..4a1de70e68e1 100644
@@ -1649,6 +1649,9 @@ void *vmap(struct page **pages, unsigned int count,
 }
 EXPORT_SYMBOL(vmap);
 
+static void *__vmalloc_node(unsigned long size, unsigned long align,
+			    gfp_t gfp_mask, pgprot_t prot,
+			    int node, const void *caller);
 static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 				 pgprot_t prot, int node)
 {
@@ -1791,7 +1794,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
  *	with mm people.
  *
  */
-void *__vmalloc_node(unsigned long size, unsigned long align,
+static void *__vmalloc_node(unsigned long size, unsigned long align,
 			    gfp_t gfp_mask, pgprot_t prot,
 			    int node, const void *caller)
 {
@@ -1806,6 +1809,19 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
 }
 EXPORT_SYMBOL(__vmalloc);
 
+static inline void *__vmalloc_node_flags(unsigned long size,
+					int node, gfp_t flags)
+{
+	return __vmalloc_node(size, 1, flags, PAGE_KERNEL,
+					node, __builtin_return_address(0));
+}
+
+
+void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void *caller)
+{
+	return __vmalloc_node(size, 1, flags, PAGE_KERNEL, node, caller);
+}
+
 /**
  *	vmalloc  -  allocate virtually contiguous memory
  *	@size:		allocation size
Signature · 7 lines
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tested-by on v1 1/1
#1 lore raw
Quoted 41 lines · Michal Hocko

From: Michal Hocko <[email protected]>

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Quoted 2 lines
Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

This fixes the build for ARCH=nios2, thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
In reply to Michal Hocko
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Michal,

[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20170509]
[cannot apply to v4.11]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michal-Hocko/mm-vmalloc-fix-vmalloc-users-tracking-properly/20170509-224536
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: c6x-evmc6678_defconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 6.2.0

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=c6x

All error/warnings (new ones prefixed by >>):

block/bio.c:879:48: sparse: cast truncates bits from constant value (7fffffffffffffff becomes ffffffff) In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/memcontrol.h:24,
                    from include/linux/swap.h:8,
                    from block/bio.c:19:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/blk-core.c:1145:24: sparse: context imbalance in '__get_request' - unexpected unlock block/blk-core.c:1284:23: sparse: context imbalance in 'blk_old_get_request' - different lock contexts for basic block block/blk-core.c:1651:17: sparse: context imbalance in 'blk_queue_bio' - different lock contexts for basic block block/blk-core.c:3269:17: sparse: context imbalance in 'blk_flush_plug_list' - unexpected unlock In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/pagemap.h:10,
                    from include/linux/blkdev.h:15,
                    from include/linux/backing-dev.h:14,
                    from block/blk-core.c:16:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/blk-flush.c:271:9: sparse: context imbalance in 'flush_end_io' - different lock contexts for basic block In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/bio.h:21,
                    from block/blk-flush.c:69:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/blk-ioc.c:110:28: sparse: context imbalance in 'ioc_release_fn' - different lock contexts for basic block block/blk-ioc.c:191:9: sparse: context imbalance in 'put_io_context_active' - different lock contexts for basic block In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/bio.h:21,
                    from block/blk-ioc.c:7:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
include/linux/sched.h:1526:16: sparse: incorrect type in argument 1 (different modifiers)
include/linux/sched.h:1526:16: expected struct thread_info *ti
include/linux/sched.h:1526:16: got struct thread_info [pure] *
In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/pagemap.h:10,
                    from include/linux/blkdev.h:15,
                    from include/linux/backing-dev.h:14,
                    from block/blk-mq.c:9:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/ioctl.c:263:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:263:16: got unsigned short *<noident>
block/ioctl.c:263:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:263:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:263:16: got unsigned short *<noident>
block/ioctl.c:268:16: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:268:16: expected void *__p
block/ioctl.c:268:16: got int [noderef] <asn:1>*<noident>
block/ioctl.c:268:16: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:268:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:268:16: got int *<noident>
block/ioctl.c:268:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:268:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:268:16: got int *<noident>
block/ioctl.c:273:16: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:273:16: expected void *__p
block/ioctl.c:273:16: got unsigned int [noderef] <asn:1>*<noident>
block/ioctl.c:273:16: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:273:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:273:16: got unsigned int *<noident>
block/ioctl.c:273:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:273:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:273:16: got unsigned int *<noident>
block/ioctl.c:278:16: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:278:16: expected void *__p
block/ioctl.c:278:16: got long [noderef] <asn:1>*<noident>
block/ioctl.c:278:16: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:278:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:278:16: got long *<noident>
block/ioctl.c:278:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:278:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:278:16: got long *<noident>
block/ioctl.c:283:16: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:283:16: expected void *__p
block/ioctl.c:283:16: got unsigned long [noderef] <asn:1>*<noident>
block/ioctl.c:283:16: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:283:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:283:16: got unsigned long *<noident>
block/ioctl.c:283:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:283:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:283:16: got unsigned long *<noident>
block/ioctl.c:288:16: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:288:16: expected void *__p
block/ioctl.c:288:16: got unsigned long long [noderef] [usertype] <asn:1>*<noident>
block/ioctl.c:288:16: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:288:16: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:288:16: got unsigned long long *<noident>
block/ioctl.c:288:16: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:288:16: expected void [noderef] <asn:1>*ptr
block/ioctl.c:288:16: got unsigned long long *<noident>
block/ioctl.c:445:13: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:445:13: expected void const *__p
block/ioctl.c:445:13: got int [noderef] <asn:1>*<noident>
block/ioctl.c:445:13: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:445:13: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:445:13: got int *<noident>
block/ioctl.c:445:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:445:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:445:13: got int *<noident>
block/ioctl.c:445:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:445:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:445:13: got int *<noident>
block/ioctl.c:445:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:445:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:445:13: got int *<noident>
block/ioctl.c:445:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:445:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:445:13: got int *<noident>
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
block/ioctl.c:487:13: sparse: incorrect type in initializer (different address spaces)
block/ioctl.c:487:13: expected void const *__p
block/ioctl.c:487:13: got int [noderef] <asn:1>*argp
block/ioctl.c:487:13: sparse: incorrect type in argument 1 (different address spaces)
block/ioctl.c:487:13: expected void const volatile [noderef] <asn:1>*<noident>
block/ioctl.c:487:13: got int *<noident>
block/ioctl.c:487:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:487:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:487:13: got int *<noident>
block/ioctl.c:487:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:487:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:487:13: got int *<noident>
block/ioctl.c:487:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:487:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:487:13: got int *<noident>
block/ioctl.c:487:13: sparse: incorrect type in argument 2 (different address spaces)
block/ioctl.c:487:13: expected void const [noderef] <asn:1>*ptr
block/ioctl.c:487:13: got int *<noident>
In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/pagemap.h:10,
                    from include/linux/blkdev.h:15,
                    from block/ioctl.c:2:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/genhd.c:1462:10: sparse: bad integer constant expression block/genhd.c:1463:10: sparse: bad integer constant expression block/genhd.c:1467:10: sparse: bad integer constant expression block/genhd.c:1468:10: sparse: bad integer constant expression In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/pagemap.h:10,
                    from include/linux/blkdev.h:15,
                    from block/genhd.c:10:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
--
block/scsi_ioctl.c:103:25: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:103:25: got int *<noident>
block/scsi_ioctl.c:103:25: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:103:25: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:103:25: got int *<noident>
block/scsi_ioctl.c:103:25: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:103:25: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:103:25: got int *<noident>
block/scsi_ioctl.c:103:25: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:103:25: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:103:25: got int *<noident>
block/scsi_ioctl.c:121:16: sparse: incorrect type in initializer (different address spaces)
block/scsi_ioctl.c:121:16: expected void *__p
block/scsi_ioctl.c:121:16: got int [noderef] <asn:1>*p
block/scsi_ioctl.c:121:16: sparse: incorrect type in argument 1 (different address spaces)
block/scsi_ioctl.c:121:16: expected void const volatile [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:121:16: got int *<noident>
block/scsi_ioctl.c:121:16: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:121:16: expected void [noderef] <asn:1>*ptr
block/scsi_ioctl.c:121:16: got int *<noident>
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
block/scsi_ioctl.c:435:13: sparse: incorrect type in initializer (different address spaces)
block/scsi_ioctl.c:435:13: expected void const *__p
block/scsi_ioctl.c:435:13: got unsigned int [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:435:13: sparse: incorrect type in argument 1 (different address spaces)
block/scsi_ioctl.c:435:13: expected void const volatile [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:435:13: got unsigned int *<noident>
block/scsi_ioctl.c:435:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:435:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:435:13: got unsigned int *<noident>
block/scsi_ioctl.c:435:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:435:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:435:13: got unsigned int *<noident>
block/scsi_ioctl.c:435:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:435:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:435:13: got unsigned int *<noident>
block/scsi_ioctl.c:435:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:435:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:435:13: got unsigned int *<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in initializer (different address spaces)
block/scsi_ioctl.c:437:13: expected void const *__p
block/scsi_ioctl.c:437:13: got unsigned int [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in argument 1 (different address spaces)
block/scsi_ioctl.c:437:13: expected void const volatile [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:437:13: got unsigned int *<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:437:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:437:13: got unsigned int *<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:437:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:437:13: got unsigned int *<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:437:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:437:13: got unsigned int *<noident>
block/scsi_ioctl.c:437:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:437:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:437:13: got unsigned int *<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in initializer (different address spaces)
block/scsi_ioctl.c:441:13: expected void const *__p
block/scsi_ioctl.c:441:13: got unsigned char [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in argument 1 (different address spaces)
block/scsi_ioctl.c:441:13: expected void const volatile [noderef] <asn:1>*<noident>
block/scsi_ioctl.c:441:13: got unsigned char *<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:441:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:441:13: got unsigned char *<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:441:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:441:13: got unsigned char *<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:441:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:441:13: got unsigned char *<noident>
block/scsi_ioctl.c:441:13: sparse: incorrect type in argument 2 (different address spaces)
block/scsi_ioctl.c:441:13: expected void const [noderef] <asn:1>*ptr
block/scsi_ioctl.c:441:13: got unsigned char *<noident>
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
include/linux/uaccess.h:166:18: sparse: incorrect type in argument 1 (different modifiers)
include/linux/uaccess.h:166:18: expected void *<noident>
include/linux/uaccess.h:166:18: got void const *from
In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/highmem.h:9,
                    from include/linux/pagemap.h:10,
                    from include/linux/blkdev.h:15,
                    from block/scsi_ioctl.c:23:
>> include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
>> include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
>> include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
..

vim +/__vmalloc_node_flags_caller +85 include/linux/vmalloc.h

78 extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
79 extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
80 unsigned long start, unsigned long end, gfp_t gfp_mask,
81 pgprot_t prot, unsigned long vm_flags, int node,
82 const void *caller);
83 #ifndef CONFIG_MMU

  > 84	extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
  > 85	static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
    86	{
  > 87		return __vmalloc_node_flags(size, node, flags);
    88	}
    89	#else
    90	/*

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw
In reply to Michal Hocko
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Michal,

[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20170509]
[cannot apply to v4.11]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michal-Hocko/mm-vmalloc-fix-vmalloc-users-tracking-properly/20170509-224536
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: c6x-evmc6678_defconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 6.2.0

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=c6x

All errors (new ones prefixed by >>):

mm/nommu.c:51:5: sparse: symbol 'sysctl_nr_trim_pages' was not declared. Should it be static? mm/nommu.c:52:5: sparse: symbol 'heap_stack_gap' was not declared. Should it be static? mm/nommu.c:63:35: sparse: symbol 'generic_file_vm_ops' was not declared. Should it be static? mm/nommu.c:240:6: sparse: symbol '__vmalloc_node_flags' was not declared. Should it be static? mm/nommu.c:1175:48: sparse: incorrect type in argument 2 (different address spaces)
mm/nommu.c:1175:48: expected char [noderef] <asn:1>*<noident>
mm/nommu.c:1175:48: got void *[assigned] base
mm/nommu.c:1790:15: sparse: symbol 'arch_get_unmapped_area' was not declared. Should it be static? mm/nommu.c:638:9: sparse: context imbalance in '__put_nommu_region' - wrong count at exit mm/nommu.c:659:13: sparse: context imbalance in 'put_nommu_region' - unexpected unlock In file included from include/asm-generic/io.h:767:0,

                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/memcontrol.h:24,
                    from include/linux/swap.h:8,
                    from mm/nommu.c:23:
   include/linux/vmalloc.h:85:21: error: conflicting types for '__vmalloc_node_flags_caller'
    static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags, void* caller)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:84:14: note: previous declaration of '__vmalloc_node_flags_caller' was here
    extern void *__vmalloc_node_flags_caller(unsigned long size, int node, gfp_t flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h: In function '__vmalloc_node_flags_caller':
   include/linux/vmalloc.h:87:9: error: implicit declaration of function '__vmalloc_node_flags' [-Werror=implicit-function-declaration]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~
   include/linux/vmalloc.h:87:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/nommu.c: At top level:
>> mm/nommu.c:240:7: error: conflicting types for '__vmalloc_node_flags'
    void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags)
          ^~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/io.h:767:0,
                    from ./arch/c6x/include/generated/asm/io.h:1,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/c6x/include/asm/hardirq.h:18,
                    from include/linux/hardirq.h:8,
                    from include/linux/memcontrol.h:24,
                    from include/linux/swap.h:8,
                    from mm/nommu.c:23:
   include/linux/vmalloc.h:87:9: note: previous implicit declaration of '__vmalloc_node_flags' was here
     return __vmalloc_node_flags(size, node, flags);
            ^~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/__vmalloc_node_flags +240 mm/nommu.c

8518609d Robert P. J. Day 2007-10-19  234  	 * returns only a logical address.
^1da177e Linus Torvalds   2005-04-16  235  	 */
84097518 Nick Piggin      2006-03-22  236  	return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM);
^1da177e Linus Torvalds   2005-04-16  237  }
b5073173 Paul Mundt       2007-07-21  238  EXPORT_SYMBOL(__vmalloc);
^1da177e Linus Torvalds   2005-04-16  239  
c7e6abdb Michal Hocko     2017-05-03 @240  void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags)
c7e6abdb Michal Hocko     2017-05-03  241  {
c7e6abdb Michal Hocko     2017-05-03  242  	return __vmalloc(size, flags, PAGE_KERNEL);
c7e6abdb Michal Hocko     2017-05-03  243  }

:::::: The code at line 240 was first introduced by commit
:::::: c7e6abdbe12a86cfa1bdba2bd3e9f5fdb1cb175b mm: introduce kv[mz]alloc helpers

:::::: TO: Michal Hocko <[email protected]>
:::::: CC: Johannes Weiner <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#7 lore raw
In reply to Michal Hocko

Hi Michal,

Quoted 41 lines · Michal Hocko

From: Michal Hocko <[email protected]>

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Quoted 2 lines
Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

FWIW, this did fix the following build failure on m68k in linus/master (commit 2868b2513aa732a9 ("Merge tag 'linux-kselftest-4.12-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest"):

In file included from arch/m68k/include/asm/pgtable_mm.h:148,
from arch/m68k/include/asm/pgtable.h:5, from include/linux/vmalloc.h:10,
from arch/m68k/kernel/module.c:10:
arch/m68k/include/asm/motorola_pgtable.h: In function ‘pgd_offset’:
arch/m68k/include/asm/motorola_pgtable.h:198: error: dereferencing
pointer to incomplete type
scripts/Makefile.build:294: recipe for target
'arch/m68k/kernel/module.o' failed

but given the complaints from 0day on this and future versions, I think it's better not to provide a Tested-by yet.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw
Quoted 61 lines · Geert Uytterhoeven

Hi Michal,

Quoted 41 lines · Michal Hocko

From: Michal Hocko <[email protected]>

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Quoted 2 lines
Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

FWIW, this did fix the following build failure on m68k in linus/master (commit 2868b2513aa732a9 ("Merge tag 'linux-kselftest-4.12-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest"):

In file included from arch/m68k/include/asm/pgtable_mm.h:148,
from arch/m68k/include/asm/pgtable.h:5, from include/linux/vmalloc.h:10,
from arch/m68k/kernel/module.c:10:
arch/m68k/include/asm/motorola_pgtable.h: In function a??pgd_offseta??:
arch/m68k/include/asm/motorola_pgtable.h:198: error: dereferencing
pointer to incomplete type
scripts/Makefile.build:294: recipe for target
'arch/m68k/kernel/module.o' failed

Quoted 2 lines

but given the complaints from 0day on this and future versions, I think it's better not to provide a Tested-by yet.

FWIW I have already sent a follow up fix
http://lkml.kernel.org/r/[email protected]

Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
In reply to Michal Hocko
Quoted 47 lines · Michal Hocko

Sigh. I've apparently managed to screw up again. This should address the nommu breakage reported by 0-day.
---
From 95d49bf93ae4467f3f918520ec03b3596e5b36cc Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 9 May 2017 16:27:39 +0200
Subject: [PATCH] mm, vmalloc: fix vmalloc users tracking properly

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Quoted 2 lines
Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Tested-by
#5 lore raw
In reply to Michal Hocko
Quoted 47 lines · Michal Hocko

Sigh. I've apparently managed to screw up again. This should address the nommu breakage reported by 0-day.
---
From 95d49bf93ae4467f3f918520ec03b3596e5b36cc Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 9 May 2017 16:27:39 +0200
Subject: [PATCH] mm, vmalloc: fix vmalloc users tracking properly

1f5307b1e094 ("mm, vmalloc: properly track vmalloc users") has pulled asm/pgtable.h include dependency to linux/vmalloc.h and that turned out to be a bad idea for some architectures. E.g. m68k fails with
In file included from arch/m68k/include/asm/pgtable_mm.h:145:0,

                    from arch/m68k/include/asm/pgtable.h:4,
                    from include/linux/vmalloc.h:9,
                    from arch/m68k/kernel/module.c:9:

arch/m68k/include/asm/mcf_pgtable.h: In function 'nocache_page':

Quoted 1 line
Quoted 1 line

arch/m68k/include/asm/mcf_pgtable.h:339:43: error: 'init_mm' undeclared (first use in this function)

    #define pgd_offset_k(address) pgd_offset(&init_mm, address)

as spotted by kernel build bot. nios2 fails for other reason In file included from ./include/asm-generic/io.h:767:0,

                 from ./arch/nios2/include/asm/io.h:61,
                 from ./include/linux/io.h:25,
                 from ./arch/nios2/include/asm/pgtable.h:18,
                 from ./include/linux/mm.h:70,
                 from ./include/linux/pid_namespace.h:6,
                 from ./include/linux/ptrace.h:9,
                 from ./arch/nios2/include/uapi/asm/elf.h:23,
                 from ./arch/nios2/include/asm/elf.h:22,
                 from ./include/linux/elf.h:4,
                 from ./include/linux/module.h:15,
                 from init/main.c:16:

./include/linux/vmalloc.h: In function '__vmalloc_node_flags':
./include/linux/vmalloc.h:99:40: error: 'PAGE_KERNEL' undeclared (first use in this function); did you mean 'GFP_KERNEL'?

which is due to the newly added #include <asm/pgtable.h>, which on nios2 includes <linux/io.h> and thus <asm/io.h> and <asm-generic/io.h> which again includes <linux/vmalloc.h>.

Tweaking that around just turns out a bigger headache than necessary. This patch reverts 1f5307b1e094 and reimplements the original fix in a different way. __vmalloc_node_flags can stay static inline which will cover vmalloc* functions. We only have one external user (kvmalloc_node) and we can export __vmalloc_node_flags_caller and provide the caller directly. This is much simpler and it doesn't really need any games with header files.

Quoted 2 lines
Fixes 1f5307b1e094 ("mm, vmalloc: properly track vmalloc users")

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>