LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 06-02-2012, 01:02 PM   #1
gluo88
LQ Newbie
 
Registered: May 2012
Posts: 5

Rep: Reputation: Disabled
how kernel figure out DDR RAM size when bootargs's mem not specified?


I have a 2.6.35 Kernel runnning on rescue mode, booting wiht u-boot, on powerpc, on in-house card, with 512M RAM.

The Kernel boots well when
1) bootargs has mem=512M, or
2) mem is not specified in bootargs.

Therefore, if bootargs does not specify any value for mem, my linux kernel looks to be able to figure out the DDR RAM 512M that is configured by u-boot from my testing.

Does anyone know how Kernel figured out the size of DDR RAM hat is configured by u-boot without learning the size from bootargs's mem argument ?


Thanks a lot for help.
 
Old 06-02-2012, 08:32 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
The kernel probes the hardware to find out what's present - including how much memory.
That is a kernel parameter that is generally used to cause the kernel to use less than the total memory installed. On x86 the bootloaders don't know anything about that parameter and pass it on (uninterpreted and ignored) to the kernel. Probably the same on Power.
 
1 members found this post helpful.
Old 06-02-2012, 08:45 PM   #3
gluo88
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you very much for your help.

Although my kernel boots well when
1) if bootargs has mem=512M, or 2) mem is not specified.

I need to reserve some memnory for not being touched by Kernel.
However, if I reserve 1M mewmory with mem=511M, the kernel traped
when unpacking rootfs at the following location.

The trap is ppc 0x300 exception - mmu data access error.

May someone point me some clue to figure out the reason of the issue?

Thanks a lot for help.


------ More details as below:
packages/linux-centaur/init/initramfs.c: printk(KERN_INFO "Trying to unpack rootfs image as initramfs...\n")
err = unpack_to_rootfs((char *)initrd_start,
initrd_end - initrd_start);

58.124361] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 58.143896] Trying to unpack rootfs image as initramfs...
[ 58.159819] Unable to handle kernel paging request for data at address 0xddba1000
[ 58.182215] Faulting instruction address: 0xc05e6e88
[ 58.197066] Oops: Kernel access of bad area, sig: 11 [#1]
[ 58.227535] last sysfs file:
[ 58.236394] Modules linked in:
[ 58.245513] NIP: c05e6e88 LR: c05e6d84 CTR: 00000000
[ 58.260364] REGS: d7879e40 TRAP: 0300 Not tainted (2.6.35.10)
[ 58.278339] MSR: 00029000 <EE,ME,CE> CR: 24044024 XER: 00000000
[ 58.296577] DEAR: ddba1000, ESR: 00000000
[ 58.308562] TASK = d7870000[1] 'swapper' THREAD: d7878000 CPU: 0
[ 58.326016] GPR00: 00000000 d7879ef0 d7870000 d7912000 000000d0 00000000 00000000 c0b0b184
[ 58.351027] GPR08: 14000000 c05e0000 00000000 c05e0000 24044042 10121270 c05e64c4 c05e6708
[ 58.376039] GPR16: c0680700 d7879ef8 c0610000 00000000 00000000 c06806fc c0614cf8 c0661860
[ 58.401050] GPR24: ddba1000 012cb845 c0614cf8 c05e6d70 d7912000 00002000 c0630000 d7879ef0
[ 58.426591] NIP [c05e6e88] unpack_to_rootfs+0x218/0x480
[ 58.442217] LR [c05e6d84] unpack_to_rootfs+0x114/0x480
[ 58.457586] Call Trace:
[ 58.464884] [d7879ef0] [c05e6d84] unpack_to_rootfs+0x114/0x480 (unreliable)
[ 58.485727] [d7879f60] [c05e7974] populate_rootfs+0x80/0x12c
[ 58.502663] [d7879f80] [c0001da8] do_one_initcall+0x4c/0x204
[ 58.519596] [d7879fb0] [c05e444c] do_basic_setup+0x84/0xa8
[ 58.536009] [d7879fd0] [c05e4538] kernel_init+0xc8/0x170
 
Old 06-02-2012, 10:21 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
Can't help with ppc - I've asked the mods to move this to somewhere more appropriate.

Maybe you should be looking for ppc specific list(s).
 
Old 06-03-2012, 03:06 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,508

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Unfortunately there is not a specific ppc section at LQ, but since it is a kernel related question I've moved this thread to Linux - Kernel for better exposure. Maybe some kernel expert could step in.
 
Old 06-03-2012, 09:54 AM   #6
gluo88
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
thanks to syg00 and colucix for your help.

I switched from vxWorks work to Linux's embedded kernel work only a few of months. Hopefully I can get some help from Kernel expert.
 
Old 08-16-2012, 09:20 AM   #7
gluo88
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
I figured this out.
uboot's bootm command will modify the dts/dtb file's memory section, and pass the memory size into Kernel by dts/dtb file.

Initially, memory section is as below.
memory {
device_type = "memory";
};

After the change, it is as below:
memory {
reg = <0x0 0x0 0x0 0x20000000>;
device_type = "memory";
};

chosen section is added too as below:

chosen {
linux,initrd-end = <0xffff2ca>;
linux,initrd-start = <0xeda9000>;
linux,stdout-path = "/socp2020@fffe00000/serial@4500";
boottype = "rescue";
bootargs = "rw nosmp console=ttyS0,38400 mem=496M";
};
 
  


Reply

Tags
kernel, memory


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I access bootargs from inside the kernel? mintzyuval Linux - Newbie 13 04-03-2009 06:59 AM
I was readin about ddr ram using ddr2 ram Dewy LinuxQuestions.org Member Intro 2 04-17-2008 06:42 PM
DDR RAM compatibility? nyk Linux - Hardware 3 10-29-2004 04:45 AM
Ram - Ddr/sdr ?? jt1020 Linux - Hardware 2 05-26-2003 09:51 AM
Mixing Ddr Ram eastj1974 Linux - Hardware 1 04-20-2003 10:22 PM


All times are GMT -5. The time now is 09:11 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration