grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: grub causing NVDIMMs to be treated as normal memory


From: Elliott, Robert (Persistent Memory)
Subject: RE: grub causing NVDIMMs to be treated as normal memory
Date: Tue, 1 Dec 2015 00:25:05 +0000

> grub-core/efiemu/mm.c:
> * efiemu_alloc_requests reqorder[] - add GRUB_EFI_PERSISTENT_MEMORY
>   (although we don't want to encourage ever allocating these
>    ranges, UNUSABLE_MEMORY is already there)

Reviewing that code, since this array has one entry per 
EFI memory type:
static grub_size_t requested_memory[GRUB_EFI_MAX_MEMORY_TYPE];

but grub_efiemu_request_memalign() is the only function
that sets the entries to non-zero values, and that function
filters out GRUB_EFI_LOADER_CODE:
        if (type >= GRUB_EFI_MAX_MEMORY_TYPE || type <= GRUB_EFI_LOADER_CODE)
          return -2;

then the efiemu_alloc_requests() reqorder[] array entry for
GRUB_EFI_LOADER_CODE is not used.

Should the <= really be <, or should that entry be removed from
the reqorder[] array?  Those lines were all created together in 
patch 5caf964d.

Regardless, I think it's best to add GRUB_EFI_PERSISTENT_MEMORY
to that filter and keep it out of the reqorder[] array, so it's
handled like GRUB_EFI_RESERVED_MEMORY_TYPE (which is the only
value < GRUB_EFI_LOADER_CODE):

  if (type <= GRUB_EFI_LOADER_CODE || type == GRUB_EFI_PERSISTENT_MEMORY ||
        type >= GRUB_EFI_MAX_MEMORY_SIZE)


---
Robert Elliott, HPE Persistent Memory






reply via email to

[Prev in Thread] Current Thread [Next in Thread]