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

RE: [PATCH 21/37] xen/arm: Keep memory nodes in dtb for NUMA when boot from EFI


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 24 Sep 2021 04:36:23 +0000
  • Accept-language: en-US
  • 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=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tVeTKmFk2chsP5nTlMY3FXuEgOnCDrECEp7oEM9EoLA=; b=jSCLauedtxenkTU4xL6LdPcLdQgVkPp0RXk6kJpY0Y5AAPjojRbHwi+iUzsR1Hh2/Mhg/1EZKZd67hdX6KChm3Zs9kljWDLWoQ+mOBmjUbbMLldmTP7sDH/wDM9Q8B5j6JD12zoUSkDnwkubgjEOnldMQUQCKiRCA6idCHZ/OUgIjORHeFbm5d2k4RjcxsA8MrBXZFpLMYhfc3WrWQR0yK1YAjTUpixK52kOOojU2++y6M3k4+mStSlm8dpo5PAIffnBW3CEitHo6gDSbL2J4KyjNY1t3ck9UDYRUseFF7PhW0bHcORalWFnu9qYvrqCkhNdvDGJ/WWLaWJ5ZKNuTA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n0YaAbO4+wLePv7LipsZqiyGWC5zHj40dnARG6uKWiJb72M+QO6XLopW4UOh/rOJl1cboIiAynhY5pO4W/h3KPyo7VAHCxyK06BrkO0nV4BSoCliwEHuMylf9PB4VxcuyDyRKkBbc6dTYhE26Wt/O5FEIbWG2FWc283FFRfZeqmDaobGQRmjRewBFFnftxoqhQey6xWqBHEHkglTPZrNXABRs9/CcZJotpaYf/yVURF0MjF07Zts/8Djb5lDaNnjxedNb7q152iCQYMqo84mWTt+jwCFj3QcucWyM/Jy5Jy7rGkik8XNHqBZHRVj/lS39mYeRiPKetYe/csNf98saQ==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Fri, 24 Sep 2021 04:36:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXsHMrd58EkQofR0OqZuXsqMtGrKuyZJkAgAA1glA=
  • Thread-topic: [PATCH 21/37] xen/arm: Keep memory nodes in dtb for NUMA when boot from EFI

> -----Original Message-----
> From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Sent: 2021年9月24日 9:23
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; sstabellini@xxxxxxxxxx; julien@xxxxxxx;
> Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
> Subject: Re: [PATCH 21/37] xen/arm: Keep memory nodes in dtb for NUMA when
> boot from EFI
> 
> On Thu, 23 Sep 2021, Wei Chen wrote:
> > EFI can get memory map from EFI system table. But EFI system
> > table doesn't contain memory NUMA information, EFI depends on
> > ACPI SRAT or device tree memory node to parse memory blocks'
> > NUMA mapping.
> >
> > But in current code, when Xen is booting from EFI, it will
> > delete all memory nodes in device tree. So in UEFI + DTB
> > boot, we don't have numa-node-id for memory blocks any more.
> >
> > So in this patch, we will keep memory nodes in device tree for
> > NUMA code to parse memory numa-node-id later.
> >
> > As a side effect, if we still parse boot memory information in
> > early_scan_node, bootmem.info will calculate memory ranges in
> > memory nodes twice. So we have to prevent early_scan_node to
> > parse memory nodes in EFI boot.
> >
> > As EFI APIs only can be used in Arm64, so we introduced a stub
> > API for non-EFI supported Arm32. This will prevent
> 
> This last sentence is incomplete.
> 
> But aside from that, this patch looks good to me.
> 

Ah, it truncated by accident. I will fix it.

> 
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >  xen/arch/arm/bootfdt.c      |  8 +++++++-
> >  xen/arch/arm/efi/efi-boot.h | 25 -------------------------
> >  xen/include/xen/efi.h       |  7 +++++++
> >  3 files changed, 14 insertions(+), 26 deletions(-)
> >
> > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> > index afaa0e249b..6bc5a465ec 100644
> > --- a/xen/arch/arm/bootfdt.c
> > +++ b/xen/arch/arm/bootfdt.c
> > @@ -11,6 +11,7 @@
> >  #include <xen/lib.h>
> >  #include <xen/kernel.h>
> >  #include <xen/init.h>
> > +#include <xen/efi.h>
> >  #include <xen/device_tree.h>
> >  #include <xen/libfdt/libfdt.h>
> >  #include <xen/sort.h>
> > @@ -370,7 +371,12 @@ static int __init early_scan_node(const void *fdt,
> >  {
> >      int rc = 0;
> >
> > -    if ( device_tree_node_matches(fdt, node, "memory") )
> > +    /*
> > +     * If Xen has been booted via UEFI, the memory banks will already
> > +     * be populated. So we should skip the parsing.
> > +     */
> > +    if ( !efi_enabled(EFI_BOOT) &&
> > +         device_tree_node_matches(fdt, node, "memory"))
> >          rc = process_memory_node(fdt, node, name, depth,
> >                                   address_cells, size_cells,
> &bootinfo.mem);
> >      else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
> > diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
> > index cf9c37153f..d0a9987fa4 100644
> > --- a/xen/arch/arm/efi/efi-boot.h
> > +++ b/xen/arch/arm/efi/efi-boot.h
> > @@ -197,33 +197,8 @@ EFI_STATUS __init
> fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table,
> >      int status;
> >      u32 fdt_val32;
> >      u64 fdt_val64;
> > -    int prev;
> >      int num_rsv;
> >
> > -    /*
> > -     * Delete any memory nodes present.  The EFI memory map is the only
> > -     * memory description provided to Xen.
> > -     */
> > -    prev = 0;
> > -    for (;;)
> > -    {
> > -        const char *type;
> > -        int len;
> > -
> > -        node = fdt_next_node(fdt, prev, NULL);
> > -        if ( node < 0 )
> > -            break;
> > -
> > -        type = fdt_getprop(fdt, node, "device_type", &len);
> > -        if ( type && strncmp(type, "memory", len) == 0 )
> > -        {
> > -            fdt_del_node(fdt, node);
> > -            continue;
> > -        }
> > -
> > -        prev = node;
> > -    }
> > -
> >     /*
> >      * Delete all memory reserve map entries. When booting via UEFI,
> >      * kernel will use the UEFI memory map to find reserved regions.
> > diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
> > index 661a48286a..b52a4678e9 100644
> > --- a/xen/include/xen/efi.h
> > +++ b/xen/include/xen/efi.h
> > @@ -47,6 +47,13 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *);
> >  int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *);
> >  int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *);
> >
> > +#else
> > +
> > +static inline bool efi_enabled(unsigned int feature)
> > +{
> > +    return false;
> > +}
> > +
> >  #endif /* CONFIG_EFI*/
> >
> >  #endif /* !__ASSEMBLY__ */
> > --
> > 2.25.1
> >

 


Rackspace

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