[lkml]   [2012]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patches in this message
SubjectRe: [PATCH 2/2] x86, boot: Optimize the elf header handling.
"H. Peter Anvin" <> writes:

> On 07/01/2012 11:25 AM, Eric W. Biederman wrote:
>> Well I see what is going on now.
>> In the vmlinux the paddrs and the poffsests stop tracking when they
>> come to the percpu PT_LOAD segment.
>> It looks like we give the percpu segment a 4K alignment in memory
>> and a 2M alignment in the file.
>> It looks like something is causing ld to compute an unfortunate physical
>> load address for the percpu section.
>> At first glace I would say that is a bug. Either we need the alignment
>> or we don't. But if we need the alignment we certainly need it to
>> be respected for the real memory locations of the init symbols..
> If we don't need it, I think we can use -z max-page-size=4096, but we
> use the PMD alignment for percpu on x86-64; Tejun, does that apply to
> the .data..percpu section in the executable as well?

Grumble Grumble.

If I force a 2M alignment, poffsets and paddrs align and my previous
patches work. Although I don't expect that to be more than a testing

Meanwhile if I force a 4K max page size for most purposes things look
better from a file offset perspective. But the data segment is now less
aligned in the file than it is in memory and my patches don't work.


I feel like I have stumbled into pandoras box.


diff --git a/arch/x86/kernel/ b/arch/x86/kernel/
index af6fb8a..7276d44 100644
--- a/arch/x86/kernel/
+++ b/arch/x86/kernel/
@@ -187,6 +187,7 @@ SECTIONS
* output PHDR, so the next output section - .init.text - should
* start another segment - init.
+ . = ALIGN(0x200000);

> -hpa

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1f25214..b5b31c3 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -120,7 +120,7 @@ avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)

+LDFLAGS := -m elf_$(UTS_MACHINE) -z max-page-size=4096

# Speed up the build

 \ /
  Last update: 2012-07-01 22:01    [W:0.074 / U:2.468 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site