Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    f102fe0a
    acpi: Fix early-ACPI partial linear map · f102fe0a
    Nadav Har'El authored
    
    When running on a KVM host without EPT, OSv used to crash if ran 1GB
    or less memory. The crash was in early acpi initialization, which called
    AcpiOsMapMemory, which called linear_map() on the small chunk of physical
    memory requested by ACPI.
    
    It turns out that the chunk requested was just 4096 bytes, which caused
    our linear_map() implementation to break down a huge-page into small-pages.
    This didn't work - I'm don't know yet what exactly is the bug or why it
    only shows up when the host doesn't use EPT, or if the memory is smaller
    than 1GB...
    
    But in any case, since we know our complete linear map always uses huge
    pages, I think it makes no sense to map a single small page, and we can
    just map a whole huge page. This will cause linear_map() not to try to
    break up any huge pages, and this bug goes away.
    
    Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
    f102fe0a
    History
    acpi: Fix early-ACPI partial linear map
    Nadav Har'El authored
    
    When running on a KVM host without EPT, OSv used to crash if ran 1GB
    or less memory. The crash was in early acpi initialization, which called
    AcpiOsMapMemory, which called linear_map() on the small chunk of physical
    memory requested by ACPI.
    
    It turns out that the chunk requested was just 4096 bytes, which caused
    our linear_map() implementation to break down a huge-page into small-pages.
    This didn't work - I'm don't know yet what exactly is the bug or why it
    only shows up when the host doesn't use EPT, or if the memory is smaller
    than 1GB...
    
    But in any case, since we know our complete linear map always uses huge
    pages, I think it makes no sense to map a single small page, and we can
    just map a whole huge page. This will cause linear_map() not to try to
    break up any huge pages, and this bug goes away.
    
    Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>