[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH 1/3] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Sun, 14 Jun 2026 00:00:45 +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=Gju0G6BUGfrAIq1ITyKQaK2KGIOreDoLWj0WRHoJLtc=; b=D2qjYxdDKLEAY2DIza1jI2SEVsUkKNhS42RYLZGzrb50sXPr6MXFCMrPNX9ZOerNAJWKmqv0LZwZe0oSbhwfLQiaQkol1J9CTqgZ99yl8WtYEIExINUsUwm2loys6IM7ZF+wcsbms/6saYjZU+pv1Auo0bPKcl2nKSB60djvvNBYwKtsfXGH9BR22krWpYtk9/l2MS4JxMLmba3sAXmFgdAmPXkqt2BeCyTJ7vKhnFpZceeU60yrICAO4RTVgZJwhLQ4SrFelmXuebVjNhFm0tfDWehSs/TgfpyQnm+EOhY6HPAZMzDvFj1Det3k2vPdn8N9rSDRleR55epatLrMXQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G3J1D0b0rwb+S4xV9Y8xqnI44yDVK/+U53piPLHsxEPM7Mp9aOYbQF8+DE17cvPI9n7MiEm2Bm70sku10ovAiVMqLxv1ydeQRN1JIYA50qktJotWtendHbzUiGyCd1TlyKYEIhtk3n3TPLcJ29U0fKvBZdccxjWEI9kcz+Qf9cZyDg2r4vtse5Kpn34r1r2Bs5y1eZ8dtGQCtJ6Mhk1hDl2CbRmeBjnHog7N2Tt0EzNcYh3rdse362tX2rcMSOsyNiGCFo+/QakiYmY26KJ5jvFeVGjERCH1KiGNixn1ixwUq0RAAFjmERzfDHqQMg78jCSmGzKJxJsG3ozfduF6Dg==
  • 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: "Mykyta_Poturai@xxxxxxxx" <Mykyta_Poturai@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Sun, 14 Jun 2026 00:01:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHc+MoozrCC9Pa1YkC7YJKVJ6P2UbY5878AgAGxwTA=
  • Thread-topic: [PATCH 1/3] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration

Hello,

Thank you for your advice.

> > diff --git a/xen/common/device-tree/cpu-topology.c
> b/xen/common/device-tree/cpu-topology.c
> > new file mode 100644
> > index 0000000000..bbdf0d1fe8
> > --- /dev/null
> > +++ b/xen/common/device-tree/cpu-topology.c
> > @@ -0,0 +1,342 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +/*
> > + * Derived from Linux kernel 7.0's $drivers/base/arch_topology.c
> > + * Parse cpu topology information.
> > + *
> > + * Copyright (c) 2026 VA Linux Systems Japan K.K.
> > + * Author: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
> 
> We don't commonly have copyright header in the tree and instead use the
> commit message to keep track of Copyright. That said, if you want to
> keep it, I think you ought to keep the copyright from Linux because your
> code is based on it.

Ok, I will remove the copyright lines from the header.

> > +#include <xen/cpu.h>
> > +#include <xen/cpumask.h>
> > +#include <xen/delay.h>
> > +#include <xen/device_tree.h>
> > +#include <xen/cpu-topology.h>
> > +#include <xen/numa.h>
> > +#include <xen/domain_page.h>
> > +#include <xen/errno.h>
> > +#include <xen/init.h>
> > +
> > +struct cpu_map {
> > +    unsigned int thread_id;
> > +    unsigned int core_id;
> > +    unsigned int cluster_id;
> > +    unsigned int package_id;
> > +};
> > +
> > +struct cpu_topology *cpu_topology;
> 
> Looking at the use in the other patch, you seem to unconditionally use
> cpu_topology when CONFIG_DT_CPU_TOPOLOGY. However, you don't seem to
> fill it when the system is using ACPI.
> 
> So I think this either needs to be moved to common code and filled by
> ACPI or we need to make clear in the name that this is DT specific.
> 
> [...]

You are completely right, and thank you for pointing out this gap. 
I agree that the ACPI path needs to be properly handled.
I will fill the cpu information with temporary values for now though the goal 
is to
populate it by scanning the ACPI PPTT (Processor Properties Topology Table).

> > +void __init dt_init_cpu_topology(void)
> > +{
> > +    unsigned int cpu;
> > +    const unsigned int nr_cpus = cpumask_last(&cpu_possible_map) + 1U;
> > +
> > +    cpu_topology = xzalloc_array(struct cpu_topology, nr_cpus);
> > +    if ( !cpu_topology )
> > +        panic("Failed to allocate memory for cpu_topology array\n");
> > +
> > +    if (parse_dt_topology())
> 
> Style: AFAICT, this is following Xen style. So it wants to be:
> 
> if ( ... )

Ok, I will fix it.

Thank you,
Hirokazu Takahashi.

 


Rackspace

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