public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment
@ 2010-06-05 18:14 Mike Frysinger
  2010-06-05 18:14 ` [PATCH 2/2] Blackfin: use " Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-06-05 18:14 UTC (permalink / raw)
  To: Tim Abbott; +Cc: linux-kernel

Add a new INIT_RAMFS() define to compliment the existing INIT_RAM_FS, but
this one lets people control the alignment.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/asm-generic/vmlinux.lds.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 48c5299..9ca268f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -619,14 +619,15 @@
 		VMLINUX_SYMBOL(__security_initcall_end) = .;
 
 #ifdef CONFIG_BLK_DEV_INITRD
-#define INIT_RAM_FS							\
-	. = ALIGN(PAGE_SIZE);						\
+#define INIT_RAMFS(align)						\
+	. = ALIGN(align);						\
 	VMLINUX_SYMBOL(__initramfs_start) = .;				\
 	*(.init.ramfs)							\
 	VMLINUX_SYMBOL(__initramfs_end) = .;
 #else
-#define INIT_RAM_FS
+#define INIT_RAMFS(align)
 #endif
+#define INIT_RAM_FS INIT_RAMFS(PAGE_SIZE)
 
 /*
  * Default discarded sections.
-- 
1.7.1


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

* [PATCH 2/2] Blackfin: use smaller rootfs alignment
  2010-06-05 18:14 [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment Mike Frysinger
@ 2010-06-05 18:14 ` Mike Frysinger
  2010-06-07 23:27 ` [PATCH 1/2] vmlinux.lds.h: allow people to set a " Tim Abbott
  2010-06-09  7:20 ` Milton Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-06-05 18:14 UTC (permalink / raw)
  To: Tim Abbott; +Cc: linux-kernel

No need for the rootfs to be aligned to a page since we load it up and
free it during boot.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/kernel/vmlinux.lds.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 984c781..622d780 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -158,7 +158,7 @@ SECTIONS
 		INIT_CALLS
 		CON_INITCALL
 		SECURITY_INITCALL
-		INIT_RAM_FS
+		INIT_RAMFS(4)
 
 		. = ALIGN(4);
 		___per_cpu_load = .;
-- 
1.7.1


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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment
  2010-06-05 18:14 [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment Mike Frysinger
  2010-06-05 18:14 ` [PATCH 2/2] Blackfin: use " Mike Frysinger
@ 2010-06-07 23:27 ` Tim Abbott
  2010-06-09  7:20 ` Milton Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Tim Abbott @ 2010-06-07 23:27 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel

Hi Mike,

Both patches look good.  Please consider them:

Acked-by: Tim Abbott <tabbott@ksplice.com>

	-Tim Abbott

On Sat, 5 Jun 2010, Mike Frysinger wrote:

> Add a new INIT_RAMFS() define to compliment the existing INIT_RAM_FS, but
> this one lets people control the alignment.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  include/asm-generic/vmlinux.lds.h |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 48c5299..9ca268f 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -619,14 +619,15 @@
>  		VMLINUX_SYMBOL(__security_initcall_end) = .;
>  
>  #ifdef CONFIG_BLK_DEV_INITRD
> -#define INIT_RAM_FS							\
> -	. = ALIGN(PAGE_SIZE);						\
> +#define INIT_RAMFS(align)						\
> +	. = ALIGN(align);						\
>  	VMLINUX_SYMBOL(__initramfs_start) = .;				\
>  	*(.init.ramfs)							\
>  	VMLINUX_SYMBOL(__initramfs_end) = .;
>  #else
> -#define INIT_RAM_FS
> +#define INIT_RAMFS(align)
>  #endif
> +#define INIT_RAM_FS INIT_RAMFS(PAGE_SIZE)
>  
>  /*
>   * Default discarded sections.
> -- 
> 1.7.1
> 
> 

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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment
  2010-06-05 18:14 [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment Mike Frysinger
  2010-06-05 18:14 ` [PATCH 2/2] Blackfin: use " Mike Frysinger
  2010-06-07 23:27 ` [PATCH 1/2] vmlinux.lds.h: allow people to set a " Tim Abbott
@ 2010-06-09  7:20 ` Milton Miller
  2010-06-09  7:42   ` Mike Frysinger
  2 siblings, 1 reply; 8+ messages in thread
From: Milton Miller @ 2010-06-09  7:20 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel, Tim Abbott, H. Peter Anvin


On Sat,  5 Jun 2010 at around 14:14:45 -0400, Mike Frysinger wrote:
> Add a new INIT_RAMFS() define to compliment the existing INIT_RAM_FS, but
> this one lets people control the alignment.
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 48c5299..9ca268f 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -619,14 +619,15 @@ 
>  		VMLINUX_SYMBOL(__security_initcall_end) = .;
>  
>  #ifdef CONFIG_BLK_DEV_INITRD
> -#define INIT_RAM_FS							\
> -	. = ALIGN(PAGE_SIZE);						\
> +#define INIT_RAMFS(align)						\
> +	. = ALIGN(align);						\
>  	VMLINUX_SYMBOL(__initramfs_start) = .;				\
>  	*(.init.ramfs)							\
>  	VMLINUX_SYMBOL(__initramfs_end) = .;
>  #else
> -#define INIT_RAM_FS
> +#define INIT_RAMFS(align)
>  #endif
> +#define INIT_RAM_FS INIT_RAMFS(PAGE_SIZE)
>  

[ and patch 2/2 calls the new macro with align 4, for only blackfin ].

Mike,
As you identified, the alignment for the __initramfs is too large.

As can be seen by the grammer of the INIT_RAM_FS in [1], the section
itself always requires alignment of exactly 4 [2].

I realize it requires a bit more auditing and cordination, but we
should really just change the macro to align to 4.

[1] Documentation/early-userspace/buffer-format.txt,
[2] for the general case; as compressed fragments are aligin(1)

milton

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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs  alignment
  2010-06-09  7:20 ` Milton Miller
@ 2010-06-09  7:42   ` Mike Frysinger
  2010-06-09  7:51     ` Geert Uytterhoeven
  2010-06-11  5:50     ` H. Peter Anvin
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-06-09  7:42 UTC (permalink / raw)
  To: Milton Miller; +Cc: linux-kernel, Tim Abbott, H. Peter Anvin

On Wed, Jun 9, 2010 at 03:20, Milton Miller wrote:
> On Sat,  5 Jun 2010 at around 14:14:45 -0400, Mike Frysinger wrote:
>> Add a new INIT_RAMFS() define to compliment the existing INIT_RAM_FS, but
>> this one lets people control the alignment.
>>
>> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
>> index 48c5299..9ca268f 100644
>> --- a/include/asm-generic/vmlinux.lds.h
>> +++ b/include/asm-generic/vmlinux.lds.h
>> @@ -619,14 +619,15 @@
>>               VMLINUX_SYMBOL(__security_initcall_end) = .;
>>
>>  #ifdef CONFIG_BLK_DEV_INITRD
>> -#define INIT_RAM_FS                                                  \
>> -     . = ALIGN(PAGE_SIZE);                                           \
>> +#define INIT_RAMFS(align)                                            \
>> +     . = ALIGN(align);                                               \
>>       VMLINUX_SYMBOL(__initramfs_start) = .;                          \
>>       *(.init.ramfs)                                                  \
>>       VMLINUX_SYMBOL(__initramfs_end) = .;
>>  #else
>> -#define INIT_RAM_FS
>> +#define INIT_RAMFS(align)
>>  #endif
>> +#define INIT_RAM_FS INIT_RAMFS(PAGE_SIZE)
>
> [ and patch 2/2 calls the new macro with align 4, for only blackfin ].
>
> Mike,
> As you identified, the alignment for the __initramfs is too large.
>
> As can be seen by the grammer of the INIT_RAM_FS in [1], the section
> itself always requires alignment of exactly 4 [2].
>
> I realize it requires a bit more auditing and cordination, but we
> should really just change the macro to align to 4.
>
> [1] Documentation/early-userspace/buffer-format.txt,
> [2] for the general case; as compressed fragments are aligin(1)

the back story is to bring the alignment back to the way it was before
for Blackfin systems, not to drop it down to some min value.  so dont
credit me with too much here ;).

if we look at the alignments before the unification, we can easily see
why Tim was a bit cautious and started the common value at PAGE_SIZE:
alpha: PAGE_SIZE
arm: 32
avr32: 32
blackfin: 4
cris: none (so default from the input sections == 4?)
frv: 4096 (== PAGE_SIZE?)
h8300: 4
ia64: none (so default from the input sections == 4?)
m32r: 4096 (== PAGE_SIZE?)
m68k: 8192 (== 2x PAGE_SIZE?)
microblaze: 4096 (== PAGE_SIZE?)
mips: PAGE_SIZE
mn10300: PAGE_SIZE
parisc: PAGE_SIZE
powerpc: PAGE_SIZE
s390: 0x100
score: PAGE_SIZE
sh: PAGE_SIZE
sparc: PAGE_SIZE
x86: PAGE_SIZE
xtensa: 4096 (== PAGE_SIZE?)

i have no problem changing the default to 4 since it works fine on
Blackfin systems.  your analysis of the source alignment also seems
reasonable ... i assume that the 8 byte fields in the source cpio
arent referenced directly, otherwise it'd cause problems on 64bit
systems that require 64bit values to be naturally aligned.

beyond that, i dont see why any larger alignment values would be
required since this source archive isnt executed directly.  it gets
expanded into a ramfs and then freed with the rest of the init stuff.
-mike

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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs  alignment
  2010-06-09  7:42   ` Mike Frysinger
@ 2010-06-09  7:51     ` Geert Uytterhoeven
  2010-06-11  5:50     ` H. Peter Anvin
  1 sibling, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2010-06-09  7:51 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Milton Miller, linux-kernel, Tim Abbott, H. Peter Anvin

On Wed, Jun 9, 2010 at 09:42, Mike Frysinger <vapier.adi@gmail.com> wrote:
> if we look at the alignments before the unification, we can easily see
> why Tim was a bit cautious and started the common value at PAGE_SIZE:

> m68k: 8192 (== 2x PAGE_SIZE?)

For Sun 3, PAGE_SIZE is 8192, not 4096. So it's the maximum page size on m68k.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment
  2010-06-09  7:42   ` Mike Frysinger
  2010-06-09  7:51     ` Geert Uytterhoeven
@ 2010-06-11  5:50     ` H. Peter Anvin
  2010-06-11  7:30       ` Milton Miller
  1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2010-06-11  5:50 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Milton Miller, linux-kernel, Tim Abbott

On 06/09/2010 12:42 AM, Mike Frysinger wrote:
> 
> i have no problem changing the default to 4 since it works fine on
> Blackfin systems.  your analysis of the source alignment also seems
> reasonable ... i assume that the 8 byte fields in the source cpio
> arent referenced directly, otherwise it'd cause problems on 64bit
> systems that require 64bit values to be naturally aligned.
> 
> beyond that, i dont see why any larger alignment values would be
> required since this source archive isnt executed directly.  it gets
> expanded into a ramfs and then freed with the rest of the init stuff.
> 

We have talked for a long time about incrementally freeing the initramfs
as it is decoded, which might help systems which are using most of their
memory for an initramfs image...

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment
  2010-06-11  5:50     ` H. Peter Anvin
@ 2010-06-11  7:30       ` Milton Miller
  0 siblings, 0 replies; 8+ messages in thread
From: Milton Miller @ 2010-06-11  7:30 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Mike Frysinger, linux-kernel, Tim Abbott

On Thu, 10 Jun 2010 at around 22:50:34 -0700, H. Peter Anvin wrote:
> On 06/09/2010 12:42 AM, Mike Frysinger wrote:
> > 
> > i have no problem changing the default to 4 since it works fine on
> > Blackfin systems.  your analysis of the source alignment also seems
> > reasonable ... i assume that the 8 byte fields in the source cpio
> > arent referenced directly, otherwise it'd cause problems on 64bit
> > systems that require 64bit values to be naturally aligned.
> > 
> > beyond that, i dont see why any larger alignment values would be
> > required since this source archive isnt executed directly.  it gets
> > expanded into a ramfs and then freed with the rest of the init stuff.
> > 
> 
> We have talked for a long time about incrementally freeing the initramfs
> as it is decoded, which might help systems which are using most of their
> memory for an initramfs image...

at which time the author of said theoritcal patch that might possibly
need page alignment would only need to update vmlinux.lds.h and not all
the architectures vmlinux.lds.S files.

milton

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

end of thread, other threads:[~2010-06-11  7:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-05 18:14 [PATCH 1/2] vmlinux.lds.h: allow people to set a smaller rootfs alignment Mike Frysinger
2010-06-05 18:14 ` [PATCH 2/2] Blackfin: use " Mike Frysinger
2010-06-07 23:27 ` [PATCH 1/2] vmlinux.lds.h: allow people to set a " Tim Abbott
2010-06-09  7:20 ` Milton Miller
2010-06-09  7:42   ` Mike Frysinger
2010-06-09  7:51     ` Geert Uytterhoeven
2010-06-11  5:50     ` H. Peter Anvin
2010-06-11  7:30       ` Milton Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox