[SeaBIOS] Why drive_s is allocated from f-segment?
gleb at redhat.com
Thu Apr 12 07:11:13 CEST 2012
On Wed, Apr 11, 2012 at 08:34:13PM -0400, Kevin O'Connor wrote:
> On Wed, Apr 11, 2012 at 04:27:57PM +0300, Gleb Natapov wrote:
> > Hi Kevin,
> > Is there a reason why drive_s structures are allocated from f-segment?
> The data is accessed from 16bit mode, so it must be in the first meg.
> Only malloc_low() and malloc_fseg() provide data in this range.
> Putting it in the f-segment has the advantage of not taking space away
> from the OS (malloc_low uses the 9-segment) and the code generated
> from f-segment accesses is slightly better (it can use %cs).
Each virtio disk allocates huge VQ from low memory. Allocating relatively
small drive_s should not take much additional memory. Besides OS has
enough memory as is. Some OSes do not use low memory at all since many
buggy bioses write there during SMM or resume.
> > The space for f-segment allocations are barely sufficient for bios
> > tables.
> There's plenty of space in the f-segment. All the 32bit init code
> that is relocated is given back to malloc_fseg - that's typically
> about 20k.
But f-seg allocation does not take advantage of that space. It uses only
CONFIG_MAX_BIOSTABLE bytes which is 2048 currently. Is it OK to grow
> Also, most of the bios tables are placed in high memory
The problem is with MPC table which has to be in low memory for older
Linux kernel and it has entry for each socket. When people use large smp
values boot starts to fail since bios can't init desks.
More information about the SeaBIOS