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

RE: [PATCH v2 2/9] xen/x86: Use enumerations to indicate NUMA status


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Thu, 14 Jul 2022 09:03:59 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hslQ4VZDIgTi9JwMfhJR+um9vEhPPpETHGrRcNjqtfE=; b=f6K1HW5Wg7fclhXPoHZU0LyRi64unRcTYxvWiV1OuM6vgMBOCqoySgfbL0RzH0SJqg7drnEJ2PwCcYwQ9fZoNoBMTwg9Oz/2yibAMSoSqk0IeHsJE5Bi7isPaCnqrkFZNbRC2sANl5KJ/rJJcdBN4dD1N66KtUytGefMXg3E8lGN1Wz+kfHombrUwFg0TwyQF2d7pJe5U43D74m9b17obWvX+d3hqTz3Gx8e5pQAMytGBS2IXDT18sPSrdmjCe+obPsq1aVfgmgKW+LbZOcRnAKQsSCigiLQv0bqDXUvaWcHFUw0JxwqHgld5jSxONSBSSgePzZXr2UQVxg4P0yDlQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hslQ4VZDIgTi9JwMfhJR+um9vEhPPpETHGrRcNjqtfE=; b=cbZQaIkTvx810qrfs43R98pURfAqPrfWVz+NT7qghEMoUVG6/giQS4FPzBR+YbaYWX6/8unIBYHriGLlWtXbq5Sx8qnagjvBlfESSsekZ5uH9Iod+PPO3AyGWOEUFaS6dH9BHs9RRXHmm/HsCA7UcrC8RiDLq3zjKLFsPHs9Y1nQInmzpEg6umX8miPEQKavxZiaZSQWlvFTfHl7dFVNVvhzGxDLPKE51d0uloY5s9Le9+nLV9mIMyBHnF2QETY4RLo2/EVPK+2hR2bnpmQ/VssSEEfbqHyM73SL6NouUryWLLoitwtpDkMmVlfKBhdonoj3Nrp303aVSZE53+hI4g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Aiclgq715UvQsaVxRyeYXldxfKn6L9hnH7xZmp3+d19kqPjEJBQ4XwGG9vDFxOstylQJ1fqnotYJpAk88pH/9HAcsRpOqAzq7xZ8b5QUDyCkiWuWRJdMdVyICRaXVjyRG32kFGVzTvlmD93zK+S24mGUphImR3SU+/+CfHwM8LK2gZj8YbcnHukho7/qQX1Ki2xY66KGOJw3mHgaom9ij49PUpbR25rOFzKbkq8PC6mC9R0gqaC8p1fvQ3fcaJuEl1pAkPGB0Bav1pGykUk8VC6y7SYdJZG6/+XhiE0VLwoetbuoV7iD2LsUI+xpTwu5yRGjNGSv75/RwllBM/E8SQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kB+hiyHxNOSrU+Fv3lyM/D8MXmq07Aw5jQttat/bx4b72dOsNuQhEQ83eWDqreA5Iy5OZqOQv31tdvaTFvAI3gHkQRTYDxxdfQcAdbASpOaWf3VG5bkaCp4O4b8jQRMlUmjG/OiPRdDUUOHlGNOz1VuGvbqlY+4Vn+c3UgEPGFmIxXqvJCATa7T6GGvmSKsAW+kfQLZjIVpr+u7sqVxh3GNuZhS7OQ+6jiUOrBnwsP/D7asy0T6YCo9UcURFayO3/euKsRkZF4x+DofyZlj2e8CaPSvUU1KfG8JUoiPe+QDJkakanakeIuLqHomtaZOUpepqD8dmrwzJyaEMWLkvhA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: nd <nd@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 14 Jul 2022 09:04:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYktrASbKlS5xyGUK27wSgSLVuo616tdwAgALfc0A=
  • Thread-topic: [PATCH v2 2/9] xen/x86: Use enumerations to indicate NUMA status

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年7月12日 20:49
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: nd <nd@xxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Roger Pau
> Monné <roger.pau@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 2/9] xen/x86: Use enumerations to indicate NUMA
> status
> 
> On 08.07.2022 16:54, Wei Chen wrote:
> > In current code, x86 is using two variables, numa_off and acpi_numa,
> > to indicate the NUMA status. This is because NUMA is not coupled with
> > ACPI, and ACPI still can work without NUMA on x86. With these two
> > variables' combinations, x86 can have several NUMA status:
> > NUMA swith on,
> > NUMA swith off,
> > NUMA swith on with NUMA emulation,
> > NUMA swith on with no-ACPI,
> > NUMA swith on with ACPI.
> 
> Hmm, with both this and the actual change I'm not able to convince
> myself that you've expressed the prior combinations correctly. May
> I suggest that you make table representing the 6 (I think)
> combinations of original states with their mapping to the new
> enumerators? (It doesn't need to be 6 different enumerators, but
> all 6 existing states need a [proper] representation in the new
> model.)
> 

Sorry for replying later, I paid sometime to check the code again,
and drew a table like below, I ignore two columns when numa_off=true
and acpi_numa=1/-1. Because when numa_off = true, ACPI srat table
will not be parsed:
+-----------+---------+---------------+-----------+------------+----------+
| original  |  col1   |  col2         |  col3     |  col4      |  col5    |
+-----------+---------+---------------+-----------+------------+----------+
|numa_off   |true     |false          |false      |false       |false     |
|acpi_numa  |0        |0              |1          |-1          |x         |
|numa_fake  |x        |x              |x          |x           |fake_nodes|
|enum state |numa_off |numa_fw_nodata |numa_fw_ok |numa_fw_bad |numa_emu  |
+-----------+---------+---------------+-----------+------------+----------+

Notes:
The following scenarios will make acpi_numa=0:
1. Xen disable ACPI through acpi_disabled = 1.
2. ACPI table doesn't have SRAT, or SRAT doesn't contain CPU and memory
   NUMA affinity information.
3. Emulate numa through "numa=fake" command line parameter. But I found
   that when numa_fake is enabled, current code will not prevent ACPI
   srat parsers to parse NUMA information. So acpi_numa still may be
   changed later. Is there any further reasons that we still need to
   parse NUMA info from SRAT table when numa=fake? Or can we set
   acpi_numa = -1 in nume_setup when "numa=fake" to make srat_disabled
   can prevent ACPI SRAT parsing.

If meet the following conditions, then acpi_numa = 1:
1. Xen enable ACPI through acpi_disabled = 0.
2. ACPI SRAT parser can parse CPU and Memory NUMA affinities successfully
   from SRAT table.
3. Pass the memmory blocks' sanity check and hash computing in
   acpi_scan_nodes.

The following scenarios will make acpi_numa=-1:
1. ACPI table is disabled  by "numa=noacpi" command like parameter.
2. Xen enable ACPI through acpi_disabled = 0 but ACPI SRAT parser can not
   parse CPU or Memory NUMA affinities successfully from SRAT table.
3. The memmory blocks' sanity check or hash computing in acpi_scan_nodes
   is failed.

> As an aside - I think you mean "switched" in all five of these
> lines.
> 

Yes, I will fix them in next version.

> > --- a/xen/arch/x86/include/asm/numa.h
> > +++ b/xen/arch/x86/include/asm/numa.h
> > @@ -28,12 +28,22 @@ extern nodeid_t pxm_to_node(unsigned int pxm);
> >  #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
> >  #define VIRTUAL_BUG_ON(x)
> >
> > +/* Enumerations for NUMA status. */
> > +enum numa_mode {
> > +   numa_on = 0,
> > +   numa_off,
> 
> May I suggest to switch these two around, such that "off" becomes
> the meaning of 0, potentially allowing ! to be used in a boolean-
> like fashion here or there? And please omit the "= 0" part - it's
> only non-zero first values which actually need spelling out.
> 

Ok.

> > +   /* NUMA turns on, but ACPI table is bad or disabled. */
> > +   numa_no_acpi,
> > +   /* NUMA turns on, and ACPI table works well. */
> > +   numa_acpi,
> 
> As to the names of these: In the description you already say that
> you want to re-use the code for non-ACPI cases. Wouldn't you better
> avoid "acpi" in the names then (rather than perhaps renaming these
> another time later on)?
> 
> I'd also like to understand what useful state "numa_no_acpi" is.
> I realize this was a state expressable by the two original
> variables, but does it make sense?
> 

I have updated the new names in above table. And "numa_no_acpi"
is mapping to " numa_fw_bad" enum state.

> > @@ -528,7 +528,8 @@ int __init acpi_scan_nodes(paddr_t start, paddr_t
> end)
> >     for (i = 0; i < MAX_NUMNODES; i++)
> >             cutoff_node(i, start, end);
> >
> > -   if (acpi_numa <= 0)
> > +   /* Only when numa_on with good firmware, we can do numa scan nodes.
> */
> > +   if (!numa_enabled_with_firmware())
> >             return -1;
> 
> Nit: Perhaps drop "do numa" from the comment?
> 

Ok, I will do it in next version.

Cheers,
Wei Chen

> Jan

 


Rackspace

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