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

RE: [PATCH v2 07/24] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Wed, 3 Jun 2026 09:59: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=mISiI+NtV8gyfxPraswyLTz51xEPPhbrxccb0q1CX0c=; b=kf6PryD/3a3hPQGWZiFYjVkeG4x7hunvsy05l/DoiPyqMUoVZJjvc/9K2sY1mcZP22IreHXUgkC1slrvOehYzjnRnZn2mTf5vrcclo/g/8sg04EXJNV1Wli6Zy7Z1vrLReLJffOhFXZ1wDyA6+RtxRhOTXH945THXY6VdnOKaQq79mhXWW8Jek75UpU5FU2DOWAWTwWoB3WlmIkOLCPz88r9DMycTtORfdztgX2LOCQYUwj5/m74ehAx5E/Kt5OnYtPz6yer3TilZTSAFcbLYXr+0MqAWGAtoMXmDiLvKR48aPnaAHcx4Db0P6OtCW4xWF2PnXlPx9dK9BXhCYYoEg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I2vjYtn9SqIRePQy7I1h/oDQJqLEGGs9s8DBMa284WrO2ql+ylYO2aZKgd2FlICxaepOQ9yWOoLOUmJ4UlGt8oNxUIdfumhcIqOUwbXCx4JrGxxk7Rl9hj2PsPulBA7+aj9X4qrsDFvLuw7XLtUeQU9E1GfU8HCeCmpjvfZuY/BCiiQxcHsfNhAhz0aBQO1AL1XFMWr3T94qK+KLfssUUYV5+SzeJgAzzkpBknCBIvH7s4BYLENYo06+MybokyTp8ksTJtKAfJwwWC3LM5jHe2vhbHBAGz0rm1MuSlR6egjm2x+4FOJMyS4xOk2gWKXZJq662pQAZKgh1LR0DpMXiQ==
  • 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: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, 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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 03 Jun 2026 10:00:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHc8U+PsZhvkHY9vEqKRtt8NHnfGrYrBomAgAF93dA=
  • Thread-topic: [PATCH v2 07/24] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration

Hello, 

> > --- /dev/null
> > +++ b/xen/include/xen/cpu-topology.h
> > @@ -0,0 +1,42 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +
> > +#ifndef XEN_CPU_TOPOLOGY_H
> > +#define XEN_CPU_TOPOLOGY_H
> > +
> > +#include <xen/types.h>
> > +#include <xen/device_tree.h>
> > +
> > +struct cpu_topology {
> > +    int thread_id;
> > +    int core_id;
> > +    int cluster_id;
> > +    int package_id;
> 
> Can any of these go negative? If not, "unsigned int" please. Iirc I said the
> same elsewhere on v1. Please apply such comments throughout the series.

These members can actually be '-1' to represent a missing entry when parsing 
the Device Tree's 
'cpu-map' node. 

Since I imported this directly from Linux kernel 7.0 (specifically from 
include/linux/arch_topology.h 
and drivers/base/arch_topology.c), I would lean toward keeping them as 'int' to 
minimize 
any divergence from the original Linux implementation. 

Would that be acceptable?


> > +
> > +#ifdef CONFIG_DT_CPU_TOPOLOGY
> > +extern struct cpu_topology cpu_topology[NR_CPUS];
> 
> If at all possible, no new NR_CPUS dimensioned arrays please.

This is also part of the code imported from Linux kernel 7.0, which is used to 
store
unique topology data per CPU. 

I kept it as an array to match the original Linux source, but I understand the 
concern
about adding new NR_CPUS dimensioned arrays in Xen. I can refactor it to use 
Xen's
per-CPU infrastructure instead. 
 
> > +void map_cpuid_to_node(u32 cpuid, struct dt_device_node *cpu_node);
> > +void dt_init_cpu_topology(void);
> > +
> > +#elif CONFIG_DEVICE_TREE_PARSE
> > +
> > +static inline void map_cpuid_to_node(u32 cpuid, struct dt_device_node
> *cpu_node) {}
> 
> No new uses of u32 please. As to use of fixed-width type, please see
> ./CODING_STYLE.

Ok, I will use unsigned int instead.

Thank you,
Hirokazu Takahashi.

 


Rackspace

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