|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [PATCH v13 1/5] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration
Hi Michal,
> > Parse the 'cpu-map' node in the Device Tree to extract CPU topology
> > information. If the 'cpu-map' node is absent, simply ignore it.
> For the v14, that hopefully will be the last revision of this patch, can you
> please extend the commit msg. For such a big change it deserves a proper
> commit
> msg explaining what, why and how.
Okay, I will
> > +static void __init free_topology_table(void)
> > +{
> > + unsigned int cpu;
> > +
> > + if ( !cpu_topology )
> > + return;
> You did not use goto as I suggested and instead used ifs. It's ok but with
> that
> this check is now dead.
Okay, I wiil remove the code.
> > --- /dev/null
> > +++ b/xen/common/device-tree/cpu-topology.c
> > @@ -0,0 +1,374 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Derived from Linux kernel 7.0's $drivers/base/arch_topology.c
> > + * Parse cpu topology information.
> > + */
> > +
> > +#include <xen/acpi.h>
> xen/acpi.h is not used here and please include xen/dt-cpu-topology.h
Okay.
> > +#include <xen/cpu-topology.h>
> > +#include <xen/cpumask.h>
> > +#include <xen/device_tree.h>
> > +#include <xen/errno.h>
> > +#include <xen/init.h>
> > +static int __init parse_cluster(const struct dt_device_node *cluster,
> > + unsigned int socket_id,
> > + unsigned int cluster_id)
> > +{
> > + bool has_cores = false;
> > + int ret = 0;
> > +
> > + if ( dt_find_child_node_by_name(cluster, "cluster0") )
> > + {
> > + printk(XENLOG_ERR
> > + "Topology for clusters of clusters not yet supported\n");
> > + return -EINVAL;
> > + }
> > +
> > + for ( unsigned int core_id = 0; ; core_id++ )
> > + {
> > + const struct dt_device_node *core;
> > + char name[20];
> > +
> > + snprintf(name, sizeof(name), "core%u", core_id);
> > + core = dt_find_child_node_by_name(cluster, name);
> > +
> > + if ( !core )
> > + break;
> > +
> > + has_cores = true;
> > +
> > + ret = parse_core(core, socket_id, cluster_id, core_id);
> > + if ( ret != 0 )
> > + return ret;
> > + }
> > +
> > + if ( !has_cores )
> > + printk(XENLOG_WARNING "%s: empty cluster\n",
> > + dt_node_full_name(cluster));
> Incorrect indentation.
I will fix it.
> > +int __init dt_init_cpu_topology(void)
> > +{
> > + unsigned int cpu;
> > + int ret;
> > +
> > + ASSERT(cpu_topology);
> > +
> > + ret = parse_dt_topology();
> > + if ( ret == 0 )
> > + for_each_possible_cpu(cpu)
> > + setup_siblings_masks(cpu);
> I thought about what I told you a few revisions ago about a missing check if
> we
> compare this code to Linux. I think we need to have one i.e. to check that
> every
> CPU is indeed described in our cpu topology. Otherwise, if `cpu-map` does not
> describe a CPU, such CPU keeps the invalid values and ends up being placed in
> its own socket/cluster/core.
Okay, I wiil add some checks.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |