[PATCH] ACPI/MRRM: Fix default max memory region

Anil S Keshavamurthy posted 1 patch 6 months, 3 weeks ago
drivers/acpi/acpi_mrrm.c | 3 ++-
include/linux/acpi.h     | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
[PATCH] ACPI/MRRM: Fix default max memory region
Posted by Anil S Keshavamurthy 6 months, 3 weeks ago
Per the spec, the default max memory region must be 1 covering
all system memory.

When platform does not provide ACPI MRRM table or
when CONFIG_ACPI is opted out, the acpi_mrrm_max_mem_region() function
defaults to  returning 1 region complying to RDT spec.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
---
 drivers/acpi/acpi_mrrm.c | 3 ++-
 include/linux/acpi.h     | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c
index 2f22f013959a..26c1a4e6b6ec 100644
--- a/drivers/acpi/acpi_mrrm.c
+++ b/drivers/acpi/acpi_mrrm.c
@@ -14,7 +14,8 @@
 #include <linux/string.h>
 #include <linux/sysfs.h>
 
-static int max_mem_region = -ENOENT;
+/* Default assume one memory region covering all system memory, per the spec */
+static int max_mem_region = 1;
 
 /* Access for use by resctrl file system */
 int acpi_mrrm_max_mem_region(void)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index e72100c0684f..f102c0fe3431 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1101,7 +1101,7 @@ static inline acpi_handle acpi_get_processor_handle(int cpu)
 
 static inline int acpi_mrrm_max_mem_region(void)
 {
-	return -ENOENT;
+	return 1;
 }
 
 #endif	/* !CONFIG_ACPI */
-- 
2.47.1
RE: [PATCH] ACPI/MRRM: Fix default max memory region
Posted by Luck, Tony 6 months, 3 weeks ago
> Per the spec, the default max memory region must be 1 covering
> all system memory.
>
> When platform does not provide ACPI MRRM table or
> when CONFIG_ACPI is opted out, the acpi_mrrm_max_mem_region() function
> defaults to  returning 1 region complying to RDT spec.
>
> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>

Good (corner case) catch. I was too focused on the assumption that MRRM
table will be present when needed. Always a good plan to have a backup
option if BIOS does something strange.

Reviewed-by: Tony Luck <tony.luck@intel.com>

-Tony
Re: [PATCH] ACPI/MRRM: Fix default max memory region
Posted by Rafael J. Wysocki 6 months, 3 weeks ago
On Fri, May 23, 2025 at 7:48 PM Luck, Tony <tony.luck@intel.com> wrote:
>
> > Per the spec, the default max memory region must be 1 covering
> > all system memory.
> >
> > When platform does not provide ACPI MRRM table or
> > when CONFIG_ACPI is opted out, the acpi_mrrm_max_mem_region() function
> > defaults to  returning 1 region complying to RDT spec.
> >
> > Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
>
> Good (corner case) catch. I was too focused on the assumption that MRRM
> table will be present when needed. Always a good plan to have a backup
> option if BIOS does something strange.
>
> Reviewed-by: Tony Luck <tony.luck@intel.com>

Applied, thanks!