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

Re: [PATCH 08/37] xen/x86: add detection of discontinous node memory range


  • To: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jan 2022 17:13:02 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9UFVMblRFW7m+oaFwR03YITvijHcUty1Y7Fdf1lt1cU=; b=i1EG/31tFCQFLhHRecTW94P6VR+3EoEekRurgWZLRvz9lQ0TWi9ehxmd/PfffP8nnQV9oGFXDnKnmaIKGKOwO5xdiarTf8LGbKOp7G7IUvGFCR0fz02jm1n5HdFNlccyF/XFvbO46HoNDjsqL9bpTPvaw/Z+htYT2MRXB5CFZ5L0AR6Ei5LFdJ4QB+Lxtwo6UmxjcSkfCJqAxkUB3Jmh2mfjjoLx2KgYkCQfEWCUqyC5boJoKCKHLSfK8A+6plQutetWH98vMFPqI+b8xoOxDhMuXt3A17v49pxIYvU4f4dBiiLYNLwmSfPTmUvi4cMb9DWv1TGLBB0K0jIGzFfvcw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dKqv757hjc4vnEmOdLnvYIRSqF4oEKcHAUfINxq/if9QcGSZMgNTqOEzGT7HlNIiMd2XJGzlQU7+uYeG+gp5veWHDSDpFqwualAk115lIdNCKQcfGlKqY9DA+o8CM6YsDNO+P5yUSTWhbAEozs/nFfdHsZUyH8iZz5Jf9aBZ3fMPFdyaIZSi4WlwZRrZRNFYRlmaQ3Nh0WCPSI4XYcc6VFCizPtBgdt+NBw4s2TAlJjbKoJx+l300WMkai6OhMErci2IorKfyt0Fd0kQKBNmtzEMxny9Uj8rFufrfALlSyaig7YJ7kf6hVzR2MPH9kt4YRUetxhr0DL2qeJM8K4vAg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Bertrand.Marquis@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, julien@xxxxxxx
  • Delivery-date: Tue, 18 Jan 2022 16:13:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.09.2021 14:02, Wei Chen wrote:
> One NUMA node may contain several memory blocks. In current Xen
> code, Xen will maintain a node memory range for each node to cover
> all its memory blocks. But here comes the problem, in the gap of
> one node's two memory blocks, if there are some memory blocks don't
> belong to this node (remote memory blocks). This node's memory range
> will be expanded to cover these remote memory blocks.
> 
> One node's memory range contains othe nodes' memory, this is obviously
> not very reasonable. This means current NUMA code only can support
> node has continous memory blocks. However, on a physical machine, the
> addresses of multiple nodes can be interleaved.
> 
> So in this patch, we add code to detect discontinous memory blocks
> for one node. NUMA initializtion will be failed and error messages
> will be printed when Xen detect such hardware configuration.

Luckily what you actually check for isn't as strict as "discontinuous":
What you're after is no interleaving of memory. A single nod can still
have multiple discontiguous ranges (and that'll often be the case on
x86). Please adjust description and function name accordingly.

> --- a/xen/arch/x86/srat.c
> +++ b/xen/arch/x86/srat.c
> @@ -271,6 +271,36 @@ acpi_numa_processor_affinity_init(const struct 
> acpi_srat_cpu_affinity *pa)
>                      pxm, pa->apic_id, node);
>  }
>  
> +/*
> + * Check to see if there are other nodes within this node's range.
> + * We just need to check full contains situation. Because overlaps
> + * have been checked before by conflicting_memblks.
> + */
> +static bool __init is_node_memory_continuous(nodeid_t nid,
> +    paddr_t start, paddr_t end)

This indentation style demands indenting like ...

> +{
> +     nodeid_t i;

... variable declarations at function scope, i.e. in a Linux-style
file by a tab.

> +
> +     struct node *nd = &nodes[nid];
> +     for_each_node_mask(i, memory_nodes_parsed)

Please move the blank line to be between declarations and statements.

Also please make nd pointer-to const.

> +     {

In a Linux-style file opening braces do not belong on their own lines.

> +             /* Skip itself */
> +             if (i == nid)
> +                     continue;
> +
> +             nd = &nodes[i];
> +             if (start < nd->start && nd->end < end)
> +             {
> +                     printk(KERN_ERR
> +                            "NODE %u: (%"PRIpaddr"-%"PRIpaddr") intertwine 
> with NODE %u (%"PRIpaddr"-%"PRIpaddr")\n",

s/intertwine/interleaves/ ?

> @@ -344,6 +374,12 @@ acpi_numa_memory_affinity_init(const struct 
> acpi_srat_mem_affinity *ma)
>                               nd->start = start;
>                       if (nd->end < end)
>                               nd->end = end;
> +
> +                     /* Check whether this range contains memory for other 
> nodes */
> +                     if (!is_node_memory_continuous(node, nd->start, 
> nd->end)) {
> +                             bad_srat();
> +                             return;
> +                     }

I think this check would better come before nodes[] gets updated? Otoh
bad_srat() will zap everything anyway ...

Jan




 


Rackspace

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