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

RE: [PATCH v3 07/22] xen/device-tree: Read NUMA node distance from Device Tree 'distance-map'


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Mon, 22 Jun 2026 08:49:15 +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=fXE1xC2RoOlm/GNSVVn1OMIsj1mPTKUyiFQyYUwVAyY=; b=wZR4xpy1nCJer3F1ibjYt/tWS3Eg02I414FvwOsvXrBSvYLPLsoLi1YTmq0mU2i579WCZBp9bXrzj2Bx4+ukA4WU/Mly0724pa4K+PQXcfBM02CbKvxJ5r8B0rjqBgoMJVPNmjD5SADBFnP7X2ewUznrIdAttJrBNAxEu+pDIZN9MAI09AHVfFr95PmRd0sk2kBJQHUHfJ7dCAMILM+fPQ74BEkPYLF8yXKFxOh03BeQMZu6iRd5ljJNml/W3us14OLlFTzuvWjKv7vVJN18Z+mXjJTho72rK66XvAihxFZzKxMAOqoX1Y0XcTXwgg3Zv0gQFUKypu8H3hmruBZaAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vCkKFkFISr3ue+0dlsUYtChiTw3OjhfdmQW9WVW+aewZSQyUiAgTTKNSyFVYn1jxk9LsK4qyPhkJBCSxRIxd2U3yqlVJguZeQoljmV2trj1LK0gGCD/hWNRWvw1lJZmRy49uqXuWdtR2x9GgYHFMYek+OI5VUGzgVauf2Z3VA2vT5UZJ+/WhrybvKEMVZ9eDYptHSqF5LX9oNill0Huztmt1g6fS0qYUiNfvHhqxkQSGyiGDsxInEpuScpmhta+fF/HhHUIWswQUlgZmL1TlvXeurtBoqKk8EjjwEcuphoRovojRp2iD1fiKeL/QWKzOi3KuKUlB6QVE+deUSVs1Ig==
  • 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: Mon, 22 Jun 2026 08:49:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHc/8BKTM3OweAnP0qpxuJk/PcKwrZFkCwAgAIwFqCAAn5KgIAACM8Q
  • Thread-topic: [PATCH v3 07/22] xen/device-tree: Read NUMA node distance from Device Tree 'distance-map'

Hello,

> >>> +    entry_count = len / sizeof(__be32);
> >>
> >> Nit: Better sizeof(<expression>).
> >
> > Is the following line better?
> > entry_count = len / sizeof(*matrix);
> 
> Yes.

Okay.

> >>> +    const unsigned int nr_nodes = last_node(node_online_map) + 1U;
> >>> +
> >>> +    if ( from >= nr_nodes || to >= nr_nodes )
> >>> +        return from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE;
> >>
> >> What if either node is NUMA_NO_NODE?
> >
> > This behavior comes from the Linux kernel. It seems it exists as a defensive
> > fallback to keep the system running even with invalid or unassigned nodes.
> >
> > Do you think it is better to make it return 0xFF instead whenever any
> > out-of-bounds node or NUMA_NO_NODE is passed?
> 
> Whether it's 0xff or REMOTE_DISTANCE I'm not quite sure. But it certainly
> shouldn't be LOCAL_DISTANCE.

Yes, that makes sense.

> >>> +    for ( i = 0U; i < nr_nodes; i++ )
> >>> +        for ( j = 0U; j < nr_nodes; j++ )
> >>
> >> Why the U suffixes?
> >
> > I added the U suffixes because variables i and j are unsigned types.
> > If a plain 0 is preferred here, I will remove them.
> 
> They, even if only slightly, hamper readability. We tend to add them only
> when there actually is a need.

Okay.

Hirokazu Takahashi.

 


Rackspace

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