[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v3 02/22] xen/common: Default function to get the distance between nodes
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
- Date: Sat, 20 Jun 2026 17:52: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=C9rNCRJjLYIvtFhKmifqrGKvfDo6GGujgJo78R3/Eiw=; b=M9DJMB4I1d50Es3ngyxj44WFnJiQe1frKCqBPCYh26i156RBvV7Py4+VJJxv2vsHpdXCTNYLEYvInnQ6+CA71nbt/oAz+yDw8oVejzGzKr2tCRzV+n3V9fxJfAooru7FAeydDde2WxnCxSgZCbxRXRX6wO/M4F9gcD29ZzCL31tgjjZUY7vuXAsEkaassbOIpxhkXLjG/E4VWuCjNMC00anpIs3qoQU4OET7EMcxJ0JXW0OqMkNRj4G7lvjhXXXTRgZsLXtzSdtjKp/rXxEdIPlZaQvllfg7o+xrBCAh205xcVYOtvmOmUx8bAJOYcMG0SHsEumhDUhpTvcR7j21qw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=boZfn4ZzzlpctAXUihK8Jmdl6H5iHUG4sEPvyh538waQ4fILPxT5IadoaNa47DVw+/T1Vo79LkhXdnnAQOk/jeXuK1wtf/5PIRDX/c0CooBSZbvjmK6u4FAgIj3CH0VWaAsyGisCu3D7gX2XTIh00jMeYkiGhNcYEtZapqf3G8FuEid36P+gJ76K6p7gg9HezKtdOtztH7hZDCwofVUgg63ww/baH5kMptwhWuv0a8MKU58APpGvyHpF5rkMiq+ZbpKYQyBrkOIi3uO/VjsqKben2YlbaLR4OuGzDWrQwWNvdhrN7ZexbvAHjwnrMyrMZLOrK1GVhlj8ywWkLQemeA==
- 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Sat, 20 Jun 2026 17:52:57 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHc/8BFrLztQEh49k68JcxFGb2JAbZFinQAgAEHD2A=
- Thread-topic: [PATCH v3 02/22] xen/common: Default function to get the distance between nodes
Hello,
Thanks for the comments.
> > --- /dev/null
> > +++ b/xen/common/numa-distance-map.c
> > @@ -0,0 +1,19 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +
> > +#include <xen/errno.h>
> > +#include <xen/init.h>
> > +#include <xen/nodemask.h>
>
> Why would any of these be needed here?
Ok, I will remove them.
> > +#include <xen/numa.h>
> > +
> > +#define LOCAL_DISTANCE 10
> > +#define REMOTE_DISTANCE 20
> > +
> > +/*
> > + * Get the distance between node 'from' and node 'to'.
> > + */
>
> In the description you say this is a fallback, but that doesn't become
> clear from this comment at all.
>
> > +uint8_t numa_node_distance(unsigned int from, unsigned int to)
>
> If both parameters are node IDs, then why aren't they of type nodeid_t?
Okay, I will use nodeid_t.
Originally, this function was in the Device Tree code where nodeid_t could not
be used due to a header dependency issue (the ARM NUMA header defined nodeid_t
only after including the DT NUMA header, making it unavailable for extern
declarations there).
Now that the function has been separated into common code, this restriction no
longer applies.
> And then why is the return value a fixed width type? See ./CODING_STYLE.
Okay, I will change the return type to unsigned int.
The node distance values range from 0U to 0xFFU, so I initially used a fixed
width type as the x86 implementation does.
> > +{
> > + if ( from != to )
> > + return REMOTE_DISTANCE;
> > + return LOCAL_DISTANCE;
> > +}
>
> Nit (style): If you don't want to use the conditional operator (so the
> body would be a single line), please have a blank line ahead of the
> function's main return statement.
Okay.
Hirokazu Takahashi.
|