[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <61b95cfbcf7b812348b543189ce7f4539c082ccd.camel@xry111.site>
Date: Mon, 25 Dec 2023 19:11:19 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Huacai Chen <chenhuacai@...nel.org>, maobibo <maobibo@...ngson.cn>
Cc: loongson-kernel@...ts.loongnix.cn, loongarch@...ts.linux.dev, Xuefeng Li
<lixuefeng@...ngson.cn>, Guo Ren <guoren@...nel.org>, Xuerui Wang
<kernel@...0n.name>, Jiaxun Yang <jiaxun.yang@...goat.com>,
linux-kernel@...r.kernel.org, Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH] LoongArch: Let cores_io_master cover the largest NR_CPUS
On Mon, 2023-12-25 at 17:19 +0800, Huacai Chen wrote:
> On Mon, Dec 25, 2023 at 5:13 PM maobibo <maobibo@...ngson.cn> wrote:
> >
> >
> >
> > On 2023/12/25 下午3:00, Huacai Chen wrote:
> > > Now loongson_system_configuration::cores_io_master only covers 64 cpus,
> > > if NR_CPUS > 64 there will be memory corruption. So let cores_io_master
> > > cover the largest NR_CPUS (256).
> > >
> > > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> > > ---
> > > arch/loongarch/include/asm/bootinfo.h | 4 ++--
> > > arch/loongarch/kernel/acpi.c | 2 +-
> > > arch/loongarch/kernel/smp.c | 2 +-
> > > 3 files changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/arch/loongarch/include/asm/bootinfo.h b/arch/loongarch/include/asm/bootinfo.h
> > > index c60796869b2b..32fd0319594a 100644
> > > --- a/arch/loongarch/include/asm/bootinfo.h
> > > +++ b/arch/loongarch/include/asm/bootinfo.h
> > > @@ -30,7 +30,7 @@ struct loongson_system_configuration {
> > > int boot_cpu_id;
> > > int cores_per_node;
> > > int cores_per_package;
> > > - unsigned long cores_io_master;
> > > + unsigned long cores_io_master[4];
> > Can the hardcoded 4 be defined something like this?
> > DIV_ROUND_UP(CONFIG_NR_CPUS, sizeof(long))
> Can this be used to define arrays?
Yes, it's basically just expanded to (((CONFIG_NR_CPUS) + (sizeof(long))
- 1) / (sizeof(long)). Per the C standard (C99 section 6.6 p6) it's an
integer constant expression and can be used as array size.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists