Re: [tip:x86/boot] ACPI/NUMA: Add warning message if the padding size for KASLR is not enough

From: Peter Zijlstra
Date: Wed Oct 03 2018 - 08:34:18 EST



Subject: ACPI/NUMA: Fix KASLR build error

There is no point in trying to compile KASLR specific code when there is
no KASLR.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 3d69834c692f..5767733976b3 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -436,7 +436,6 @@ acpi_table_parse_srat(enum acpi_srat_type id,
int __init acpi_numa_init(void)
{
int cnt = 0;
- u64 max_possible_phys, max_actual_phys, threshold;

if (acpi_disabled)
return -EINVAL;
@@ -466,8 +465,11 @@ int __init acpi_numa_init(void)
cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
acpi_parse_memory_affinity, 0);

+#ifdef CONFIG_RANDOMIZE_MEMORY
/* check the padding size for KASLR is enough. */
if (parsed_numa_memblks && kaslr_enabled()) {
+ u64 max_possible_phys, max_actual_phys, threshold;
+
max_actual_phys = roundup(PFN_PHYS(max_pfn), 1ULL << 40);
max_possible_phys = roundup(PFN_PHYS(max_possible_pfn), 1ULL << 40);
threshold = max_actual_phys + ((u64)rand_mem_physical_padding << 40);
@@ -477,6 +479,7 @@ int __init acpi_numa_init(void)
(max_possible_phys - max_actual_phys) >> 40);
}
}
+#endif
}

/* SLIT: System Locality Information Table */