* [PATCH v2] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
@ 2020-09-21 2:39 Zhengyuan Liu
2020-09-21 22:14 ` Will Deacon
0 siblings, 1 reply; 2+ messages in thread
From: Zhengyuan Liu @ 2020-09-21 2:39 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: gshan, will
The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that
case it will trigger the following WARN_ON(node >= nr_node_ids) due to
mismatched data types of @node and @nr_node_ids. Actually we should
return cpu_all_mask just like most other architectures do if passed
NUMA_NO_NODE.
Also add a similar check to the inline cpumask_of_node() in numa.h.
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Zhengyuan Liu <liuzhengyuan@tj.kylinos.cn>
---
arch/arm64/include/asm/numa.h | 3 +++
arch/arm64/mm/numa.c | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
index 626ad01e83bf..dd870390d639 100644
--- a/arch/arm64/include/asm/numa.h
+++ b/arch/arm64/include/asm/numa.h
@@ -25,6 +25,9 @@ const struct cpumask *cpumask_of_node(int node);
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
static inline const struct cpumask *cpumask_of_node(int node)
{
+ if (node == NUMA_NO_NODE)
+ return cpu_all_mask;
+
return node_to_cpumask_map[node];
}
#endif
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 73f8b49d485c..88e51aade0da 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -46,7 +46,11 @@ EXPORT_SYMBOL(node_to_cpumask_map);
*/
const struct cpumask *cpumask_of_node(int node)
{
- if (WARN_ON(node >= nr_node_ids))
+
+ if (node == NUMA_NO_NODE)
+ return cpu_all_mask;
+
+ if (WARN_ON(node < 0 || node >= nr_node_ids))
return cpu_none_mask;
if (WARN_ON(node_to_cpumask_map[node] == NULL))
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
2020-09-21 2:39 [PATCH v2] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Zhengyuan Liu
@ 2020-09-21 22:14 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2020-09-21 22:14 UTC (permalink / raw)
To: linux-arm-kernel, Zhengyuan Liu
Cc: catalin.marinas, gshan, kernel-team, Will Deacon
On Mon, 21 Sep 2020 10:39:36 +0800, Zhengyuan Liu wrote:
> The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that
> case it will trigger the following WARN_ON(node >= nr_node_ids) due to
> mismatched data types of @node and @nr_node_ids. Actually we should
> return cpu_all_mask just like most other architectures do if passed
> NUMA_NO_NODE.
>
> Also add a similar check to the inline cpumask_of_node() in numa.h.
Applied to arm64 (for-next/misc), thanks!
[1/1] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
https://git.kernel.org/arm64/c/a194c5f2d2b3
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-21 22:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 2:39 [PATCH v2] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Zhengyuan Liu
2020-09-21 22:14 ` Will Deacon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.