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

[PATCH v4 0/8] Device tree based NUMA support for Arm - Part#1


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Mon, 23 May 2022 14:25:17 +0800
  • 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] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); 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=SLQ2m7gOYNHgd1/212k4a11FnWgtoPLhxR6vTurlfYI=; b=NdP3nIpeMgLIsxs6kFyZqi+/SXkDcljwyl4yJttuzAU8ttDSzKUWPwg22EhjQK6SZ/Jngefqd9TTJ8s7zcghg/HnH2q/TMaxhCA9UZAB6Io9A92/2NeC2wd48rwtEKv5kncxDos7FdgOHgRqN2CpdJ6iVzvPP7+TDSa5/9ROAkcMzys9C0lHbhTplDjzUjj2IpmeLlLvZTJWo98iORRdz8A0j5EZeW6QYSwRHaE2QUpn5NjoNvXZpRvLnj0aYZgv6OspJA3v0R7JaWeyOT0jpqyrLhsy8ajK1lOpKmuwkSYFy6dcE2OpHUFA5kMCoILjooGkC1nDVNgSvXRz/15G4w==
  • 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=SLQ2m7gOYNHgd1/212k4a11FnWgtoPLhxR6vTurlfYI=; b=fKOQcp5THVvWIZcAMpKgNgSfDdgvDnPs61cTAKu1LUqgJj+/Tkt/YsQMcpTNz7CI5DCMS1Y+0JgQgP3IB0GjysrVYu2OiVxtcDGtC32ARWAeEC+JsQDZT3OgV7VLVVqAW4I487ATBfyX5nW6AZWEWr6o7sIQ6nJ/MqRinjsjNqPZqxrO4+5GwPwvoJm+LVUMrAZsIiUdLqT6e1Htyunj52kQR2K1l+w06aIOAZvJJn7EGY7nDFXJOoJd+t0wmFWlURj+XlvSfhB3Dj7aF9Kkd7CK2IxaVOodq+1z7QBW3jnJJc6OJQB3DXcxfEWyS7Bv3G8niRzHHvpm/BbQ7peNwg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=R4qad5UlQypIBk30htOiHvSGaqgeFI66ggtEbzEWHUMXMCjyNTcd1JYUt14RenE/PqUUvQCMJwmwIy54WWQkHpbwmW1JtP/Hc+kRwEgCTow4FNrlzsOvI2m3k7OTbHjImNPBjOmpiwdGHkATeTgVx1teYXPlf5nFuICADSJw95G7Nj4vKja9n+J1QKqnj5R8oPuGhO0swUijxJNmDrYipjtFzl0ojIOIi59Kbrjatq/zgYw0W0DspSpFfcCvhxE2K0S04ztMQa+p18YgAUsQdMcu0C7jPC7ZOsS7AgWLax7GjGQpiRnW6bJitA1EmOv7qkF0A01kZSELgq8N4Vo0tg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDhpa+lTL5L52+E4Hk52PUfM18pqdxt8VEEYU4gFvslXpbOBTWgh9d2rTvPQJr68xkHR0wn4+EMAda3IBykSH8Px4R5Zy4+c5GZMyvftKn1Aha2fI2b6N5bjbenjq5c6vQ+WSTKft0cYgdbEfTr7JD3gH7f92QAfBpPbgCZSG6S7NjBhYbmuoIkLMnWF4Wkd1YmVkao6vsJk1YMvr/NLbnMV3plc3aV9E2tPqAzgvMSpsR28nYdzhsg2a1znAA91pwCaxBne2RbD8ZlZN2IkLw+q0o6Hpt3nyK8WcnWsL/MqSndDWDmSwZOYpVjZfcjyel3lgpVePloIDrJnNRgnqQ==
  • Cc: <nd@xxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Mon, 23 May 2022 06:26:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

(The Arm device tree based NUMA support patch set contains 35
patches. In order to make stuff easier for reviewers, I split
them into 3 parts:
1. Preparation. I have re-sorted the patch series. And moved
   independent patches to the head of the series.
2. Move generically usable code from x86 to common.
3. Add new code to support Arm.

This series only contains the first part patches.)

Xen memory allocation and scheduler modules are NUMA aware.
But actually, on x86 has implemented the architecture APIs
to support NUMA. Arm was providing a set of fake architecture
APIs to make it compatible with NUMA awared memory allocation
and scheduler.

Arm system was working well as a single node NUMA system with
these fake APIs, because we didn't have multiple nodes NUMA
system on Arm. But in recent years, more and more Arm devices
support multiple nodes NUMA system.

So now we have a new problem. When Xen is running on these Arm
devices, Xen still treat them as single node SMP systems. The
NUMA affinity capability of Xen memory allocation and scheduler
becomes meaningless. Because they rely on input data that does
not reflect real NUMA layout.

Xen still think the access time for all of the memory is the
same for all CPUs. However, Xen may allocate memory to a VM
from different NUMA nodes with different access speeds. This
difference can be amplified in workloads inside VM, causing
performance instability and timeouts.

So in this patch series, we implement a set of NUMA API to use
device tree to describe the NUMA layout. We reuse most of the
code of x86 NUMA to create and maintain the mapping between
memory and CPU, create the matrix between any two NUMA nodes.
Except ACPI and some x86 specified code, we have moved other
code to common. In next stage, when we implement ACPI based
NUMA for Arm64, we may move the ACPI NUMA code to common too,
but in current stage, we keep it as x86 only.

This patch serires has been tested and booted well on one
Arm64 NUMA machine and one HPE x86 NUMA machine.

---
Part1 v3->v4:
1. Add indent to make ln and test to be aligned in EFI
   common makefile.
2. Drop "ERR" prefix for node conflict check enumeration,
   and remove init value.
3. Use "switch case" for enumeration, and add "default:"
4. Use "PXM" in log messages.
5. Use unsigned int for node memory block id.
6. Fix some code-style comments.
7. Use "nd->end" in node range expansion check.
Part1 v2->v3:
1. Rework EFI stub patch:
   1.1. Add existed file check, if exists a regular stub files,
        the common/stub files' links will be ignored.
   1.2. Keep stub.c in x86/efi to include common/efi/stub.c
   1.3. Restore efi_compat_xxx stub functions to x86/efi.c.
        Other architectures will not use efi_compat_xxx.
   1.4. Remove ARM_EFI dependency from ARM_64.
   1.5. Add comment for adding stub.o to EFIOBJ-y.
   1.6. Merge patch#2 and patch#3 to one patch.
2. Rename arch_have_default_dmazone to arch_want_default_dmazone
3. Use uint64_t for size in acpi_scan_nodes, make it be
   consistent with numa_emulation.
4. Merge the interleaves checking code from a separate function
   to conflicting_memblks.
5. Use INFO level for node's without memory log message.
6. Move "xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for
   phys_to_nid" to part#2.
Part1 v1->v2:
1. Move independent patches from later to early of this series.
2. Drop the copy of EFI stub.c from Arm. Share common codes of
   x86 EFI stub for Arm.
3. Use CONFIG_ARM_EFI to replace CONFIG_EFI and remove help text
   and make CONFIG_ARM_EFI invisible.
4. Use ASSERT to replace VIRTUAL_BUG_ON in phys_to_nid.
5. Move MAX_NUMNODES from xen/numa.h to asm/numa.h for x86.
6. Extend the description of Arm's workaround for reserve DMA
   allocations to avoid the same discussion every time for
   arch_have_default_dmazone.
7. Update commit messages.

Wei Chen (8):
  xen: reuse x86 EFI stub functions for Arm
  xen/arm: Keep memory nodes in device tree when Xen boots from EFI
  xen: introduce an arch helper for default dma zone status
  xen: decouple NUMA from ACPI in Kconfig
  xen/arm: use !CONFIG_NUMA to keep fake NUMA API
  xen/x86: use paddr_t for addresses in NUMA node structure
  xen/x86: add detection of memory interleaves for different nodes
  xen/x86: use INFO level for node's without memory log message

 xen/arch/arm/Kconfig              |   4 +
 xen/arch/arm/Makefile             |   2 +-
 xen/arch/arm/bootfdt.c            |   8 +-
 xen/arch/arm/efi/Makefile         |   8 ++
 xen/arch/arm/efi/efi-boot.h       |  25 -----
 xen/arch/arm/include/asm/numa.h   |   6 ++
 xen/arch/x86/Kconfig              |   2 +-
 xen/arch/x86/efi/stub.c           |  32 +------
 xen/arch/x86/include/asm/config.h |   1 -
 xen/arch/x86/include/asm/numa.h   |   9 +-
 xen/arch/x86/numa.c               |  32 +++----
 xen/arch/x86/srat.c               | 154 ++++++++++++++++++++++--------
 xen/common/Kconfig                |   3 +
 xen/common/efi/efi-common.mk      |   3 +-
 xen/common/efi/stub.c             |  32 +++++++
 xen/common/page_alloc.c           |   2 +-
 xen/drivers/acpi/Kconfig          |   3 +-
 xen/drivers/acpi/Makefile         |   2 +-
 18 files changed, 201 insertions(+), 127 deletions(-)
 create mode 100644 xen/common/efi/stub.c

-- 
2.25.1




 


Rackspace

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