Linux-ACPI Archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG
@ 2021-12-16  9:58 Vitaly Kuznetsov
  2021-12-17 18:12 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Kuznetsov @ 2021-12-16  9:58 UTC (permalink / raw)
  To: linux-acpi
  Cc: Rafael J. Wysocki, Len Brown, Huacai Chen, Igor Mammedov,
	linux-kernel

Some systems (e.g. Hyper-V guests) have all their memory marked as
hotpluggable in SRAT. acpi_numa_memory_affinity_init(), however,
ignores all such regions when !CONFIG_MEMORY_HOTPLUG and this is
unfortunate as memory affinity (NUMA) information gets lost.

'Hot Pluggable' flag in SRAT only means that "system hardware supports
hot-add and hot-remove of this memory region", it doesn't prevent
memory from being cold-plugged there.

Ignore 'Hot Pluggable' bit instead of skipping the whole memory
affinity information when !CONFIG_MEMORY_HOTPLUG.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/acpi/numa/srat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index b8795fc49097..6c884f3e8332 100644
--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	}
 	if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
 		goto out_err;
-	hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
-	if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
-		goto out_err;
+	hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
+		(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
 
 	start = ma->base_address;
 	end = start + ma->length;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG
  2021-12-16  9:58 [PATCH] ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG Vitaly Kuznetsov
@ 2021-12-17 18:12 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-12-17 18:12 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: ACPI Devel Maling List, Rafael J. Wysocki, Len Brown, Huacai Chen,
	Igor Mammedov, Linux Kernel Mailing List, Jonathan Cameron,
	Dan Williams

On Thu, Dec 16, 2021 at 10:58 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> Some systems (e.g. Hyper-V guests) have all their memory marked as
> hotpluggable in SRAT. acpi_numa_memory_affinity_init(), however,
> ignores all such regions when !CONFIG_MEMORY_HOTPLUG and this is
> unfortunate as memory affinity (NUMA) information gets lost.
>
> 'Hot Pluggable' flag in SRAT only means that "system hardware supports
> hot-add and hot-remove of this memory region", it doesn't prevent
> memory from being cold-plugged there.
>
> Ignore 'Hot Pluggable' bit instead of skipping the whole memory
> affinity information when !CONFIG_MEMORY_HOTPLUG.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Makes sense to me, so applied as 5.17 material, but CC Dan and
Jonathan in case this can be problematic for some mm-related reason.

> ---
>  drivers/acpi/numa/srat.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> index b8795fc49097..6c884f3e8332 100644
> --- a/drivers/acpi/numa/srat.c
> +++ b/drivers/acpi/numa/srat.c
> @@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
>         }
>         if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
>                 goto out_err;
> -       hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
> -       if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
> -               goto out_err;
> +       hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
> +               (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
>
>         start = ma->base_address;
>         end = start + ma->length;
> --
> 2.33.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-17 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16  9:58 [PATCH] ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG Vitaly Kuznetsov
2021-12-17 18:12 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).