[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


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Wed, 2 Dec 2026 03:55:27 +0000
  • Accept-language: ja-JP, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MXF2C7foRWy4uKZxGPDMdzLU10F1BjtwkoRiE2MZJuI=; b=GcVwKoNjJoWZA4QmuuC4/iM3lSm+1UnaDwXAFHE+I+1nrVcYvHPg50RYXM+onV+zQZfhAIVT1dhOIRszgv+3useUrlRtTviYVhSVS2NTt64ZAQyOyvscVQ+V7WMQSxUxc8r+Efumlpfmu5zkxd0SK08EotqtHaCyA9S3WwZTHIB3pfaZTwpf75BZ2FQEaTty1uVIaVdNBD2x2HPG1cK2y/L0aT2zksr6T/KO1/BTrp1jTALNxW0ou9OqCQ5zSMKbZoL1VKQp56W8D1niMkuQiODromhNffCRlZiOdlqSRA1w6yNUU3/BOoP3ZBCghUwB4r4Kt14MZhyU/bEfLKvDKw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nSD7rBv9CLnof2P32FyG8K14DrgQPtilcKzN7D0YnWnARqg7llP+JXLpOwkii10SgnQamp3YFEOTcg9sKKYRlHYYY468+BrDrdF/7noJ0dNdlxOt7hr5hbFSDUhrpRlAIU1slJPYSJtyNHNahZ4U370TRJjpoqfWTIlSmssU0hGpOl5RGGjRnfTqWEY/YO/sktSAC4fx0z8rtDYnOOfSwVf+G9nFPlbYlsMo+CgNcBAELThmSgLAqbvPBUlGezCBxopCpFj5NIhv9cMjyLtEHhgxyKraRVoeR6pepWd8Gg3PjFpzUQqKiqZOqp3/fWV7xhZv+vJp4oUTgQ+KRjwCpQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 02 Dec 2026 03:55:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdgJg0YTIar9aLNUG9v8T1q1bCQrdICzsAgAERRjA=
  • Thread-topic: [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.

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.