linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/link-vmlinux.sh: correct base address for some ARM special cases
@ 2014-02-26 11:11 Uwe Kleine-König
  2014-02-26 11:15 ` Russell King - ARM Linux
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2014-02-26 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

The toolchain problem described in commit f6537f2f0eba
(scripts/kallsyms: filter symbols not in kernel address space) makes it
necessary to filter out some kernel symbols from /proc/kallsyms to make
perf happy.

For that to work correctly the address used to filter should be just
below the kernel text segment. Depending on kernel configuration
CONFIG_PAGE_OFFSET is not the right address to use. See the comments
introduced by this commit for the glory details.

Fixes: b9b32bf70f2f (ARM: use linker magic for vectors and vector stubs)
Cc: stable at vger.kernel.org
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
Hello,

note I'm not entirely sure if the diagnose "toolchain problem" is right.
That's what Arnd suggested in #armlinux. So maybe the commit log wants
some fixing.

This is probably stable material as 7122c3e9154b and f6537f2f0eba were
considered for stable, too. As b9b32bf70f2f has a stable annotation,
too, maybe older stable kernel also need fixing.

Other than that I wonder if "--page-offset" is a misnomer. Better use
"--kernel-start"?  I didn't do this change here because patches for
stable should be minimal. But maybe it's worth a followup patch?

Best regards
Uwe

 scripts/link-vmlinux.sh | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 2dcb37736d84..493b4ccdf5fc 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -82,8 +82,24 @@ kallsyms()
 		kallsymopt="${kallsymopt} --all-symbols"
 	fi
 
-	if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then
-		kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
+	if [ -n "${CONFIG_ARM}" ]; then
+		# There are some ARM toolchains that generate some internal
+		# symbols that then appear in /proc/kallsyms and these disturbe
+		# perf. So filter out all symbols below PAGE_OFFSET.
+		# ARM is a bit complicated here. The page-offset isn't
+		# completely determined in Kconfig as of 3.14-rc. Without MMU
+		# it's not CONFIG_PAGE_OFFSET that is used but (indirectly)
+		# CONFIG_DRAM_BASE. But for XIP we want the XIP PHYS_ADDR
+		# though.
+		if [ -n "${CONFIG_XIP_PHYS_ADDR}" ]; then
+			page_offset="${CONFIG_XIP_PHYS_ADDR}"
+		elif [ -z "${CONFIG_MMU}" ]; then
+			page_offset="${CONFIG_DRAM_BASE}"
+		else
+			page_offset="$CONFIG_PAGE_OFFSET"
+		fi
+
+		kallsymopt="${kallsymopt} --page-offset=$page_offset"
 	fi
 
 	local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-26 14:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-26 11:11 [PATCH] scripts/link-vmlinux.sh: correct base address for some ARM special cases Uwe Kleine-König
2014-02-26 11:15 ` Russell King - ARM Linux
2014-02-26 13:46   ` Uwe Kleine-König
2014-02-26 13:53     ` Russell King - ARM Linux
2014-02-26 14:02       ` Arnd Bergmann
2014-02-26 14:06       ` Uwe Kleine-König
2014-02-26 14:16         ` Arnd Bergmann
2014-02-26 14:18           ` Arnd Bergmann
2014-02-26 14:32         ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).