@@ -1424,6 +1424,7 @@ void mark_rodata_ro(void)
/* Adjustable memory block size */
static unsigned long set_memory_block_size;
+static unsigned long memory_block_size_probed;
int __init set_memory_block_size_order(unsigned int order)
{
unsigned long size = 1UL << order;
@@ -1432,6 +1433,19 @@ int __init set_memory_block_size_order(unsigned int order)
return -EINVAL;
set_memory_block_size = size;
+
+ /*
+ * If the block size has already been probed, we need to change it.
+ * This can happen during ACPI/CFMWS parsing, since it needs to
+ * probe the system for the existing block size to avoid increasing
+ * the block size if lower memory happens to be misaligned
+ */
+ if (memory_block_size_probed) {
+ memory_block_size_probed = size;
+ pr_warn("x86/mm: Memory block size changed: %ldMB\n",
+ size >> 20);
+ }
+
return 0;
}
@@ -1471,7 +1485,6 @@ static unsigned long probe_memory_block_size(void)
return bz;
}
-static unsigned long memory_block_size_probed;
unsigned long memory_block_size_bytes(void)
{
if (!memory_block_size_probed)
When parsing CFMWS, we need to know the current block size expected to avoid accidentally adjusting the size upward. This causes a value to be cached in a static global. Update the static global if the value is subsequently updated. Print a warning that this has occurred for debugging purposes if blocksize is changed at an unexpected time. Signed-off-by: Gregory Price <gourry@gourry.net> --- arch/x86/mm/init_64.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)