linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tejun Heo <tj@kernel.org>, hacklu <embedway.linux@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] x86, boot: Optimize the elf header handling.
Date: Sun, 01 Jul 2012 12:20:25 -0700	[thread overview]
Message-ID: <87sjdb8f0m.fsf@xmission.com> (raw)
In-Reply-To: <4FF098E2.3040307@zytor.com> (H. Peter Anvin's message of "Sun, 01 Jul 2012 11:37:22 -0700")

"H. Peter Anvin" <hpa@zytor.com> 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
hack.

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.

Sigh.

I feel like I have stumbled into pandoras box.

Eric


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


> 	-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)
+LDFLAGS := -m elf_$(UTS_MACHINE) -z max-page-size=4096
 
 # Speed up the build
 KBUILD_CFLAGS += -pipe



  reply	other threads:[~2012-07-01 19:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17  5:56 why the decompressed procedure move kernel from address 0x100000(1M) to 0x1000000(16M) +x hacklu
2012-06-02 23:48 ` Eric W. Biederman
2012-06-03  3:10   ` H. Peter Anvin
2012-06-03  8:41     ` Eric W. Biederman
2012-06-03 13:01       ` H. Peter Anvin
2012-06-03 20:30         ` [PATCH 1/2] x86, boot: Don't overlap the compressed and non-compressed image Eric W. Biederman
2012-06-03 20:32           ` [PATCH 2/2] x86, boot: Optimize the elf header handling Eric W. Biederman
2012-07-01 14:56             ` [tip:x86/boot] " tip-bot for Eric W. Biederman
2012-07-01 15:04             ` [PATCH 2/2] " H. Peter Anvin
2012-07-01 15:34               ` H. Peter Anvin
2012-07-01 16:08                 ` Eric W. Biederman
2012-07-01 16:11                   ` H. Peter Anvin
2012-07-01 16:26                     ` Eric W. Biederman
2012-07-01 16:44                       ` H. Peter Anvin
2012-07-01 17:09                         ` Eric W. Biederman
2012-07-01 17:15                           ` H. Peter Anvin
2012-07-01 18:25                             ` Eric W. Biederman
2012-07-01 18:37                               ` H. Peter Anvin
2012-07-01 19:20                                 ` Eric W. Biederman [this message]
2012-07-01 19:23                                   ` H. Peter Anvin
2012-07-01 20:40                                     ` Eric W. Biederman
2012-07-01 20:52                                       ` H. Peter Anvin
2012-07-09  6:50                                         ` Eric W. Biederman
2012-07-09  6:52                                           ` [PATCH 1/4] x86 boot: Jump to the entry point address in the elf header Eric W. Biederman
2012-07-09  6:53                                             ` [PATCH 2/4] x86 boot: Optimize the elf header handling Eric W. Biederman
2012-07-09  6:55                                             ` [PATCH 3/4] x86 boot: When building vmlinux.bin properly precompute the memory image Eric W. Biederman
2012-07-09  6:56                                             ` [PATCH 4/4] x86 boot: Tell ld the kernel doesn't want 2MB file offset alignment Eric W. Biederman
2012-07-09  6:59                                             ` [PATCH 1/4] x86 boot: Jump to the entry point address in the elf header Eric W. Biederman
2012-07-02 16:56                                 ` [PATCH 2/2] x86, boot: Optimize the elf header handling Tejun Heo
2012-07-09  7:03                                   ` Eric W. Biederman
2012-07-01  2:23           ` [PATCH 1/2] x86, boot: Don't overlap the compressed and non-compressed image Eric W. Biederman
2012-07-01  2:32             ` H. Peter Anvin
2012-07-01  5:22               ` Eric W. Biederman
2012-07-01 14:55           ` [tip:x86/boot] x86, boot: Don' t " tip-bot for Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjdb8f0m.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=embedway.linux@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).