Re: [RFC] ELF Relocatable x86 and x86_64 bzImages

Eric W. Biederman
2006-08-08T07:24:03Z

Horms <horms@verge.net.au> writes:

> On Mon, Aug 07, 2006 at 09:32:23PM -0700, H. Peter Anvin wrote:
>> Horms wrote:
>> >
>> >I also agree that it is non-intitive. But I wonder if a cleaner
>> >fix would be to remove CONFIG_PHYSICAL_START all together. Isn't
>> >it just a work around for the kernel not being relocatable, or
>> >are there uses for it that relocation can't replace?
>> >
>>
>> Yes, booting with the 2^n existing bootloaders.
>
> Ok, I must be confused then. I though CONFIG_PHYSICAL_START was
> introduced in order to allow an alternative address to be provided for
> kdump, and that previously it was hard-coded to some
> architecture-specific value.
>
> What I was really getting as is if it needs to be configurable at
> compile time or not. Obviously there needs to be some sane default
> regardless.

CONFIG_PHYSICAL_START has had 2 uses.
1) To allow a kernel to run a completely different address for use
with kexec on panic.
2) To allow the kernel to be better aligned for better performance.

For maintenance reasons I propose we introduce CONFIG_PHYSICAL_ALIGN.
Which will round our load address up to the nearest aligned address
and run the kernel there. That is roughly what I am doing on x86_64
at this point.

s/CONFIG_PHYSICAL_START/CONFIG_PHYSICAL_ALIGN/ gives me well defined
behavior and allows the alignment optimization without getting into
weird semantics.

Before CONFIG_PHYSICAL_START we _always_ ran the arch/i386 kernel
where it was loaded and I assumed we always would. Since people have
realized better aligned kernels can run better this assumption became
false. Going to CONFIG_PHYSICAL_ALIGN allows us to return to the
simple assumption of always running the kernel where it is loaded
modulo a little extra alignment.

Eric