Skip to contentSkip to conversation

linux-next: build failure after merge of the akpm-current tree

PATCH Stephen Rothwell 2 participants 4 messages Feb 22, 2018 memblock and memory management initialization

lore
Share & tools
lore
#0 lore raw

Hi Andrew,

[As reported by Randy for uml ...]

After merging the akpm-current tree, today's linux-next build (sparc defconfig) failed like this:

/home/sfr/next/next/mm/page_alloc.c: In function 'memmap_init_zone':
/home/sfr/next/next/mm/page_alloc.c:5450:11: error: implicit declaration of function 'memblock_next_valid_pfn'; did you mean 'memblock_virt_alloc_low'? [-Werror=implicit-function-declaration]

     pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1;
           ^~~~~~~~~~~~~~~~~~~~~~~
           memblock_virt_alloc_low

Caused by commit

c3d8f8809701 ("mm: page_alloc: skip over regions of invalid pfns on UMA")

I have applied the following patch for today:

From: Stephen Rothwell <[email protected]>
Date: Thu, 22 Feb 2018 14:20:45 +1100
Subject: [PATCH] mm: page_alloc: skip over regions of invalid pfns on UMA fix

---
 include/linux/memblock.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/memblock.h +5 -0
index c2f1a6996fad..90e6845f44be 100644
@@ -423,6 +423,11 @@ static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
 {
 	return 0;
 }
+static inline unsigned long memblock_next_valid_pfn(unsigned long pfn,
+						    unsigned long max_pfn)
+{
+	return pfn;
+}
 #endif /* CONFIG_HAVE_MEMBLOCK */
 
 #endif /* __KERNEL__ */
Signature · 5 lines
2.16.1

-- 
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 4 lines · Stephen Rothwell

Hi Andrew,

[As reported by Randy for uml ...]

Quoted 8 lines

After merging the akpm-current tree, today's linux-next build (sparc defconfig) failed like this:

/home/sfr/next/next/mm/page_alloc.c: In function 'memmap_init_zone':
/home/sfr/next/next/mm/page_alloc.c:5450:11: error: implicit declaration of function 'memblock_next_valid_pfn'; did you mean 'memblock_virt_alloc_low'? [-Werror=implicit-function-declaration]

     pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1;
           ^~~~~~~~~~~~~~~~~~~~~~~
           memblock_virt_alloc_low

This is interesting. I thought that IS_ENABLED(CONFIG_HAVE_MEMBLOCK) would have the same meaning as ifdef CONFIG_HAVE_MEMBLOCK so the branch will never be considered. If that is not the case then I would rather reintroduce that ifdef. We already have those in the function anyway.

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

Hi Michal,

Quoted 5 lines · On Thu, 22 Feb 2018 08:11:00 +0100 Michal Hocko <[email protected]> wrote:

This is interesting. I thought that IS_ENABLED(CONFIG_HAVE_MEMBLOCK) would have the same meaning as ifdef CONFIG_HAVE_MEMBLOCK so the branch will never be considered. If that is not the case then I would rather reintroduce that ifdef. We already have those in the function anyway.

Actually, you don't need a definition of memblock_next_valid_pfn() in the !CONFIG_HAVE_MEMBLOCK case, just a declaration, so the minimal fix is to move the declaration out of the #ifdef CONFIG_HAVE_MEMBLOCK in the header file. That way if there is any use of memblock_next_valid_pfn() introduced that is no guarded by IS_ENABLED(CONFIG_HAVE_MEMBLOCK) the build will fail to link. I like IS_ENABLED() being used wherever possible because it allows us better compiler coverage (in the face of CONFIG options) even if the compiler then elides the actual code. It also breaks the code up less than #ifdef's.

Your choice, of course.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 9 lines · Stephen Rothwell

Hi Michal,

Quoted 5 lines · On Thu, 22 Feb 2018 08:11:00 +0100 Michal Hocko <[email protected]> wrote:

This is interesting. I thought that IS_ENABLED(CONFIG_HAVE_MEMBLOCK) would have the same meaning as ifdef CONFIG_HAVE_MEMBLOCK so the branch will never be considered. If that is not the case then I would rather reintroduce that ifdef. We already have those in the function anyway.

Quoted 4 lines

Actually, you don't need a definition of memblock_next_valid_pfn() in the !CONFIG_HAVE_MEMBLOCK case, just a declaration, so the minimal fix is to move the declaration out of the #ifdef CONFIG_HAVE_MEMBLOCK in the header file.

You are right.

Quoted 8 lines

That way if there is any use of memblock_next_valid_pfn() introduced that is no guarded by IS_ENABLED(CONFIG_HAVE_MEMBLOCK) the build will fail to link. I like IS_ENABLED() being used wherever possible because it allows us better compiler coverage (in the face of CONFIG options) even if the compiler then elides the actual code. It also breaks the code up less than #ifdef's.

Your choice, of course.

The function already has those ugly ifdefs so I would keep it consistent. Deuglyfying it would need a bigger stick.

Signature · 2 lines
Michal Hocko
SUSE Labs