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

From: Sudeep Holla
Date: Tue Jan 14 2020 - 09:48:23 EST


On Tue, Jan 14, 2020 at 12:17:41PM +0000, Zengtao (B) wrote:
[...]

> Thanks very much for your explanation.
> So finally it turns into a very simple patch like this, more cleaner:
> +/*
> + * This function returns the logic cpu number of the node.
> + * There are basically three kinds of return values:
> + * (1) logic cpu number which is > 0.
> + * (2) -ENDEV when the node is valid one which can be found in the device tree

s/ENDEV/ENODEV/ again :)

> + * but there is no possible cpu nodes to match, when the CONFIG_NR_CPUS is
> + * smaller than cpus node numbers in device tree, this will happen. It's
> + * suggested to just ignore this case.
> + * (3) -1 if the node does not exist in the device tree
> + */
> static int __init get_cpu_for_node(struct device_node *node)
> {
> struct device_node *cpu_node;
> @@ -261,7 +271,8 @@ static int __init get_cpu_for_node(struct device_node *node)
> if (cpu >= 0)
> topology_parse_cpu_capacity(cpu_node, cpu);
> else
> - pr_crit("Unable to find CPU node for %pOF\n", cpu_node);
> + pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n",
> + cpu_node, cpumask_pr_args(cpu_possible_mask));
>
> of_node_put(cpu_node);
> return cpu;
> @@ -286,9 +297,8 @@ static int __init parse_core(struct device_node *core, int package_id,
> cpu_topology[cpu].package_id = package_id;
> cpu_topology[cpu].core_id = core_id;
> cpu_topology[cpu].thread_id = i;
> - } else {
> - pr_err("%pOF: Can't get CPU for thread\n",
> - t);
> + } else if (cpu != -ENODEV) {
> + pr_err("%pOF: Can't get CPU for thread\n", t);
> of_node_put(t);
> return -EINVAL;
> }
> @@ -307,7 +317,7 @@ static int __init parse_core(struct device_node *core, int package_id,
>
> cpu_topology[cpu].package_id = package_id;
> cpu_topology[cpu].core_id = core_id;
> - } else if (leaf) {
> + } else if (leaf && cpu != -ENODEV) {
> pr_err("%pOF: Can't get CPU for leaf core\n", core);
> return -EINVAL;
> }
>
> Any more suggestions?

None except the above minor nit. I will wait for v3 before I give ack/review
tag. Thanks for the patience.

--
Regards,
Sudeep