2009-09-22 16:57:32

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v2 0/2] Linker script cleanup patches for m68knommu

Greg,

This patch series is an updated version of the patch I sent you on
September 6 cleaning up the m68knommu architecture's linker scripts.
Since the original patches had a few bugs, I figured I'd send you a
clean copy of state as of when I last hear from you two weeks ago.

This cross-architecture linker script cleanup project is in
preparation for adding support for building the kernel with
-ffunction-sections -fdata-sections, which is a prerequisite for
Ksplice.

Tim Abbott (2):
m68knommu: Make THREAD_SIZE available to assembly files.
m68knommu: Clean up linker script using new linker script macros.

arch/m68k/include/asm/thread_info_no.h | 4 +-
arch/m68knommu/kernel/vmlinux.lds.S | 41 ++++++++-----------------------
2 files changed, 13 insertions(+), 32 deletions(-)


2009-09-22 16:57:21

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v2 1/2] m68knommu: Make THREAD_SIZE available to assembly files.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Greg Ungerer <[email protected]>
---
arch/m68k/include/asm/thread_info_no.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/thread_info_no.h b/arch/m68k/include/asm/thread_info_no.h
index c2bde5e..a6512bf 100644
--- a/arch/m68k/include/asm/thread_info_no.h
+++ b/arch/m68k/include/asm/thread_info_no.h
@@ -12,8 +12,6 @@

#ifdef __KERNEL__

-#ifndef __ASSEMBLY__
-
/*
* Size of kernel stack for each process. This must be a power of 2...
*/
@@ -28,6 +26,8 @@
*/
#define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)

+#ifndef __ASSEMBLY__
+
/*
* low level task data.
*/
--
1.6.3.3

2009-09-22 17:00:15

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Greg Ungerer <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 41 +++++++++-------------------------
1 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 2736a5e..b236133 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -8,6 +8,8 @@
*/

#include <asm-generic/vmlinux.lds.h>
+#include <asm/page.h>
+#include <asm/thread_info.h>

#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -147,40 +149,19 @@ SECTIONS {
. = ALIGN(4);
_sdata = . ;
DATA_DATA
- . = ALIGN(32);
- *(.data.cacheline_aligned)
- . = ALIGN(8192) ;
- *(.data.init_task)
+ CACHELINE_ALIGNED_DATA(32)
+ INIT_TASK_DATA(THREAD_SIZE)
_edata = . ;
} > DATA

- .init : {
- . = ALIGN(4096);
+ .init_begin : {
+ . = ALIGN(PAGE_SIZE);
__init_begin = .;
- _sinittext = .;
- INIT_TEXT
- _einittext = .;
- INIT_DATA
- . = ALIGN(16);
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- __initcall_start = .;
- INITCALLS
- __initcall_end = .;
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- __security_initcall_start = .;
- *(.security_initcall.init)
- __security_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4);
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
-#endif
- . = ALIGN(4096);
+ } > INIT
+ INIT_TEXT_SECTION(PAGE_SIZE) > INIT
+ INIT_DATA_SECTION(16) > INIT
+ .init_end : {
+ . = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT

--
1.6.3.3

2009-10-01 05:56:33

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.

Hi Tim,

Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Greg Ungerer <[email protected]>

This results in kernels that don't boot for me. I haven't done
any more debugging than to just try booting at this time.

Before this patch applied has:

vmlinux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00125ff0 40020000 40020000 00002000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init 0000c000 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, CODE
3 .bss 0000a9ec 40164000 40164000 00146000 2**4
ALLOC
4 .comment 00001c56 00000000 00000000 00146000 2**0
CONTENTS, READONLY


And after applied:

linux-2.6.x/vmlinux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00125ff0 40020000 40020000 00002000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init.text 0000aaac 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .init.data 00000b5c 40162aac 40162aac 00144aac 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .init_end 000009f8 40163608 40163608 00145608 2**0
ALLOC
5 .bss 0000a9ec 40164000 40164000 00145608 2**4
ALLOC
6 .comment 00001c56 00000000 00000000 00145608 2**0
CONTENTS, READONLY

Does that look like what you would have expected?

I suspect the problem may lie in the binary conversion of this
elf file to a raw binary for booting. This uses objcopy with
"-O binary". The resulting binary files are different in size
with and without the patch by about 2582 bytes. Suspicious
me thinks.

Regards
Greg



> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 41 +++++++++-------------------------
> 1 files changed, 11 insertions(+), 30 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 2736a5e..b236133 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -8,6 +8,8 @@
> */
>
> #include <asm-generic/vmlinux.lds.h>
> +#include <asm/page.h>
> +#include <asm/thread_info.h>
>
> #if defined(CONFIG_RAMKERNEL)
> #define RAM_START CONFIG_KERNELBASE
> @@ -147,40 +149,19 @@ SECTIONS {
> . = ALIGN(4);
> _sdata = . ;
> DATA_DATA
> - . = ALIGN(32);
> - *(.data.cacheline_aligned)
> - . = ALIGN(8192) ;
> - *(.data.init_task)
> + CACHELINE_ALIGNED_DATA(32)
> + INIT_TASK_DATA(THREAD_SIZE)
> _edata = . ;
> } > DATA
>
> - .init : {
> - . = ALIGN(4096);
> + .init_begin : {
> + . = ALIGN(PAGE_SIZE);
> __init_begin = .;
> - _sinittext = .;
> - INIT_TEXT
> - _einittext = .;
> - INIT_DATA
> - . = ALIGN(16);
> - __setup_start = .;
> - *(.init.setup)
> - __setup_end = .;
> - __initcall_start = .;
> - INITCALLS
> - __initcall_end = .;
> - __con_initcall_start = .;
> - *(.con_initcall.init)
> - __con_initcall_end = .;
> - __security_initcall_start = .;
> - *(.security_initcall.init)
> - __security_initcall_end = .;
> -#ifdef CONFIG_BLK_DEV_INITRD
> - . = ALIGN(4);
> - __initramfs_start = .;
> - *(.init.ramfs)
> - __initramfs_end = .;
> -#endif
> - . = ALIGN(4096);
> + } > INIT
> + INIT_TEXT_SECTION(PAGE_SIZE) > INIT
> + INIT_DATA_SECTION(16) > INIT
> + .init_end : {
> + . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT
>

--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-12 14:48:37

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.

On Thu, 1 Oct 2009, Greg Ungerer wrote:

> Hi Tim,
>
> Tim Abbott wrote:
> > Signed-off-by: Tim Abbott <[email protected]>
> > Cc: Greg Ungerer <[email protected]>
>
> This results in kernels that don't boot for me. I haven't done
> any more debugging than to just try booting at this time.
[...]
>
> Does that look like what you would have expected?

Basically. I'm a bit surprised that the .init_begin section doesn't show
up, but I'm pretty sure that this is because .init_begin would have had
size zero as the previous section's end was already page-aligned.

> I suspect the problem may lie in the binary conversion of this
> elf file to a raw binary for booting. This uses objcopy with
> "-O binary". The resulting binary files are different in size
> with and without the patch by about 2582 bytes. Suspicious
> me thinks.

I don't any good ideas for what in patch is likely to be responsible.
Would it be helpful to debug if I split this into ~5 very small patches so
that we can find out what part of the patch is responsible?

-Tim Abbott

2009-10-12 23:47:38

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.

Hi Tim,

Tim Abbott wrote:
> On Thu, 1 Oct 2009, Greg Ungerer wrote:
>> Tim Abbott wrote:
>>> Signed-off-by: Tim Abbott <[email protected]>
>>> Cc: Greg Ungerer <[email protected]>
>> This results in kernels that don't boot for me. I haven't done
>> any more debugging than to just try booting at this time.
> [...]
>> Does that look like what you would have expected?
>
> Basically. I'm a bit surprised that the .init_begin section doesn't show
> up, but I'm pretty sure that this is because .init_begin would have had
> size zero as the previous section's end was already page-aligned.
>
>> I suspect the problem may lie in the binary conversion of this
>> elf file to a raw binary for booting. This uses objcopy with
>> "-O binary". The resulting binary files are different in size
>> with and without the patch by about 2582 bytes. Suspicious
>> me thinks.
>
> I don't any good ideas for what in patch is likely to be responsible.
> Would it be helpful to debug if I split this into ~5 very small patches so
> that we can find out what part of the patch is responsible?

Yes, that will make it quick and easy for me.

Thanks
Greg



------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-13 01:34:23

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 0/7] m68knommu: Clean up linker script using new linker script macros.

On Mon, 12 Oct 2009, Greg Ungerer wrote:
> Tim Abbott wrote:
>> I don't any good ideas for what in patch is likely to be
>> responsible. Would it be helpful to debug if I split this into ~5
>> very small patches so that we can find out what part of the patch
>> is responsible?
> Yes, that will make it quick and easy for me.

OK, below's a new patch series that is the same as the previous one
but in 7-patch format.

-Tim Abbott

Tim Abbott (7):
m68knommu: Don't hardcode the value of PAGE_SIZE in the linker
script.
m68knommu: Make THREAD_SIZE available to assembly files.
m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.
m68knommu: Use more macros inside the .init section.
m68knommu: Move __init_begin out of the .init section.
m68knommu: Move __init_end out of the .init section.
m68knommu: Split the .init section into INIT_TEXT_SECTION and
INIT_DATA_SECTION.

arch/m68k/include/asm/thread_info_no.h | 4 +-
arch/m68knommu/kernel/vmlinux.lds.S | 41 ++++++++-----------------------
2 files changed, 13 insertions(+), 32 deletions(-)

2009-10-13 01:33:51

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 2736a5e..edc20bd 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -8,6 +8,7 @@
*/

#include <asm-generic/vmlinux.lds.h>
+#include <asm/page.h>

#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -155,7 +156,7 @@ SECTIONS {
} > DATA

.init : {
- . = ALIGN(4096);
+ . = ALIGN(PAGE_SIZE);
__init_begin = .;
_sinittext = .;
INIT_TEXT
@@ -180,7 +181,7 @@ SECTIONS {
*(.init.ramfs)
__initramfs_end = .;
#endif
- . = ALIGN(4096);
+ . = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT

--
1.6.4.3

2009-10-13 01:34:41

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 2/7] m68knommu: Make THREAD_SIZE available to assembly files.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Greg Ungerer <[email protected]>
---
arch/m68k/include/asm/thread_info_no.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/thread_info_no.h b/arch/m68k/include/asm/thread_info_no.h
index c2bde5e..a6512bf 100644
--- a/arch/m68k/include/asm/thread_info_no.h
+++ b/arch/m68k/include/asm/thread_info_no.h
@@ -12,8 +12,6 @@

#ifdef __KERNEL__

-#ifndef __ASSEMBLY__
-
/*
* Size of kernel stack for each process. This must be a power of 2...
*/
@@ -28,6 +26,8 @@
*/
#define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)

+#ifndef __ASSEMBLY__
+
/*
* low level task data.
*/
--
1.6.4.3

2009-10-13 01:31:09

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 3/7] m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index edc20bd..153569b 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -9,6 +9,7 @@

#include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
+#include <asm/thread_info.h>

#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -148,10 +149,8 @@ SECTIONS {
. = ALIGN(4);
_sdata = . ;
DATA_DATA
- . = ALIGN(32);
- *(.data.cacheline_aligned)
- . = ALIGN(8192) ;
- *(.data.init_task)
+ CACHELINE_ALIGNED_DATA(32)
+ INIT_TASK_DATA(THREAD_SIZE)
_edata = . ;
} > DATA

--
1.6.4.3

2009-10-13 01:34:31

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 153569b..f7df82a 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -161,25 +161,12 @@ SECTIONS {
INIT_TEXT
_einittext = .;
INIT_DATA
- . = ALIGN(16);
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- __initcall_start = .;
+ INIT_SETUP(16)
+ INIT_CALL
INITCALLS
- __initcall_end = .;
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- __security_initcall_start = .;
- *(.security_initcall.init)
- __security_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4);
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
-#endif
+ CON_INITCALL
+ SECURITY_INITCALL
+ INIT_RAM_FS
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-13 01:32:56

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 5/7] m68knommu: Move __init_begin out of the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index f7df82a..73fe172 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -154,9 +154,11 @@ SECTIONS {
_edata = . ;
} > DATA

- .init : {
+ .init_begin : {
. = ALIGN(PAGE_SIZE);
__init_begin = .;
+ } > INIT
+ .init : {
_sinittext = .;
INIT_TEXT
_einittext = .;
--
1.6.4.3

2009-10-13 01:33:44

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 73fe172..49d5c4d 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -169,6 +169,8 @@ SECTIONS {
CON_INITCALL
SECURITY_INITCALL
INIT_RAM_FS
+ } > INIT
+ .init_end : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-13 01:34:07

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v3 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 49d5c4d..b236133 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -158,18 +158,8 @@ SECTIONS {
. = ALIGN(PAGE_SIZE);
__init_begin = .;
} > INIT
- .init : {
- _sinittext = .;
- INIT_TEXT
- _einittext = .;
- INIT_DATA
- INIT_SETUP(16)
- INIT_CALL
- INITCALLS
- CON_INITCALL
- SECURITY_INITCALL
- INIT_RAM_FS
- } > INIT
+ INIT_TEXT_SECTION(PAGE_SIZE) > INIT
+ INIT_DATA_SECTION(16) > INIT
.init_end : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
--
1.6.4.3

2009-10-13 05:57:00

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.

Hi Tim,

Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------
> 1 files changed, 5 insertions(+), 18 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 153569b..f7df82a 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -161,25 +161,12 @@ SECTIONS {
> INIT_TEXT
> _einittext = .;
> INIT_DATA
> - . = ALIGN(16);
> - __setup_start = .;
> - *(.init.setup)
> - __setup_end = .;
> - __initcall_start = .;
> + INIT_SETUP(16)
> + INIT_CALL
^^^^^^^^^^
I take it this should be INIT_CALLS?


> INITCALLS
> - __initcall_end = .;
> - __con_initcall_start = .;
> - *(.con_initcall.init)
> - __con_initcall_end = .;
> - __security_initcall_start = .;
> - *(.security_initcall.init)
> - __security_initcall_end = .;
> -#ifdef CONFIG_BLK_DEV_INITRD
> - . = ALIGN(4);
> - __initramfs_start = .;
> - *(.init.ramfs)
> - __initramfs_end = .;
> -#endif
> + CON_INITCALL
> + SECURITY_INITCALL
> + INIT_RAM_FS
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT


With this patch applied the kernel no longer boots. All previous
patches (so 1, 2 and 3) applied run fine.

Headers list:

vmlinux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00125ff0 40020000 40020000 00002000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init 0000c000 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, CODE
3 .bss 0000a9ec 40164000 40164000 00146000 2**4
ALLOC
4 .comment 00001c56 00000000 00000000 00146000 2**0
CONTENTS, READONLY

I haven't debugged any further...

Regards
Greg



------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-13 15:40:52

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.

On Tue, 13 Oct 2009, Greg Ungerer wrote:

> Hi Tim,
>
> Tim Abbott wrote:
> > Signed-off-by: Tim Abbott <[email protected]>
> > ---
> > arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------
> > 1 files changed, 5 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/m68knommu/kernel/vmlinux.lds.S
> > b/arch/m68knommu/kernel/vmlinux.lds.S
> > index 153569b..f7df82a 100644
> > --- a/arch/m68knommu/kernel/vmlinux.lds.S
> > +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> > @@ -161,25 +161,12 @@ SECTIONS {
> > INIT_TEXT
> > _einittext = .;
> > INIT_DATA
> > - . = ALIGN(16);
> > - __setup_start = .;
> > - *(.init.setup)
> > - __setup_end = .;
> > - __initcall_start = .;
> > + INIT_SETUP(16)
> > + INIT_CALL
> ^^^^^^^^^^
> I take it this should be INIT_CALLS?

Oops, yes. Also the INITCALLS on the following line should be deleted.
So it should look like the below patch.

> With this patch applied the kernel no longer boots. All previous
> patches (so 1, 2 and 3) applied run fine.

Hopefully this is because we had INIT_CALLS followed by INITCALLS. If it
doesn't boot using the patch below instead, then that would be surprising
to me.

-Tim Abbott

m68knommu: Use more macros inside the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 153569b..ac7e785 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -161,25 +161,11 @@ SECTIONS {
INIT_TEXT
_einittext = .;
INIT_DATA
- . = ALIGN(16);
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- __initcall_start = .;
- INITCALLS
- __initcall_end = .;
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- __security_initcall_start = .;
- *(.security_initcall.init)
- __security_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4);
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
-#endif
+ INIT_SETUP(16)
+ INIT_CALLS
+ CON_INITCALL
+ SECURITY_INITCALL
+ INIT_RAM_FS
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-14 04:23:58

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.

Hi Tim,

Tim Abbott wrote:
> On Tue, 13 Oct 2009, Greg Ungerer wrote:
>
>> Hi Tim,
>>
>> Tim Abbott wrote:
>>> Signed-off-by: Tim Abbott <[email protected]>
>>> ---
>>> arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------
>>> 1 files changed, 5 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S
>>> b/arch/m68knommu/kernel/vmlinux.lds.S
>>> index 153569b..f7df82a 100644
>>> --- a/arch/m68knommu/kernel/vmlinux.lds.S
>>> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
>>> @@ -161,25 +161,12 @@ SECTIONS {
>>> INIT_TEXT
>>> _einittext = .;
>>> INIT_DATA
>>> - . = ALIGN(16);
>>> - __setup_start = .;
>>> - *(.init.setup)
>>> - __setup_end = .;
>>> - __initcall_start = .;
>>> + INIT_SETUP(16)
>>> + INIT_CALL
>> ^^^^^^^^^^
>> I take it this should be INIT_CALLS?
>
> Oops, yes. Also the INITCALLS on the following line should be deleted.
> So it should look like the below patch.
>
>> With this patch applied the kernel no longer boots. All previous
>> patches (so 1, 2 and 3) applied run fine.
>
> Hopefully this is because we had INIT_CALLS followed by INITCALLS. If it
> doesn't boot using the patch below instead, then that would be surprising
> to me.

Runs fine with this updated patch.
Trying the rest of the series now.

Regards
Greg




> m68knommu: Use more macros inside the .init section.
>
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++-------------------
> 1 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 153569b..ac7e785 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -161,25 +161,11 @@ SECTIONS {
> INIT_TEXT
> _einittext = .;
> INIT_DATA
> - . = ALIGN(16);
> - __setup_start = .;
> - *(.init.setup)
> - __setup_end = .;
> - __initcall_start = .;
> - INITCALLS
> - __initcall_end = .;
> - __con_initcall_start = .;
> - *(.con_initcall.init)
> - __con_initcall_end = .;
> - __security_initcall_start = .;
> - *(.security_initcall.init)
> - __security_initcall_end = .;
> -#ifdef CONFIG_BLK_DEV_INITRD
> - . = ALIGN(4);
> - __initramfs_start = .;
> - *(.init.ramfs)
> - __initramfs_end = .;
> -#endif
> + INIT_SETUP(16)
> + INIT_CALLS
> + CON_INITCALL
> + SECURITY_INITCALL
> + INIT_RAM_FS
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT

--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-14 04:42:42

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.

Hi Tim,

Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 73fe172..49d5c4d 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -169,6 +169,8 @@ SECTIONS {
> CON_INITCALL
> SECURITY_INITCALL
> INIT_RAM_FS
> + } > INIT
> + .init_end : {
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT


After applying this I can no longer boot.

Resulting headers for vmlinux are:

vmlinux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00125ff0 40020000 40020000 00002000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init 0000b608 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, CODE
3 .init_end 000009f8 40163608 40163608 00145608 2**0
ALLOC
4 .bss 0000a9ec 40164000 40164000 00145608 2**4
ALLOC
5 .comment 00001c56 00000000 00000000 00145608 2**0
CONTENTS, READONLY


Regards
Greg



------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-14 15:16:55

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.

On Wed, Oct 14, 2009 at 02:41:38PM +1000, Greg Ungerer wrote:
> Hi Tim,
>
> Tim Abbott wrote:
>> Signed-off-by: Tim Abbott <[email protected]>
>> ---
>> arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
>> index 73fe172..49d5c4d 100644
>> --- a/arch/m68knommu/kernel/vmlinux.lds.S
>> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
>> @@ -169,6 +169,8 @@ SECTIONS {
>> CON_INITCALL
>> SECURITY_INITCALL
>> INIT_RAM_FS
>> + } > INIT
>> + .init_end : {
>> . = ALIGN(PAGE_SIZE);
>> __init_end = .;
>> } > INIT
>
>
> After applying this I can no longer boot.
>
> Resulting headers for vmlinux are:
>
> vmlinux: file format elf32-m68k
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00125ff0 40020000 40020000 00002000 2**4
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
> CONTENTS, ALLOC, LOAD, DATA
> 2 .init 0000b608 40158000 40158000 0013a000 2**2
> CONTENTS, ALLOC, LOAD, CODE
> 3 .init_end 000009f8 40163608 40163608 00145608 2**0
> ALLOC
> 4 .bss 0000a9ec 40164000 40164000 00145608 2**4
> ALLOC
> 5 .comment 00001c56 00000000 00000000 00145608 2**0
> CONTENTS, READONLY

Took a look at this trying to understand why this
caused a non-booting system.

The previous post should have created a section named "init_begin",
but it is not present in the above.
I think this is beacuse the section had a zero size and thus
got ignored by the linker.

An the linker is allowed to rearrange sections so the concept
with a init_begin, init_end sections looks wrongs.
We do not know the order of these sections and they may
be linked in a different order than what we expect.

I think the better solution is to use the same section name
several times like this:

.init : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT

We should do this both for begin and end.
Then the linker will not fool us and try to rearrange stuff.
And we do not end up with zero sized sections.

Greg - I assume the boot failed when it tried to free initmem.

Sam

2009-10-18 17:22:43

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.

On Wed, 14 Oct 2009, Sam Ravnborg wrote:

> Took a look at this trying to understand why this
> caused a non-booting system.

Thanks, I really appreciate your looking at this!

[...]
> I think the better solution is to use the same section name
> several times like this:
>
> .init : {
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT
>
> We should do this both for begin and end.
> Then the linker will not fool us and try to rearrange stuff.
> And we do not end up with zero sized sections.

OK, I have an attempt at implementing this idea. Of course, the final
patch which uses INIT_TEXT_SECTION and INIT_DATA_SECTION has multiple
output sections (.init.data and .init.text), but I think perhaps including
these alignment guards in the adjacent section might work.

-Tim Abbott

2009-10-18 17:24:07

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 2736a5e..edc20bd 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -8,6 +8,7 @@
*/

#include <asm-generic/vmlinux.lds.h>
+#include <asm/page.h>

#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -155,7 +156,7 @@ SECTIONS {
} > DATA

.init : {
- . = ALIGN(4096);
+ . = ALIGN(PAGE_SIZE);
__init_begin = .;
_sinittext = .;
INIT_TEXT
@@ -180,7 +181,7 @@ SECTIONS {
*(.init.ramfs)
__initramfs_end = .;
#endif
- . = ALIGN(4096);
+ . = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT

--
1.6.4.3

2009-10-18 17:27:55

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 2/7] m68knommu: Make THREAD_SIZE available to assembly files.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Greg Ungerer <[email protected]>
---
arch/m68k/include/asm/thread_info_no.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/thread_info_no.h b/arch/m68k/include/asm/thread_info_no.h
index c2bde5e..a6512bf 100644
--- a/arch/m68k/include/asm/thread_info_no.h
+++ b/arch/m68k/include/asm/thread_info_no.h
@@ -12,8 +12,6 @@

#ifdef __KERNEL__

-#ifndef __ASSEMBLY__
-
/*
* Size of kernel stack for each process. This must be a power of 2...
*/
@@ -28,6 +26,8 @@
*/
#define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)

+#ifndef __ASSEMBLY__
+
/*
* low level task data.
*/
--
1.6.4.3

2009-10-18 17:23:59

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 3/7] m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index edc20bd..153569b 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -9,6 +9,7 @@

#include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
+#include <asm/thread_info.h>

#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -148,10 +149,8 @@ SECTIONS {
. = ALIGN(4);
_sdata = . ;
DATA_DATA
- . = ALIGN(32);
- *(.data.cacheline_aligned)
- . = ALIGN(8192) ;
- *(.data.init_task)
+ CACHELINE_ALIGNED_DATA(32)
+ INIT_TASK_DATA(THREAD_SIZE)
_edata = . ;
} > DATA

--
1.6.4.3

2009-10-18 17:27:46

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 4/7] m68knommu: Use more macros inside the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 153569b..ac7e785 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -161,25 +161,11 @@ SECTIONS {
INIT_TEXT
_einittext = .;
INIT_DATA
- . = ALIGN(16);
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- __initcall_start = .;
- INITCALLS
- __initcall_end = .;
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- __security_initcall_start = .;
- *(.security_initcall.init)
- __security_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4);
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
-#endif
+ INIT_SETUP(16)
+ INIT_CALLS
+ CON_INITCALL
+ SECURITY_INITCALL
+ INIT_RAM_FS
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-18 17:24:05

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 5/7] m68knommu: Move __init_begin out of the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index ac7e785..0d430da 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -157,6 +157,8 @@ SECTIONS {
.init : {
. = ALIGN(PAGE_SIZE);
__init_begin = .;
+ } > INIT
+ .init : {
_sinittext = .;
INIT_TEXT
_einittext = .;
--
1.6.4.3

2009-10-18 17:27:29

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 6/7] m68knommu: Move __init_end out of the .init section.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 0d430da..65e2874 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -168,6 +168,8 @@ SECTIONS {
CON_INITCALL
SECURITY_INITCALL
INIT_RAM_FS
+ } > INIT
+ .init : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-18 17:27:39

by Tim Abbott

[permalink] [raw]
Subject: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 65e2874..2bff62f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -154,22 +154,13 @@ SECTIONS {
_edata = . ;
} > DATA

- .init : {
+ .init.text : {
. = ALIGN(PAGE_SIZE);
__init_begin = .;
} > INIT
- .init : {
- _sinittext = .;
- INIT_TEXT
- _einittext = .;
- INIT_DATA
- INIT_SETUP(16)
- INIT_CALLS
- CON_INITCALL
- SECURITY_INITCALL
- INIT_RAM_FS
- } > INIT
- .init : {
+ INIT_TEXT_SECTION(PAGE_SIZE) > INIT
+ INIT_DATA_SECTION(16) > INIT
+ .init.data : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.4.3

2009-10-30 00:44:19

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.

Hi Sam,

Sorry for the slow response.


Sam Ravnborg wrote:
> On Wed, Oct 14, 2009 at 02:41:38PM +1000, Greg Ungerer wrote:
>> Hi Tim,
>>
>> Tim Abbott wrote:
>>> Signed-off-by: Tim Abbott <[email protected]>
>>> ---
>>> arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
>>> index 73fe172..49d5c4d 100644
>>> --- a/arch/m68knommu/kernel/vmlinux.lds.S
>>> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
>>> @@ -169,6 +169,8 @@ SECTIONS {
>>> CON_INITCALL
>>> SECURITY_INITCALL
>>> INIT_RAM_FS
>>> + } > INIT
>>> + .init_end : {
>>> . = ALIGN(PAGE_SIZE);
>>> __init_end = .;
>>> } > INIT
>>
>> After applying this I can no longer boot.
>>
>> Resulting headers for vmlinux are:
>>
>> vmlinux: file format elf32-m68k
>>
>> Sections:
>> Idx Name Size VMA LMA File off Algn
>> 0 .text 00125ff0 40020000 40020000 00002000 2**4
>> CONTENTS, ALLOC, LOAD, READONLY, CODE
>> 1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
>> CONTENTS, ALLOC, LOAD, DATA
>> 2 .init 0000b608 40158000 40158000 0013a000 2**2
>> CONTENTS, ALLOC, LOAD, CODE
>> 3 .init_end 000009f8 40163608 40163608 00145608 2**0
>> ALLOC
>> 4 .bss 0000a9ec 40164000 40164000 00145608 2**4
>> ALLOC
>> 5 .comment 00001c56 00000000 00000000 00145608 2**0
>> CONTENTS, READONLY
>
> Took a look at this trying to understand why this
> caused a non-booting system.
>
> The previous post should have created a section named "init_begin",
> but it is not present in the above.
> I think this is beacuse the section had a zero size and thus
> got ignored by the linker.
>
> An the linker is allowed to rearrange sections so the concept
> with a init_begin, init_end sections looks wrongs.
> We do not know the order of these sections and they may
> be linked in a different order than what we expect.
>
> I think the better solution is to use the same section name
> several times like this:
>
> .init : {
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT
>
> We should do this both for begin and end.
> Then the linker will not fool us and try to rearrange stuff.
> And we do not end up with zero sized sections.
>
> Greg - I assume the boot failed when it tried to free initmem.

No, it was very early - no console trace even. I didn't check
in logbuf to see what early kernel boot messages there where.

I'll try Tim's next set and see where that gets to.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-30 00:57:34

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.

Hi Tim,

This one gives me:

arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined
In file included from arch/m68knommu/kernel/vmlinux.lds.S:10:
include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location
of the previous definition

A define named "BSS" is already used inside of vmlinux.lds.S.
No big deal, I just changed that internal one.

But otherwise no problems with this patch.

Regards
Greg



Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 2736a5e..edc20bd 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -8,6 +8,7 @@
> */
>
> #include <asm-generic/vmlinux.lds.h>
> +#include <asm/page.h>
>
> #if defined(CONFIG_RAMKERNEL)
> #define RAM_START CONFIG_KERNELBASE
> @@ -155,7 +156,7 @@ SECTIONS {
> } > DATA
>
> .init : {
> - . = ALIGN(4096);
> + . = ALIGN(PAGE_SIZE);
> __init_begin = .;
> _sinittext = .;
> INIT_TEXT
> @@ -180,7 +181,7 @@ SECTIONS {
> *(.init.ramfs)
> __initramfs_end = .;
> #endif
> - . = ALIGN(4096);
> + . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT
>

--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-30 01:14:05

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

Hi Tim,

The whole series applied and ran fine for me!
(Of course excepting the define name clash in 1/7)

Do you want me to push these into m68knommu.git?

Regards
Greg



Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 17 ++++-------------
> 1 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 65e2874..2bff62f 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -154,22 +154,13 @@ SECTIONS {
> _edata = . ;
> } > DATA
>
> - .init : {
> + .init.text : {
> . = ALIGN(PAGE_SIZE);
> __init_begin = .;
> } > INIT
> - .init : {
> - _sinittext = .;
> - INIT_TEXT
> - _einittext = .;
> - INIT_DATA
> - INIT_SETUP(16)
> - INIT_CALLS
> - CON_INITCALL
> - SECURITY_INITCALL
> - INIT_RAM_FS
> - } > INIT
> - .init : {
> + INIT_TEXT_SECTION(PAGE_SIZE) > INIT
> + INIT_DATA_SECTION(16) > INIT
> + .init.data : {
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT

--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-30 01:22:31

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.

On Fri, 30 Oct 2009, Greg Ungerer wrote:

> Hi Tim,
>
> This one gives me:
>
> arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined
> In file included from arch/m68knommu/kernel/vmlinux.lds.S:10:
> include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location of the
> previous definition
>
> A define named "BSS" is already used inside of vmlinux.lds.S.
> No big deal, I just changed that internal one.
>
> But otherwise no problems with this patch.

This actually wasn't introduced by this patch -- it was introduced when
the BSS macro was merged into include/asm-generic/vmlinux.lds.h in commit
ef53dae8658cf0e93d380983824a661067948d87.

Regardless, changing the internal one was the right fix.

-Tim Abbott

2009-10-30 01:30:48

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

On Fri, 30 Oct 2009, Greg Ungerer wrote:

> Hi Tim,
>
> The whole series applied and ran fine for me!
> (Of course excepting the define name clash in 1/7)

Thanks for your patience debugging this patch series!

> Do you want me to push these into m68knommu.git?

Yes, that'd be great. Do you expect these to end up in 2.6.32? I have an
API change to INIT_DATA_SECTION that I want to put in 2.6.32 to fix a tiny
regression on blackfin, and I'd like to know which change is likely to get
merged first (since the API change will likely conflict).

-Tim Abbott

2009-10-30 05:02:29

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.

Hi Tim,

Tim Abbott wrote:
> On Fri, 30 Oct 2009, Greg Ungerer wrote:
>
>> Hi Tim,
>>
>> This one gives me:
>>
>> arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined
>> In file included from arch/m68knommu/kernel/vmlinux.lds.S:10:
>> include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location of the
>> previous definition
>>
>> A define named "BSS" is already used inside of vmlinux.lds.S.
>> No big deal, I just changed that internal one.
>>
>> But otherwise no problems with this patch.
>
> This actually wasn't introduced by this patch -- it was introduced when
> the BSS macro was merged into include/asm-generic/vmlinux.lds.h in commit
> ef53dae8658cf0e93d380983824a661067948d87.
>
> Regardless, changing the internal one was the right fix.

Indeed. Yep. I'll commit a fix for this first.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-30 05:11:09

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

Hi Tim,

Tim Abbott wrote:
> On Fri, 30 Oct 2009, Greg Ungerer wrote:
>> The whole series applied and ran fine for me!
>> (Of course excepting the define name clash in 1/7)
>
> Thanks for your patience debugging this patch series!
>
>> Do you want me to push these into m68knommu.git?
>
> Yes, that'd be great. Do you expect these to end up in 2.6.32?

No, I wouldn't want to push them this late in the 2.6.32 cycle.
Definitely for 2.6.33 (I anticipate pushing them in the 2.6.33
merge window).


> I have an
> API change to INIT_DATA_SECTION that I want to put in 2.6.32 to fix a tiny
> regression on blackfin, and I'd like to know which change is likely to get
> merged first (since the API change will likely conflict).

I have put them in the "for-linus" branch of:

git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-10-30 11:35:10

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

On Thu, Oct 29, 2009 at 09:30:37PM -0400, Tim Abbott wrote:
> On Fri, 30 Oct 2009, Greg Ungerer wrote:
>
> > Hi Tim,
> >
> > The whole series applied and ran fine for me!
> > (Of course excepting the define name clash in 1/7)
>
> Thanks for your patience debugging this patch series!
>
> > Do you want me to push these into m68knommu.git?
>
> Yes, that'd be great. Do you expect these to end up in 2.6.32? I have an
> API change to INIT_DATA_SECTION that I want to put in 2.6.32 to fix a tiny
> regression on blackfin, and I'd like to know which change is likely to get
> merged first (since the API change will likely conflict).

Let's postpone this fix until merge window opens.
I doubt it has any real effect anyway.

And I'm glad the m68knommu stuff is fixed now.

Sam

2009-10-30 18:17:26

by Tim Abbott

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.

On Fri, 30 Oct 2009, Sam Ravnborg wrote:

> Let's postpone this fix until merge window opens.
> I doubt it has any real effect anyway.

OK, seems reasonable.

-Tim Abbott