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)
Wed, Dec 4, 12:43 AM
Unknown Object (File)
Tue, Dec 3, 9:16 AM
Unknown Object (File)
Fri, Nov 29, 2:55 PM
Unknown Object (File)
Fri, Nov 29, 2:55 PM
Unknown Object (File)
Fri, Nov 29, 2:55 PM
Unknown Object (File)
Tue, Nov 26, 5:23 PM
Unknown Object (File)
Mon, Nov 25, 2:28 AM
Unknown Object (File)
Fri, Nov 22, 8:38 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.