Re: [RFC PATCH v2 3/4] x86/boot/KASLR: Walk srat tables to filter immovable memory

From: Chao Fan
Date: Mon Jul 16 2018 - 21:03:30 EST


On Mon, Jul 16, 2018 at 01:44:47PM +0200, Ingo Molnar wrote:
>
>* Chao Fan <fanc.fnst@xxxxxxxxxxxxxx> wrote:
>
>> If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
>> tables, store the immovable memory regions, so that kaslr can get
>> the information abouth where can be selected or not.
>> If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code.
>>
>> Signed-off-by: Chao Fan <fanc.fnst@xxxxxxxxxxxxxx>
>> ---
>> arch/x86/boot/compressed/kaslr.c | 55 ++++++++++++++++++++++++++++++++
>> 1 file changed, 55 insertions(+)
>>
>> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
>> index 531c9876f573..0ec5aab915db 100644
>> --- a/arch/x86/boot/compressed/kaslr.c
>> +++ b/arch/x86/boot/compressed/kaslr.c
>> @@ -31,6 +31,7 @@
>>
>> #include "misc.h"
>> #include "error.h"
>> +#include "acpitb.h"
>> #include "../string.h"
>>
>> #include <generated/compile.h>
>> @@ -104,6 +105,14 @@ static bool memmap_too_large;
>> /* Store memory limit specified by "mem=nn[KMG]" or "memmap=nn[KMG]" */
>> unsigned long long mem_limit = ULLONG_MAX;
>>
>> +#ifdef CONFIG_MEMORY_HOTREMOVE
>> +/* Store the movable memory */
>> +struct mem_vector immovable_mem[MAX_NUMNODES*2];
>> +
>> +/* Store the num of movable mem regions */
>> +static int num_immovable_mem;
>> +#endif
>
>So comment says 'movable', but variables are named 'immovable'??

Sorry for the typo, will change it immidiately.

Thanks,
Chao Fan

>
>Thanks,
>
> Ingo
>
>