Skip to contentSkip to conversation

-tip: origin tree build failure

PATCH Ingo Molnar 2 participants 5 messages Dec 17, 2009 – Dec 18, 2009

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

Today's -tip fails to build due to upstream commit 1a9b5b7fe0c5dad8a635288882d36785dea742f9 ("mm: export stable page flags") (authored and merged yesterday) causing the following build failure on x86 when CONFIG_PROC_PAGE_MONITOR is disabled:

mm/built-in.o: In function `hwpoison_filter':
(.text+0x39fbf): undefined reference to `stable_page_flags'

The bug is that the stable_page_flags() API is only available under CONFIG_PROC_PAGE_MONITOR, but utilized in mm/memory-failure.c unconditionally.

I've applied the patch below to -tip for now, which expresses this dependency in the Kconfig. (Eventually a cleaner solution would be to factor such ABI details out of procfs, they dont belong there.)

A technical critique: as i pointed it out in the past on lkml, this whole ad-hoc exporting of MM details via /proc is ill advised. It's a limiting interface for instrumentation (we could do so much more and could integrate it so much better with a similar amount of intrusion), and it also creates needless ABI dependencies with user-space tooling.

This should be prototyped in debugfs and sufficiently integrated with other instrumentation frameworks in the kernel. I made a few suggestions and we even wrote patches in the past to help that out:

3383e37: tracing, page-allocator: Add a postprocessing script for page-allocator-related ftrace events
c33b359: tracing, page-allocator: Add trace event for page traffic related to the buddy lists 0d524fb: tracing, mm: Add trace events for anti-fragmentation falling back to other migratetypes
b9a2817: tracing, page-allocator: Add trace events for page allocation and page freeing
eb46710: tracing/mm: rename 'trigger' file to 'dump_range'
1487a7a: tracing/mm: fix mapcount trace record field
dcac8cd: tracing/mm: add page frame snapshot trace

Unfortunately nothing of that was pursued from the MM and hwpoison side and now this inferior version goes upstream, and as two separate ABIs straight away. (the /proc ABI and the memory-failure filter ABI) Not very well designed and not very helpful IMO, and this will come back to haunt us in the future.

We know how to do this correctly, why not embrace, utilize and expand those instrumentation facilities?

Also, a workflow observation - i tried to figure out the history of the bug but the Git timestamps show this weirdness:

commit 1a9b5b7fe0c5dad8a635288882d36785dea742f9
Author: Wu Fengguang <[email protected]>
AuthorDate: Wed Dec 16 12:19:59 2009 +0100
Commit: Andi Kleen <[email protected]>
CommitDate: Wed Dec 16 12:19:59 2009 +0100

that's precisely the same author and commit date, but author and committer are different - how is that possible? No combination of git-am, git-rebase and git commit --amend can achieve this kind of timestamp.

I checked the other 'HWPOISON' commits as well that were merged yesterday - they have a similarly damaged history.

Thanks,

Ingo

mm/Kconfig +1 -0
index 43ea8c3..d7bd560 100644
@@ -243,6 +243,7 @@ config ARCH_SUPPORTS_MEMORY_FAILURE
 config MEMORY_FAILURE
 	depends on MMU
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
+	select PROC_PAGE_MONITOR
 	bool "Enable recovery from hardware memory errors"
 	help
 	  Enables code to recover from some memory failures on systems
#1 lore raw

Review

Quoted 5 lines · Ingo Molnar

config MEMORY_FAILURE

(quoted diff) +1 -0
 	depends on MMU
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
+	select PROC_PAGE_MONITOR
 	bool "Enable recovery from hardware memory errors"

It also needs to depend on PROC_FS in that case - as per the updated patch below.

Ingo

----------------->

Quoted 1 line

From 896358c0554c56398d40191dda24da8c4b8029c4 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Thu, 17 Dec 2009 10:40:41 +0100
Subject: [PATCH] hwpoison: fix build failure

Today's -tip fails to build due to upstream commit 1a9b5b7fe0c5dad8a635288882d36785dea742f9 ("mm: export stable page flags") (authored and merged yesterday) causing the following build failure on x86 when CONFIG_PROC_PAGE_MONITOR is disabled:

mm/built-in.o: In function `hwpoison_filter':
(.text+0x39fbf): undefined reference to `stable_page_flags'

The bug is that the stable_page_flags() API is only available under CONFIG_PROC_PAGE_MONITOR, but utilized in mm/memory-failure.c unconditionally.

I've applied the patch below to -tip for now, which expresses this dependency in the Kconfig. (Eventually a cleaner solution would be to factor such ABI details out of procfs, they dont belong there.)

Cc: Peter Zijlstra <[email protected]>
Cc: Matt Mackall <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Fr??d??ric Weisbecker <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>

---
 mm/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
mm/Kconfig +2 -0
index 43ea8c3..021bc12 100644
@@ -243,6 +243,8 @@ config ARCH_SUPPORTS_MEMORY_FAILURE
 config MEMORY_FAILURE
 	depends on MMU
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
+	depends on PROC_FS
+	select PROC_PAGE_MONITOR
 	bool "Enable recovery from hardware memory errors"
 	help
 	  Enables code to recover from some memory failures on systems
#2 lore raw
Quoted 10 lines · Ingo Molnar

Review

Quoted 5 lines · Ingo Molnar

config MEMORY_FAILURE

(quoted diff) +1 -0
 	depends on MMU
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
+	select PROC_PAGE_MONITOR
 	bool "Enable recovery from hardware memory errors"

It also needs to depend on PROC_FS in that case - as per the updated patch below.

Thanks for the report.

MEMORY_FAILURE itself doesn't depend on the page flags, just the injector which has a separate config option. It already has a select PROC_PAGE_MONITOR, but the proc dependency is indeed missing.

I think the correct fix is the appended patch.

-Andi

---

HWPOISON: Add PROC_FS dependency to hwpoison injector

The injector filter requires stable_page_flags() which is supplied by procfs. So make it dependent on that.

Reported by Ingo Molnar

---
 mm/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/Kconfig +1 -1
Index: linux/mm/Kconfig
===================================================================
@@ -252,7 +252,7 @@ config MEMORY_FAILURE
 
 config HWPOISON_INJECT
 	tristate "HWPoison pages injector"
-	depends on MEMORY_FAILURE && DEBUG_KERNEL
+	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
 	select PROC_PAGE_MONITOR
 
 config NOMMU_INITIAL_TRIM_EXCESS
#3 lore raw
Quoted 13 lines · Andi Kleen
Quoted 10 lines · Ingo Molnar

Review

Quoted 5 lines · Ingo Molnar

config MEMORY_FAILURE

(quoted diff) +1 -0
 	depends on MMU
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
+	select PROC_PAGE_MONITOR
 	bool "Enable recovery from hardware memory errors"

It also needs to depend on PROC_FS in that case - as per the updated patch below.

Quoted 7 lines

Thanks for the report.

MEMORY_FAILURE itself doesn't depend on the page flags, just the injector which has a separate config option. It already has a select PROC_PAGE_MONITOR, but the proc dependency is indeed missing.

I think the correct fix is the appended patch.

No, your patch is not the correct fix. As i said, PROC_PAGE_MONITOR provides the facility and mm/memory-failure.c uses that facility - and your patch does not solve that fundamental dependency issue, it just fudges around the dependencies.

So your patch can still produce the same kind of build failure (with other Kconfig variations):

mm/built-in.o: In function `hwpoison_filter':
(.text+0x430ba): undefined reference to `stable_page_flags'

This should be cleaned up for real - there's no reason why stable_page_flags() (which is an MM facility) should live in fs/proc/. That's the root of the problem.

Also a few more (very small) nits:

Quoted 1 line

HWPOISON: Add PROC_FS dependency to hwpoison injector

It would be really useful if hwpoison commit titles were in lower case, like most other commits in the kernel do? Upper-case is used in special cases - IMO this case does not qualify.

Quoted 4 lines

The injector filter requires stable_page_flags() which is supplied by procfs. So make it dependent on that.

Reported by Ingo Molnar

FYI, we have a Reported-by tag that can be (and should be) used in such cases.

Thanks,

Ingo

#4 lore raw
Quoted 4 lines

No, your patch is not the correct fix. As i said, PROC_PAGE_MONITOR provides the facility and mm/memory-failure.c uses that facility - and your patch does not solve that fundamental dependency issue, it just fudges around the dependencies.

Thanks for the report.

The filter is really part of the injector, even if it happens to be in the other file. I first resisted adding an ifdef to it, but it seems we need it. I think I forgot to set to set CONFIG_EMBEDDED earlier, that is what made the earlier build test pass even when it shouldn't have.

This updated patch should fix it. I tried to build test all applicable combinations, if anything is still missing please let me know.

-Andi

---

HWPOISON: Add PROC_FS dependency to hwpoison injector v2

The injector filter requires stable_page_flags() which is supplied by procfs. So make it dependent on that.

Also add ifdefs around the filter code in memory-failure.c so that when the filter is disabled due to missing dependencies the whole code still builds.

Reported-by Ingo Molnar
---
 mm/Kconfig          |    2 +-
 mm/memory-failure.c |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
mm/Kconfig +1 -1
Index: linux/mm/Kconfig
===================================================================
@@ -252,7 +252,7 @@ config MEMORY_FAILURE
 
 config HWPOISON_INJECT
 	tristate "HWPoison pages injector"
-	depends on MEMORY_FAILURE && DEBUG_KERNEL
+	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
 	select PROC_PAGE_MONITOR
 
 config NOMMU_INITIAL_TRIM_EXCESS
mm/memory-failure.c +9 -0
Index: linux/mm/memory-failure.c
===================================================================
@@ -52,6 +52,8 @@ int sysctl_memory_failure_recovery __rea
 
 atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0);
 
+#if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE)
+
 u32 hwpoison_filter_enable = 0;
 u32 hwpoison_filter_dev_major = ~0U;
 u32 hwpoison_filter_dev_minor = ~0U;
@@ -164,6 +166,13 @@ int hwpoison_filter(struct page *p)
 
 	return 0;
 }
+#else
+int hwpoison_filter(struct page *p)
+{
+	return 0;
+}
+#endif
+
 EXPORT_SYMBOL_GPL(hwpoison_filter);
 
 /*