Skip to contentSkip to conversation

Build failure (sparc32:allmodconfig) in -next due to 'memcg: export struct mem_cgroup'

PATCH In review Guenter Roeck 3 participants 6 messages Aug 2, 2015 – Aug 4, 2015 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

Hi,

Commit b65390c6c2178f ("memcg: export struct mem_cgroup") causes several build failures in -next (next-20150731) when trying to build sparc32:allmodconfig.

Below are some of the errors, as well as a bisect log.

Guenter

---
In file included from include/linux/pid_namespace.h:6:0,
from include/linux/ptrace.h:8,
from include/linux/ftrace.h:13,
from include/linux/init_task.h:8,
from init/init_task.c:1:
include/linux/mm.h: At top level:
include/linux/mm.h:888:7: error: conflicting types for 'page_address' ./arch/sparc/include/asm/highmem.h:59:10: note: previous implicit declaration of 'page_address' was here

In file included from include/linux/highmem.h:7:0,

                 from include/linux/bio.h:23,
                 from include/linux/writeback.h:192,
                 from include/linux/memcontrol.h:30,
                 from include/linux/swap.h:8,
                 from ./arch/sparc/include/asm/pgtable_32.h:17,
                 from ./arch/sparc/include/asm/pgtable.h:6,
                 from arch/sparc/kernel/traps_32.c:23:

include/linux/mm.h: In function 'is_vmalloc_addr':
include/linux/mm.h:371:17: error: 'VMALLOC_START' undeclared (first use in this function) include/linux/mm.h:371:17: note: each undeclared identifier is reported only once for each function it appears in include/linux/mm.h:371:41: error: 'VMALLOC_END' undeclared (first use in this function) include/linux/mm.h: In function 'maybe_mkwrite':
include/linux/mm.h:556:3: error: implicit declaration of function 'pte_mkwrite'

In file included from include/linux/highmem.h:7:0,

                 from include/linux/bio.h:23,
                 from include/linux/writeback.h:192,
                 from include/linux/memcontrol.h:30,
                 from include/linux/swap.h:8,
                 from ./arch/sparc/include/asm/pgtable_32.h:17,
                 from ./arch/sparc/include/asm/pgtable.h:6,
                 from ./arch/sparc/include/asm/pgalloc_32.h:8,
                 from ./arch/sparc/include/asm/pgalloc.h:6,
                 from arch/sparc/kernel/sun4m_irq.c:16:

include/linux/mm.h: In function 'pte_lockptr':
include/linux/mm.h:1422:2: error: implicit declaration of function 'pmd_page' [-Werror=implicit-function-declaration] include/linux/mm.h:1422:2: error: passing argument 1 of 'ptlock_ptr' makes pointer from integer without a cast [-Werror] include/linux/mm.h:1396:27: note: expected 'struct page *' but argument is of type 'int' include/linux/mm.h: In function 'pgtable_init':
include/linux/mm.h:1465:2: error: implicit declaration of function 'pgtable_cache_init'

---

Bisect log:

# bad: [37bd1ea52d362219b1882814cb75bb365736890f] Add linux-next specific files for 20150731 # good: [cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f] Linux 4.2-rc4
git bisect start 'HEAD' 'v4.2-rc4'
# good: [dee8e3fb6da725af9f6576203043e28e1fc24112] Merge remote-tracking branch 'drm/drm-next' git bisect good dee8e3fb6da725af9f6576203043e28e1fc24112
# good: [18e555796935152bb99fba6225e119e334e46e0b] Merge remote-tracking branch 'usb-serial/usb-next' git bisect good 18e555796935152bb99fba6225e119e334e46e0b
# good: [d130dd99924fd8bd36a2d6469fb4650555885674] Merge remote-tracking branch 'pinctrl/for-next' git bisect good d130dd99924fd8bd36a2d6469fb4650555885674
# bad: [0fc5899188276020bf18bbd081adb8d904f19c36] lib: Add CRC64 ECMA module
git bisect bad 0fc5899188276020bf18bbd081adb8d904f19c36
# good: [0ce35077894da68fe4b428239ba78565a85f873a] ext4: huge page fault support
git bisect good 0ce35077894da68fe4b428239ba78565a85f873a
# bad: [ab75dc42ab76dc589ba9ebc3ac4559bf16ad9b9e] hwpoison: use page_cgroup_ino for filtering by memcg git bisect bad ab75dc42ab76dc589ba9ebc3ac4559bf16ad9b9e
# bad: [4ae161e1a34b0251fdcad1f1200e4aa024bf15a1] mm-page_isolation-remove-bogus-tests-for-isolated-pages-fix git bisect bad 4ae161e1a34b0251fdcad1f1200e4aa024bf15a1
# good: [2f2a822d1ade8faed5d5faa36f7ce672d8032560] fs: do not prefault sys_write() user buffer pages git bisect good 2f2a822d1ade8faed5d5faa36f7ce672d8032560
# good: [7e6c8c501cc9e471227ce852a8214c9653a9a93e] mm/dmapool: allow NULL `pool' pointer in dma_pool_destroy() git bisect good 7e6c8c501cc9e471227ce852a8214c9653a9a93e
# bad: [f1a893781a72f9b8dffe98fc73e57949497a1e0f] memcg: get rid of extern for functions in memcontrol.h git bisect bad f1a893781a72f9b8dffe98fc73e57949497a1e0f
# bad: [1b9131b73abd4324ea3f6b8005a1b586a0c44a5f] memcg-export-struct-mem_cgroup-fix
git bisect bad 1b9131b73abd4324ea3f6b8005a1b586a0c44a5f
# bad: [b65390c6c2178f51faa396a6b2f1d64ebbd3c373] memcg: export struct mem_cgroup
git bisect bad b65390c6c2178f51faa396a6b2f1d64ebbd3c373

# first bad commit: [b65390c6c2178f51faa396a6b2f1d64ebbd3c373] memcg: export struct mem_cgroup
#1 lore raw
Quoted 10 lines · Guenter Roeck

Hi,

Commit b65390c6c2178f ("memcg: export struct mem_cgroup") causes several build failures in -next (next-20150731) when trying to build sparc32:allmodconfig.

Below are some of the errors, as well as a bisect log.

Guenter

Quoted 9 lines

---
In file included from include/linux/pid_namespace.h:6:0,
from include/linux/ptrace.h:8,
from include/linux/ftrace.h:13,
from include/linux/init_task.h:8,
from init/init_task.c:1:
include/linux/mm.h: At top level:
include/linux/mm.h:888:7: error: conflicting types for 'page_address' ./arch/sparc/include/asm/highmem.h:59:10: note: previous implicit declaration of 'page_address' was here

This is weird:
* include/linux/mm.h:888

#if defined(HASHED_PAGE_VIRTUAL)
void *page_address(const struct page *page); void set_page_address(struct page *page, void *virtual); void page_address_init(void);
#endif

* arch/sparc/include/asm/highmem.h:59
static inline void *kmap(struct page *page)

{
        BUG_ON(in_interrupt());
        if (!PageHighMem(page))
                return page_address(page); 
        return kmap_high(page);
}

How come we have conflicting types here. page_address is clearly not a function declaration in sparc code. Maybe something expands to an incomplete c construct.

I have tried to crosscompile with
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ but failed with strange errors.

$ PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=x86_64-linux- ARCH=sparc32 make allmodconfig
warning: (USB_OTG_FSM && FSL_USB2_OTG && USB_MV_OTG) selects USB_OTG which has unmet direct dependencies (USB_SUPPORT && USB && PM)
warning: (MFD_CROS_EC) selects CHROME_PLATFORMS which has unmet direct dependencies (X86 || ARM)
warning: (SND_SOC_ROCKCHIP_MAX98090 && SND_SOC_ROCKCHIP_RT5645) selects SND_SOC_ROCKCHIP_I2S which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && CLKDEV_LOOKUP && SND_SOC_ROCKCHIP)
$ PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=x86_64-linux- ARCH=sparc32 make
x86_64-linux-gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
cc1: error: unrecognized command line option '-mno-fpu'
cc1: warning: unknown register name: g5 [enabled by default]
cc1: warning: unknown register name: g7 [enabled by default]
kernel/bounds.c:1:0: error: bad value (v8) for -mtune= switch
Kbuild:44: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1009: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

So either I am doing something wrong or the cross compiler is broken. Could you send the preprocessed output of the failing compile?

Quoted 8 lines

In file included from include/linux/highmem.h:7:0,

                 from include/linux/bio.h:23,
                 from include/linux/writeback.h:192,
                 from include/linux/memcontrol.h:30,
                 from include/linux/swap.h:8,
                 from ./arch/sparc/include/asm/pgtable_32.h:17,
                 from ./arch/sparc/include/asm/pgtable.h:6,
                 from arch/sparc/kernel/traps_32.c:23:
Quoted 6 lines

include/linux/mm.h: In function 'is_vmalloc_addr':
include/linux/mm.h:371:17: error: 'VMALLOC_START' undeclared (first use in this function) include/linux/mm.h:371:17: note: each undeclared identifier is reported only once for each function it appears in include/linux/mm.h:371:41: error: 'VMALLOC_END' undeclared (first use in this function) include/linux/mm.h: In function 'maybe_mkwrite':
include/linux/mm.h:556:3: error: implicit declaration of function 'pte_mkwrite'

Hmm, this is a clear dependency between headers. I am not sure why this header is even needed. swap_entry is defined in linux/mm_types.h. Does the code compile if you replace this include by include <linux/mm_types.h>?

But maybe we should rather get rid of the include and make __swp_type, __swp_offset and __swp_entry macros and mimic 64b header. Something like the (untested) patch below:

Quoted 10 lines

In file included from include/linux/highmem.h:7:0,

                 from include/linux/bio.h:23,
                 from include/linux/writeback.h:192,
                 from include/linux/memcontrol.h:30,
                 from include/linux/swap.h:8,
                 from ./arch/sparc/include/asm/pgtable_32.h:17,
                 from ./arch/sparc/include/asm/pgtable.h:6,
                 from ./arch/sparc/include/asm/pgalloc_32.h:8,
                 from ./arch/sparc/include/asm/pgalloc.h:6,
                 from arch/sparc/kernel/sun4m_irq.c:16:
Quoted 6 lines

include/linux/mm.h: In function 'pte_lockptr':
include/linux/mm.h:1422:2: error: implicit declaration of function 'pmd_page' [-Werror=implicit-function-declaration] include/linux/mm.h:1422:2: error: passing argument 1 of 'ptlock_ptr' makes pointer from integer without a cast [-Werror] include/linux/mm.h:1396:27: note: expected 'struct page *' but argument is of type 'int' include/linux/mm.h: In function 'pgtable_init':
include/linux/mm.h:1465:2: error: implicit declaration of function 'pgtable_cache_init'

This falls into the same category.
---

arch/sparc/include/asm/pgtable_32.h +8 -16
index f06b36a00a3b..df5c9b16ea12 100644
@@ -348,22 +348,14 @@ void srmmu_mapiorange(unsigned int bus, unsigned long xpa,
 void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len);
 
 /* Encode and de-code a swap entry */
-static inline unsigned long __swp_type(swp_entry_t entry)
-{
-	return (entry.val >> SRMMU_SWP_TYPE_SHIFT) & SRMMU_SWP_TYPE_MASK;
-}
-
-static inline unsigned long __swp_offset(swp_entry_t entry)
-{
-	return (entry.val >> SRMMU_SWP_OFF_SHIFT) & SRMMU_SWP_OFF_MASK;
-}
-
-static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset)
-{
-	return (swp_entry_t) {
-		(type & SRMMU_SWP_TYPE_MASK) << SRMMU_SWP_TYPE_SHIFT
-		| (offset & SRMMU_SWP_OFF_MASK) << SRMMU_SWP_OFF_SHIFT };
-}
+#define __swp_type(entry)	(((entry).val >> SRMMU_SWP_TYPE_MASK) & SRMMU_SWP_TYPE_MASK)
+#define __swp_offset(entry) (((entry).val >> SRMMU_SWP_OFF_SHIFT) & SRMMU_SWP_OFF_MASK)
+#define __swp_entry(type, offset)	\
+	( (swp_entry_t) \
+	  { \
+	  	(((type) & SRMMU_SWP_TYPE_MASK) << SRMMU_SWP_TYPE_SHIFT | \
+	  	((offset) & SRMMU_SWP_OFF_MASK) << SRMMU_SWP_OFF_SHIFT) \
+	  } )
 
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })
Signature · 2 lines
Michal Hocko
SUSE Labs
#2 lore raw

Hi Michal,

Quoted 43 lines · Michal Hocko
Quoted 10 lines · Guenter Roeck

Hi,

Commit b65390c6c2178f ("memcg: export struct mem_cgroup") causes several build failures in -next (next-20150731) when trying to build sparc32:allmodconfig.

Below are some of the errors, as well as a bisect log.

Guenter

Quoted 9 lines

---
In file included from include/linux/pid_namespace.h:6:0,
from include/linux/ptrace.h:8,
from include/linux/ftrace.h:13,
from include/linux/init_task.h:8,
from init/init_task.c:1:
include/linux/mm.h: At top level:
include/linux/mm.h:888:7: error: conflicting types for 'page_address' ./arch/sparc/include/asm/highmem.h:59:10: note: previous implicit declaration of 'page_address' was here

This is weird:
* include/linux/mm.h:888

#if defined(HASHED_PAGE_VIRTUAL)
void *page_address(const struct page *page); void set_page_address(struct page *page, void *virtual); void page_address_init(void);
#endif

* arch/sparc/include/asm/highmem.h:59
static inline void *kmap(struct page *page)

{
        BUG_ON(in_interrupt());
        if (!PageHighMem(page))
                return page_address(page);
        return kmap_high(page);
}

How come we have conflicting types here. page_address is clearly not a function declaration in sparc code. Maybe something expands to an incomplete c construct.

Quoted 8 lines

I have tried to crosscompile with
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ but failed with strange errors.

$ PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=x86_64-linux- ARCH=sparc32 make allmodconfig
warning: (USB_OTG_FSM && FSL_USB2_OTG && USB_MV_OTG) selects USB_OTG which has unmet direct dependencies (USB_SUPPORT && USB && PM)
warning: (MFD_CROS_EC) selects CHROME_PLATFORMS which has unmet direct dependencies (X86 || ARM)
warning: (SND_SOC_ROCKCHIP_MAX98090 && SND_SOC_ROCKCHIP_RT5645) selects SND_SOC_ROCKCHIP_I2S which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && CLKDEV_LOOKUP && SND_SOC_ROCKCHIP)
$ PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=x86_64-linux- ARCH=sparc32 make

It's failing because you're trying to compile sparc32 code with an x86_64 compiler.

Try something like:
PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=sparc-linux- ARCH=sparc32 make

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
#3 lore raw
Quoted 6 lines · Julian Calaby

It's failing because you're trying to compile sparc32 code with an x86_64 compiler.

Try something like:
PATH=/mnt/share/devel/miso/crosstool/sparc/gcc-4.6.3-nolibc/x86_64-linux/bin:$PATH CROSS_COMPILE=sparc-linux- ARCH=sparc32 make

Ohh, right you are. I misunderstood and thought this was a x86 build of the compiler for sparc. This has worked out. It works now. Thanks a lot!

Signature · 2 lines
Michal Hocko
SUSE Labs
#4 lore raw

PATCH 1/1 sparc32: do not include swap.h from pgtable_32.h export struct mem_cgroup'

In reply to Guenter Roeck
Quoted 7 lines · Guenter Roeck

Hi,

Commit b65390c6c2178f ("memcg: export struct mem_cgroup") causes several build failures in -next (next-20150731) when trying to build sparc32:allmodconfig.

Below are some of the errors, as well as a bisect log.

The following patch should take care of the mess. I've tested it with all{no,mod}config and defconfig. allyesconfig fails due to unrelated issue but make mm/ succeeds.
---
From 3ca0dfa93b1418bcb9a8dc2860bf93f095f72399 Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 4 Aug 2015 14:31:28 +0200
Subject: [PATCH] sparc32: do not include swap.h from pgtable_32.h

"memcg: export struct mem_cgroup" has added few includes into linux/memcontro.h which led to further header dependency issues as reported by Guenter Roeck:

In file included from include/linux/highmem.h:7:0,

                 from include/linux/bio.h:23,
                 from include/linux/writeback.h:192,
                 from include/linux/memcontrol.h:30,
                 from include/linux/swap.h:8,
                 from ./arch/sparc/include/asm/pgtable_32.h:17,
                 from ./arch/sparc/include/asm/pgtable.h:6,
                 from arch/sparc/kernel/traps_32.c:23:

include/linux/mm.h: In function 'is_vmalloc_addr':
include/linux/mm.h:371:17: error: 'VMALLOC_START' undeclared (first use in this function) include/linux/mm.h:371:17: note: each undeclared identifier is reported only once for each function it appears in include/linux/mm.h:371:41: error: 'VMALLOC_END' undeclared (first use in this function) include/linux/mm.h: In function 'maybe_mkwrite':
include/linux/mm.h:556:3: error: implicit declaration of function 'pte_mkwrite'

The issue is that pgtable_32.h depends on swap.h to get swap_entry_t but that goes all the way down to linux/mm.h which wants to have VMALLOC_* which is defined later in pgtable_32.h, though.

swap_entry_t is defined in include/mm_types.h so it should be sufficient to include this header without more dependencies.

---
 arch/sparc/include/asm/pgtable_32.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/include/asm/pgtable_32.h +1 -1
index f06b36a00a3b..91b963a887b7 100644
@@ -14,7 +14,7 @@
 #include <asm-generic/4level-fixup.h>
 
 #include <linux/spinlock.h>
-#include <linux/swap.h>
+#include <linux/mm_types.h>
 #include <asm/types.h>
 #include <asm/pgtsrmmu.h>
 #include <asm/vaddrs.h>
Signature · 5 lines
2.1.4

-- 
Michal Hocko
SUSE Labs
author Tested-by on v1 1/1
#5 lore raw

Re: [PATCH] sparc32: do not include swap.h from pgtable_32.h export struct mem_cgroup'

Quoted 40 lines · Michal Hocko
Quoted 7 lines · Guenter Roeck

Hi,

Commit b65390c6c2178f ("memcg: export struct mem_cgroup") causes several build failures in -next (next-20150731) when trying to build sparc32:allmodconfig.

Below are some of the errors, as well as a bisect log.

The following patch should take care of the mess. I've tested it with all{no,mod}config and defconfig. allyesconfig fails due to unrelated issue but make mm/ succeeds.
---

Quoted 1 line

From 3ca0dfa93b1418bcb9a8dc2860bf93f095f72399 Mon Sep 17 00:00:00 2001

From: Michal Hocko <[email protected]>
Date: Tue, 4 Aug 2015 14:31:28 +0200
Subject: [PATCH] sparc32: do not include swap.h from pgtable_32.h

"memcg: export struct mem_cgroup" has added few includes into linux/memcontro.h which led to further header dependency issues as reported by Guenter Roeck:

In file included from include/linux/highmem.h:7:0,

                  from include/linux/bio.h:23,
                  from include/linux/writeback.h:192,
                  from include/linux/memcontrol.h:30,
                  from include/linux/swap.h:8,
                  from ./arch/sparc/include/asm/pgtable_32.h:17,
                  from ./arch/sparc/include/asm/pgtable.h:6,
                  from arch/sparc/kernel/traps_32.c:23:

include/linux/mm.h: In function 'is_vmalloc_addr':
include/linux/mm.h:371:17: error: 'VMALLOC_START' undeclared (first use in this function) include/linux/mm.h:371:17: note: each undeclared identifier is reported only once for each function it appears in include/linux/mm.h:371:41: error: 'VMALLOC_END' undeclared (first use in this function) include/linux/mm.h: In function 'maybe_mkwrite':
include/linux/mm.h:556:3: error: implicit declaration of function 'pte_mkwrite'

The issue is that pgtable_32.h depends on swap.h to get swap_entry_t but that goes all the way down to linux/mm.h which wants to have VMALLOC_* which is defined later in pgtable_32.h, though.

Quoted 5 lines

swap_entry_t is defined in include/mm_types.h so it should be sufficient to include this header without more dependencies.

Nice and simple fix.

Compiled allmodconfig. Also ran through a number of qemu tests, all successful.

Building sparc32:SS-5:qemu_sparc_defconfig ... running ..... passed Building sparc32:SS-20:qemu_sparc_defconfig ... running ..... passed Building sparc32:SS-600MP:qemu_sparc_defconfig ... running ..... passed Building sparc32:SS-5:qemu_sparc_smp_defconfig ... running ..... passed Building sparc32:SS-20:qemu_sparc_smp_defconfig ... running ..... passed Building sparc32:SS-600MP:qemu_sparc_smp_defconfig ... running ..... passed

Quoted 18 lines
---
  arch/sparc/include/asm/pgtable_32.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/include/asm/pgtable_32.h +1 -1
index f06b36a00a3b..91b963a887b7 100644
@@ -14,7 +14,7 @@
  #include <asm-generic/4level-fixup.h>
 
  #include <linux/spinlock.h>
-#include <linux/swap.h>
+#include <linux/mm_types.h>
  #include <asm/types.h>
  #include <asm/pgtsrmmu.h>
  #include <asm/vaddrs.h>