nova: define kernel memory based on system memory

Switch to kernel branch, that determines the available system memory during
boot time. The overall kernel memory is still static, but during boot time
dynamically the amount can be chosen. Following 3 config option exists:

CONFIG_MEMORY_BOOT is the amount of kernel memory allocated in the BSS
statically - effectively chosen during link time - see linker script.

CONFIG_MEMORY_DYN_MIN && CONFIG_MEMORY_DYN_PER_MILL configures the dynamic
part of the kernel memory allocation applied during early kernel boot time.
CONFIG_MEMORY_DYN_MIN is the amount of memory which should be allocated at
least. CONFIG_MEMORY_DYN_PER_MILL defines the amount of the system memory in
per mill which should be allocated at most. The overall maximum kernel memory
is restricted to ~1G (64bit), due to the chosen internal virtual memory layout.

Fixes #2985
This commit is contained in:
Alexander Boettcher
2018-09-13 16:53:57 +02:00
committed by Christian Helmuth
parent 5d15c8d534
commit 3824ad4756
4 changed files with 14 additions and 5 deletions

View File

@ -20,7 +20,10 @@ CC_OPT += -pipe \
-fdata-sections -fomit-frame-pointer -freg-struct-return \
-freorder-blocks -funit-at-a-time -fno-exceptions -fno-rtti \
-fno-stack-protector -fvisibility-inlines-hidden \
-fno-asynchronous-unwind-tables -std=gnu++0x
-fno-asynchronous-unwind-tables -std=gnu++0x
# kernel memory: 28M minimum dynamic or 10 pro mill of the system memory
CC_OPT += -DCONFIG_MEMORY_DYN_MIN=0x1c00000 \
-DCONFIG_MEMORY_DYN_PER_MILL=10
CC_OPT_PIC :=
ifeq ($(filter-out $(SPECS),32bit),)
override CC_MARCH = -m32
@ -44,7 +47,7 @@ LD_SCRIPT_STATIC = hypervisor.o
$(TARGET): hypervisor.o
hypervisor.o: $(NOVA_SRC_DIR)/src/hypervisor.ld target.mk
$(VERBOSE)$(CC) $(INCLUDES) -DCONFIG_KERNEL_MEMORY=32M -MP -MMD -pipe $(CC_MARCH) -xc -E -P $< -o $@
$(VERBOSE)$(CC) $(INCLUDES) -DCONFIG_MEMORY_BOOT=4M -MP -MMD -pipe $(CC_MARCH) -xc -E -P $< -o $@
clean cleanall:
$(VERBOSE)rm -rf $(NOVA_BUILD_DIR)