Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have more gap between DTB destination and payload_end #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

avpatel
Copy link

@avpatel avpatel commented Feb 8, 2019

No description provided.

Latest Linux 5.0-rc2 and above have BSS section moved to the
end to reduce kernel flat image size by 1MB and kernel clears
the BSS section very early in head.S.

Currently, BBL places DTB at the next 2MB aligned address
after payload_end. The 2MB is not sufficient if BSS section
grows by increasing drivers enabled in Linux kernel. It is
likely that with more drivers enabled the Linux kernel early
boot-up code will clear DTB overlapping with BSS section.

This patch updates dtb_output() to have more gap between
DTB destination and payload_end.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
@davidlt
Copy link

davidlt commented Feb 10, 2019

@aswaterman
Copy link
Collaborator

Doesn’t this make it impossible to boot with less than 36 or so MB of RAM? Is there a more precise way to do it?

cc @palmer-dabbelt

@avpatel
Copy link
Author

avpatel commented Feb 11, 2019

For raw images passed as payload, we don't have option except use some heuristic value as gap between payload_end and DTB.

For ELF images, we can parse size of BSS+SBSS section in Makefile and pass BBL_PAYLOAD_BSS_SIZE as define to C code. The C code will place DTB at next 2MB aligned address after payload_end + BBL_PAYLOAD_BSS_SIZE.

@aswaterman
Copy link
Collaborator

aswaterman commented Feb 11, 2019

Seems like a design flaw. Maybe having the BSS in the middle of the kernel is the better choice, or perhaps having it memmove the device tree if it happens to overlap the BSS.

In any case, I guess I'm not going to succeed in getting the kernel changed. What’s the largest BSS you get when you make a fully-loaded kernel? I’m sure it’s nowhere near 32 MB, so we could use a smaller guard band, right?

@palmer-dabbelt
Copy link
Contributor

I don't like the solution where we just have a fixed BSS size in BBL. An allyesconfig kernel ends up with 52MiB of BSS, we don't want to allocate that staticly.

$ size vmlinux
   text    data     bss     dec     hex filename
70827977        51857727        12101272        134786976       808afa0 vmlinux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants