diff mbox

scripts/kallsyms: filter symbols not in kernel address space

Message ID 201401071512.34016.arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Jan. 7, 2014, 2:12 p.m. UTC
On Monday 28 October 2013, Ming Lei wrote:
> This patch uses CONFIG_PAGE_OFFSET to filter symbols which
> are not in kernel address space because these symbols are
> generally for generating code purpose and can't be run at
> kernel mode, so we needn't keep them in /proc/kallsyms.
> 
> For example, on ARM there are some symbols which are
> linked in relocatable code section, then perf can't parse
> symbols any more from /proc/kallsyms, and this patch fixes
> the problem.
> 
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Michal Marek <mmarek@suse.cz>
> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>

Sorry for the late report, but I seem to have encountered a problem with this
patch, now that it has made it into all stable kernels.

When linking an ARM nommu kernel, I get the output "No valid symbol." twice,
from scripts/kallsyms. The problem evidently is that PAGE_OFFSET is still
set to 0xC0000000 on ARM NOMMU builds but the kernel is linked to start at
PLAT_PHYS_OFFSET instead, which may be elsehwere. For most platforms,
this is defined in Kconfig these days, so we could get away with


but there are still a few ARM platforms that define their own PLAT_PHYS_OFFSET
in memory.h, and it wouldn't help on non-ARM systems that might have the same
problem.

	Arnd

Comments

Ming Lei Jan. 7, 2014, 2:33 p.m. UTC | #1
Hi Arnd,

On Tue, Jan 7, 2014 at 10:12 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday 28 October 2013, Ming Lei wrote:
>> This patch uses CONFIG_PAGE_OFFSET to filter symbols which
>> are not in kernel address space because these symbols are
>> generally for generating code purpose and can't be run at
>> kernel mode, so we needn't keep them in /proc/kallsyms.
>>
>> For example, on ARM there are some symbols which are
>> linked in relocatable code section, then perf can't parse
>> symbols any more from /proc/kallsyms, and this patch fixes
>> the problem.
>>
>> Cc: Russell King <linux@arm.linux.org.uk>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: Michal Marek <mmarek@suse.cz>
>> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>
> Sorry for the late report, but I seem to have encountered a problem with this
> patch, now that it has made it into all stable kernels.
>
> When linking an ARM nommu kernel, I get the output "No valid symbol." twice,
> from scripts/kallsyms. The problem evidently is that PAGE_OFFSET is still
> set to 0xC0000000 on ARM NOMMU builds but the kernel is linked to start at
> PLAT_PHYS_OFFSET instead, which may be elsehwere. For most platforms,
> this is defined in Kconfig these days, so we could get away with
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index d1e4098..c477a7c 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1592,6 +1592,7 @@ endchoice
>
>  config PAGE_OFFSET
>         hex
> +       default PHYS_OFFSET if !MMU
>         default 0x40000000 if VMSPLIT_1G
>         default 0x80000000 if VMSPLIT_2G
>         default 0xC0000000
>
> but there are still a few ARM platforms that define their own PLAT_PHYS_OFFSET
> in memory.h, and it wouldn't help on non-ARM systems that might have the same
> problem.

We had posted two patches to address the problem, see below link:

   http://lists.scusting.com/index.php?t=msg&goto=1726509&S=Google


Thanks,
Arnd Bergmann Jan. 7, 2014, 3:05 p.m. UTC | #2
On Tuesday 07 January 2014 22:33:24 Ming Lei wrote:
> On Tue, Jan 7, 2014 at 10:12 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Monday 28 October 2013, Ming Lei wrote:
> 
> We had posted two patches to address the problem, see below link:
> 
>    http://lists.scusting.com/index.php?t=msg&goto=1726509&S=Google

The patch "scripts/link-vmlinux.sh: only filter kernel symbols for arm"
has made it in now, which is good for all other architectures, but it
makes no difference  for nommu-arm, because CONFIG_PAGE_OFFSET is
still set.

The second patch from Jonathan Austin has not been applied yet, as of
today's linux-next, and it's exactly what I suggested. However it
won't work on ARM platforms that define their own PLAT_PHYS_OFFSET:
ebsa110, ep93xx, exynos, footbridge, integrator, iop13xx, ks8695,
omap1, realview, rpc, s5pv210 and sa1100. Fortunately these all have
MMUs, so in practice it won't hurt, but it doesn't seem correct.

	Arnd
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d1e4098..c477a7c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1592,6 +1592,7 @@  endchoice
 
 config PAGE_OFFSET
 	hex
+	default PHYS_OFFSET if !MMU
 	default 0x40000000 if VMSPLIT_1G
 	default 0x80000000 if VMSPLIT_2G
 	default 0xC0000000