mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Fix acpi_package_ids array overflow
@ 2026-08-04  7:57 Bibo Mao
  2026-08-04  8:57 ` Tao Cui
  0 siblings, 1 reply; 3+ messages in thread
From: Bibo Mao @ 2026-08-04  7:57 UTC (permalink / raw)
  To: Huacai Chen; +Cc: WANG Xuerui, Rong Bao, loongarch, linux-kernel, stable

With LoongArch virt machine, one typical setting is one core per socket,
there will max 256 sockets on one VM. With PPTT acpi table, array
acpi_package_ids will be overflowed.

Here change array size of acpi_package_ids with max value of
MAX_PACKAGES and KVM_MAX_VCPUS.

Fixes: 4e8f58620f67 ("LoongArch: Retrieve CPU package ID from PPTT when available")
Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 arch/loongarch/kernel/acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index 873e90990771..cb454ee92b20 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -13,6 +13,7 @@
 #include <linux/export.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
+#include <linux/kvm_host.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
 #include <linux/serial_core.h>
@@ -202,7 +203,7 @@ static void __init acpi_process_madt(void)
 
 int pptt_enabled;
 static int acpi_nr_packages;
-static int acpi_package_ids[MAX_PACKAGES];
+static int acpi_package_ids[MAX(MAX_PACKAGES, KVM_MAX_VCPUS)];
 
 int __init parse_acpi_topology(void)
 {

base-commit: 075b74841bd0065a3bda3440873c747938e69b68
-- 
2.39.3


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

* Re: [PATCH] LoongArch: Fix acpi_package_ids array overflow
  2026-08-04  7:57 [PATCH] LoongArch: Fix acpi_package_ids array overflow Bibo Mao
@ 2026-08-04  8:57 ` Tao Cui
  2026-08-09  4:07   ` Huacai Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Tao Cui @ 2026-08-04  8:57 UTC (permalink / raw)
  To: Bibo Mao, Huacai Chen
  Cc: cui.tao, WANG Xuerui, Rong Bao, loongarch, linux-kernel, stable



在 2026/8/4 15:57, Bibo Mao 写道:
> With LoongArch virt machine, one typical setting is one core per socket,
> there will max 256 sockets on one VM. With PPTT acpi table, array
> acpi_package_ids will be overflowed.
> 
> Here change array size of acpi_package_ids with max value of
> MAX_PACKAGES and KVM_MAX_VCPUS.
> 
> Fixes: 4e8f58620f67 ("LoongArch: Retrieve CPU package ID from PPTT when available")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>  arch/loongarch/kernel/acpi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
> index 873e90990771..cb454ee92b20 100644
> --- a/arch/loongarch/kernel/acpi.c
> +++ b/arch/loongarch/kernel/acpi.c
> @@ -13,6 +13,7 @@
>  #include <linux/export.h>
>  #include <linux/irq.h>
>  #include <linux/irqdomain.h>
> +#include <linux/kvm_host.h>
>  #include <linux/memblock.h>
>  #include <linux/of_fdt.h>
>  #include <linux/serial_core.h>
> @@ -202,7 +203,7 @@ static void __init acpi_process_madt(void)
>  
>  int pptt_enabled;
>  static int acpi_nr_packages;
> -static int acpi_package_ids[MAX_PACKAGES];
> +static int acpi_package_ids[MAX(MAX_PACKAGES, KVM_MAX_VCPUS)];
>  
>  int __init parse_acpi_topology(void)
>  {
> 
> base-commit: 075b74841bd0065a3bda3440873c747938e69b68
Reviewed-by: Tao Cui <cuitao@kylinos.cn>


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

* Re: [PATCH] LoongArch: Fix acpi_package_ids array overflow
  2026-08-04  8:57 ` Tao Cui
@ 2026-08-09  4:07   ` Huacai Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2026-08-09  4:07 UTC (permalink / raw)
  To: Tao Cui; +Cc: Bibo Mao, WANG Xuerui, Rong Bao, loongarch, linux-kernel, stable

On Tue, Aug 4, 2026 at 4:57 PM Tao Cui <cui.tao@linux.dev> wrote:
>
>
>
> 在 2026/8/4 15:57, Bibo Mao 写道:
> > With LoongArch virt machine, one typical setting is one core per socket,
> > there will max 256 sockets on one VM. With PPTT acpi table, array
> > acpi_package_ids will be overflowed.
> >
> > Here change array size of acpi_package_ids with max value of
> > MAX_PACKAGES and KVM_MAX_VCPUS.
> >
> > Fixes: 4e8f58620f67 ("LoongArch: Retrieve CPU package ID from PPTT when available")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> > ---
> >  arch/loongarch/kernel/acpi.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
> > index 873e90990771..cb454ee92b20 100644
> > --- a/arch/loongarch/kernel/acpi.c
> > +++ b/arch/loongarch/kernel/acpi.c
> > @@ -13,6 +13,7 @@
> >  #include <linux/export.h>
> >  #include <linux/irq.h>
> >  #include <linux/irqdomain.h>
> > +#include <linux/kvm_host.h>
> >  #include <linux/memblock.h>
> >  #include <linux/of_fdt.h>
> >  #include <linux/serial_core.h>
> > @@ -202,7 +203,7 @@ static void __init acpi_process_madt(void)
> >
> >  int pptt_enabled;
> >  static int acpi_nr_packages;
> > -static int acpi_package_ids[MAX_PACKAGES];
> > +static int acpi_package_ids[MAX(MAX_PACKAGES, KVM_MAX_VCPUS)];
> >
> >  int __init parse_acpi_topology(void)
> >  {
> >
> > base-commit: 075b74841bd0065a3bda3440873c747938e69b68
> Reviewed-by: Tao Cui <cuitao@kylinos.cn>
Applied, thanks.

Huacai
>

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

end of thread, other threads:[~2026-08-09  4:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-04  7:57 [PATCH] LoongArch: Fix acpi_package_ids array overflow Bibo Mao
2026-08-04  8:57 ` Tao Cui
2026-08-09  4:07   ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®