[PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE

John Garry posted 4 patches 1 month ago
[PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
Posted by John Garry 1 month ago
The arch definition of cpumask_of_node() cannot handle NUMA_NO_NODE - which
is a valid index - so add a check for this.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 arch/mips/include/asm/mach-loongson64/topology.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
index 3414a1fd17835..89bb4deab98a6 100644
--- a/arch/mips/include/asm/mach-loongson64/topology.h
+++ b/arch/mips/include/asm/mach-loongson64/topology.h
@@ -7,7 +7,7 @@
 #define cpu_to_node(cpu)	(cpu_logical_map(cpu) >> 2)
 
 extern cpumask_t __node_cpumask[];
-#define cpumask_of_node(node)	(&__node_cpumask[node])
+#define cpumask_of_node(node)	  ((node) == NUMA_NO_NODE ? cpu_all_mask : &__node_cpumask[node])
 
 struct pci_bus;
 extern int pcibus_to_node(struct pci_bus *);
-- 
2.43.5
Re: [PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
Posted by Thomas Bogendoerfer 1 week, 2 days ago
On Wed, Jan 07, 2026 at 09:40:06AM +0000, John Garry wrote:
> The arch definition of cpumask_of_node() cannot handle NUMA_NO_NODE - which
> is a valid index - so add a check for this.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>  arch/mips/include/asm/mach-loongson64/topology.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
> index 3414a1fd17835..89bb4deab98a6 100644
> --- a/arch/mips/include/asm/mach-loongson64/topology.h
> +++ b/arch/mips/include/asm/mach-loongson64/topology.h
> @@ -7,7 +7,7 @@
>  #define cpu_to_node(cpu)	(cpu_logical_map(cpu) >> 2)
>  
>  extern cpumask_t __node_cpumask[];
> -#define cpumask_of_node(node)	(&__node_cpumask[node])
> +#define cpumask_of_node(node)	  ((node) == NUMA_NO_NODE ? cpu_all_mask : &__node_cpumask[node])
>  
>  struct pci_bus;
>  extern int pcibus_to_node(struct pci_bus *);
> -- 
> 2.43.5

applied to mips-next
Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
Re: [PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
Posted by Huacai Chen 2 weeks, 1 day ago
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>

On Wed, Jan 7, 2026 at 5:51 PM John Garry <john.g.garry@oracle.com> wrote:
>
> The arch definition of cpumask_of_node() cannot handle NUMA_NO_NODE - which
> is a valid index - so add a check for this.
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>  arch/mips/include/asm/mach-loongson64/topology.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
> index 3414a1fd17835..89bb4deab98a6 100644
> --- a/arch/mips/include/asm/mach-loongson64/topology.h
> +++ b/arch/mips/include/asm/mach-loongson64/topology.h
> @@ -7,7 +7,7 @@
>  #define cpu_to_node(cpu)       (cpu_logical_map(cpu) >> 2)
>
>  extern cpumask_t __node_cpumask[];
> -#define cpumask_of_node(node)  (&__node_cpumask[node])
> +#define cpumask_of_node(node)    ((node) == NUMA_NO_NODE ? cpu_all_mask : &__node_cpumask[node])
>
>  struct pci_bus;
>  extern int pcibus_to_node(struct pci_bus *);
> --
> 2.43.5
>
Re: [PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
Posted by John Garry 1 week, 2 days ago
On 25/01/2026 03:55, Huacai Chen wrote:
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>

Thanks

So can a loongarch or mips maintainer pick this up please?

> 
> On Wed, Jan 7, 2026 at 5:51 PM John Garry <john.g.garry@oracle.com> wrote:
>>
>> The arch definition of cpumask_of_node() cannot handle NUMA_NO_NODE - which
>> is a valid index - so add a check for this.
>>
>> Signed-off-by: John Garry <john.g.garry@oracle.com>
>> ---
>>   arch/mips/include/asm/mach-loongson64/topology.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
>> index 3414a1fd17835..89bb4deab98a6 100644
>> --- a/arch/mips/include/asm/mach-loongson64/topology.h
>> +++ b/arch/mips/include/asm/mach-loongson64/topology.h
>> @@ -7,7 +7,7 @@
>>   #define cpu_to_node(cpu)       (cpu_logical_map(cpu) >> 2)
>>
>>   extern cpumask_t __node_cpumask[];
>> -#define cpumask_of_node(node)  (&__node_cpumask[node])
>> +#define cpumask_of_node(node)    ((node) == NUMA_NO_NODE ? cpu_all_mask : &__node_cpumask[node])
>>
>>   struct pci_bus;
>>   extern int pcibus_to_node(struct pci_bus *);
>> --
>> 2.43.5
>>

Re: [PATCH v2 3/4] MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
Posted by Thomas Bogendoerfer 1 week, 2 days ago
On Fri, Jan 30, 2026 at 12:21:45PM +0000, John Garry wrote:
> On 25/01/2026 03:55, Huacai Chen wrote:
> > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> 
> Thanks
> 
> So can a loongarch or mips maintainer pick this up please?

I'll take MIPS patch.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]