[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v3 1/3] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
- Date: Wed, 1 Jul 2026 20:28:33 +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=ZS228F3QXeflNqzA5oshsUqALsaBJFHT4qC4wRbMdFw=; b=hG8xEOyLj5+1sFRCAS6wuCYa+5x87szN5phhEI32OVWECNgHqRHDt6qrAokpNOgYO8W+Z5mBPS8vrLoQBXxRCR4+Te/JQ0KdONaPtYZlLkVAgzPXN/81WsrIwlTvUOHPbo1RYfPGNFMhqo/wTjokE3DlpCnJ9KeN7mZsRujuw8nIK65z66x/KMJUKdKwsZsLcswX2YDGuaedoQMN5yLaMe28ylTCyfJriI+9ulkRI88fL+6efCagNQLOTLh3GkuGFqJRVFj68IbHYpjOkr4NPDtvwfhX3kvXRA2qdJNOtGlxFP8PcHhEzWtZvq8U3EYdb6pN8ntz59WrOIP4atHUbg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xjZn1xJWkSpz7WVskK1qVrCYlisHDPeFPWvt66lf4pB3++KW0z1g6sDTXiJZIWt1MzLugKPEj0gSDXzEBqo0xwwvRVwtOlOX5faHEnlRMyrSVgQ7icMAjFyfIOD9mGHPE2/fA470zbe9S08+SEECXk/bleL3xGbNNvEvFps5Lbbn8AqmEo2eZnnChexP3dqOmqNmew10su/PuUKU6LeKHnVnjwGaG56OBi94OqZy4Bca42mI2goTWWAeQVa+1WmIS/3H4HJG1yKWd4o+Rjf7QIIDy5D2tQC7Y6StQEOFa1ocQOjE7hCXHJfm0XMlvWBLLKnckaA56mlmnAF2mUInoA==
- 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, 01 Jul 2026 20:28:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHdCBJguMZzJpb/JEe22XtErI4LcbZWqjWAgAHISeCAABufgIAAi7BQ
- Thread-topic: [PATCH v3 1/3] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration
Hello,
> Subject: Re: [PATCH v3 1/3] xen/device-tree: Parse 'cpu-map' node for CPU
> topology exploration
>
> On 01.07.2026 13:11, Hirokazu Takahashi wrote:
> >>> +static unsigned int __init get_cpu_for_node(struct dt_device_node
> *node)
> >>
> >> Pointer-to-const?
> >
> > Do you mean this should be replaced with the following line?
> > static unsigned int __init get_cpu_for_node(struct dt_device_node *const
> node)
>
> No, that's a const pointer-to-something.
>
> static unsigned int __init get_cpu_for_node(const struct dt_device_node *node)
Understood.
> >>> +#else /* CONFIG_CPU_TOPOLOGY */
> >>> +
> >>> +#define cpu_topology ((struct cpu_topology *)NULL)
> >>
> >> Why exactly is this needed? It very much looks as if its presence may hide
> bugs.
> >
> > In the current code, the condition if ( cpu_topology ) is used to cover both
> cases:
> > when CONFIG_CPU_TOPOLOGY is disabled, and when memory allocation for
> > topology table fails.
> >
> > The next patch uses if ( cpu_topology ).
> >
> > static int setup_cpu_sibling_map(int cpu)
> > {
> > if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)) ||
> > !zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
> > return -ENOMEM;
> >
> > if ( cpu_topology )
>
> if ( IS_ENABLED(CONFIG_GENERIC_CPU_TOPOLOGY) )
This line should be if ( IS_ENABLED(CONFIG_GENERIC_CPU_TOPOLOGY) &&
cpu_topology )
because 'cpu_topology' can be NULL even if CONFIG_GENERIC_CPU_TOPOLOGY is on.
void __init init_cpu_topology(void)
{
unsigned int cpu;
cpu_topology = xzalloc_array(struct cpu_topology, nr_cpu_ids);
if ( !cpu_topology )
{
printk(XENLOG_ERR "Failed to allocate memory for cpu_topology table\n");
return;
}
:
:
Thank you,
Hirokazu Takahashi.
|