All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Eric Ewanco <Eric.Ewanco@genband.com>
Cc: "grub-devel@gnu.org" <grub-devel@gnu.org>
Subject: Re: initrd loading, max size, addr_min, and page_align
Date: Sun, 8 Feb 2015 20:02:30 +0300	[thread overview]
Message-ID: <20150208200230.53f274fe@opensuse.site> (raw)
In-Reply-To: <66CA070CE60D374FB9F56957F4E00BBA14E22944@gbplmail01.genband.com>

В Thu, 5 Feb 2015 21:55:54 +0000
Eric Ewanco <Eric.Ewanco@genband.com> пишет:

> 
> Background: I need to use a really large initrd for x86_64 (Linux 3.4.47), and I'm near the limit, so I'm studying grub-core/loader/i386/linux.c to find out the whys and wherefores of the GRUB 2.00 size limit.

GRUB 2.00 is way too old.

> 
> In the process of doing this I noticed a strange behavior.  The code has a ceiling (addr_max) and a floor (addr_min) for the initrd.  The initrd is loaded high, so that it ends at the ceiling and grows toward the floor as the size of the initrd increases.  The odd behavior, or at least the one that I don't understand, is that the floor grows upward toward the ceiling at the same time.  The lines in question:
> 
>   addr_min = (grub_addr_t) prot_mode_target + prot_init_space
>              + page_align (size);
> 

This code is different in current GIT.

>   /* Put the initrd as high as possible, 4KiB aligned.  */
>   addr = (addr_max - size) & ~0xFFF;
> 
> page_align(size) returns a rounded-up alignment of size; i.e., if size is 0x2335b728, it returns 0x2335c000.  Consequently, if the initrd size doubles, the distance between the ceiling and the first byte doubles (expected), AND the distance between the floor and the first byte halves because both are proportional to the size.  I would expect the floor to remain relatively constant based on the memory map.  Maybe be adjusted between 1-4k bytes for alignment, but not by the whole size of the initrd.
> 
> I'm wondering if this is a bug, or if my modest and cursory understanding of the code is incorrect.
> 
> If I am incorrect, can someone explain the page_align calculus, and also explain how the value of GRUB_LINUX_INITRD_MAX_ADDRESS (0x37FFFFFF) was determined, whether it is hard or might be revisable upward on some systems, and what the implications are of changing it (i.e. will it either work or not boot at all, or whether I might silently hose something).
> 
> Thanks,
> Eric Ewanco
> 
> 
> 



  reply	other threads:[~2015-02-08 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 21:55 initrd loading, max size, addr_min, and page_align Eric Ewanco
2015-02-08 17:02 ` Andrei Borzenkov [this message]
2015-02-08 17:14   ` Bruce Dubbs
2015-02-09  3:30     ` Andrei Borzenkov
2015-02-09  4:04       ` Bruce Dubbs
2015-02-09 14:18       ` Eric Ewanco
2015-02-09  9:37     ` Michael Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150208200230.53f274fe@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=Eric.Ewanco@genband.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.