Page MenuHomeFreeBSD

bhyve: remove empty E820 entries
ClosedPublic

Authored by corvink on Jun 4 2024, 8:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 5:53 PM
Unknown Object (File)
Thu, Oct 17, 6:01 PM
Unknown Object (File)
Tue, Oct 15, 8:52 PM
Unknown Object (File)
Mon, Oct 14, 9:58 PM
Unknown Object (File)
Mon, Oct 14, 12:15 AM
Unknown Object (File)
Oct 12 2024, 1:22 AM
Unknown Object (File)
Oct 10 2024, 6:35 PM
Unknown Object (File)
Oct 9 2024, 9:42 PM
Subscribers

Details

Summary

When reserving a block with the same size of a RAM segement, we can end up with
an empty RAM segmenet. Avoid that by removing this empty segment from the E820
table.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Aug 7 2024, 2:13 PM
usr.sbin/bhyve/amd64/e820.c
241
244

I suggest making the code match the comments by tweaking it as so:

TAILQ_INSERT_BEFORE(element, new_element, chain);
element->base = end;

/*
  * (New comment here)
  */
if (end == element->end) {
   TAILQ_REMOVE(...);
    free(element);
}

Or even alternatively, make this a new top-level case:

if (base == element->base && end == element->end) {
    /* The new entry replaces an existing entry. */
    TAILQ_INSERT_BEFORE(element, new_element, chain);
    TAILQ_REMOVE(&e820_table, element, chain);
    free(element);
} else if (base == element->base) {
    /* Existing code */
} else if (end == element->end) {
    ...
} else {
    ...
}
  • use a new top level case to detect empty entries
This revision now requires review to proceed.Aug 8 2024, 7:06 AM
This revision is now accepted and ready to land.Aug 8 2024, 6:10 PM
This revision was automatically updated to reflect the committed changes.