Re: [PATCH] cpu-topology: Skip the exist but not possible cpu nodes

From: Dietmar Eggemann
Date: Mon Jan 06 2020 - 13:42:11 EST

On 02/01/2020 04:24, Zeng Tao wrote:
> When CONFIG_NR_CPUS is smaller than the cpu nodes defined in the device
> tree, the cpu node parsing will fail. And this is not reasonable for a
> legal device tree configs.
> In this patch, skip such cpu nodes rather than return an error.

Is this extra code really necessary?

Currently you get warnings indicating that CONFIG_NR_CPUS is too small
so you could correct the setup issue easily.

Example: Arm64 Juno board

$ grep "cpu@" ./arch/arm64/boot/dts/arm/juno.dts
A57_0: cpu@0 {
A57_1: cpu@1 {
A53_0: cpu@100 {
A53_1: cpu@101 {
A53_2: cpu@102 {
A53_3: cpu@103 {

root@juno:~# uname -r

root@juno:~# zcat /proc/config.gz | grep CONFIG_NR_CPUS

root@juno:~# cat /proc/cpuinfo | grep ^proc
processor : 0
processor : 1
processor : 2
processor : 3

root@juno:~# dmesg | grep "Unable\|Can't"
[ 0.085089] Unable to find CPU node for /cpus/cpu@102
[ 0.090179] /cpus/cpu-map/cluster1/core2: Can't get CPU for leaf core