[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: Thu, 2 Jul 2026 08:07:14 +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=Lm2Xs0vJxEQMJv1GsMyDFtYzEB3g9T9GExU9KeoBEME=; b=TTfMWqQbf7ExHLGwmLHGXASOue6glenvR24HxYdWJAaa7Y1wjum7rJvrofhVuqhBQv3WTFFhuIC+nQ8wwgH/vBTwVRC5Jne99eYCnqoQQameSnTiCZwlLXFGT02U3d3v3UZ65JYa1jdmSm/j619lOnjQwYpZ+pRmzYjdeBEtyUJe+8DI8cZACGV2xQgXB/OhXvSqpOHC0WvfZYE2+fqDDO0Du+vZCdu0P+PJTRpVAaFdHePtuldT7eedFxL297dnS3AUCTZ7WrPZmVw8GIVj4SVwFFgwvfL3ABKrSDah9fpU4QxnNZE0zrg7EhY4p8g2jg86HRpKwZ4RTeoSR8kMyg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TUkYh5Y+D4G98NAg0UpiOP8AVDzft/twQmPLC2YhKR+ssLXIYyXh1a7LHafNPoAgzVzCdpFlC/0HZp+HfBTMMP6taiusMZHhAz8Tir5FT/k20c4+pPqQByeGDPUjxL5vKl5mn2SsXKFpJN8Rgg62IUAL0LCE7/5B4dSaHzhSZW4n7FsNg63gT/4HpovhKsNIUj6+gyesgGLY0Uuw/IiAm0KcjZ7GwtkPm97/tEJkJbXDoHRSQmfS8gXAcdxEBjpcfUxbQ30ZzWYKL6iRlXzWsWcsDFcQu8uzoD+VV57IuL6kSqHlAZ9mGoy7Nk57BJVtuZ0CRi72sOvCXVQQ6hVkig==
  • 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: Thu, 02 Jul 2026 08:07:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdCBJguMZzJpb/JEe22XtErI4LcbZWqjWAgAHISeCAABufgIAAi7BQgAClhICAACFHIA==
  • Thread-topic: [PATCH v3 1/3] xen/device-tree: Parse 'cpu-map' node for CPU topology exploration

Hello,

> >>>>> +#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;
> >     }
> 
> Ah yes. The odd #define can nevertheless go away, which is the important part.

Here is my current plan:
In the `cpu-topology.h` header, I will provide an initialization function for 
`cpu_sibling_mask`
and `cpu_core_mask` when `CONFIG_GENERIC_CPU_TOPOLOGY` is on, along with another
definition when it is off, and then call them from `setup_cpu_sibling_map()`.

Thank you,
Hirokazu Takahashi.

 


Rackspace

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