All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Chen <Wei.Chen@arm.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: nd@arm.com, "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 10/10] xen/x86: add detection of memory interleaves for different nodes
Date: Tue, 26 Apr 2022 19:07:33 +0800	[thread overview]
Message-ID: <efc5dd55-0fc9-5741-520e-f98000ddb324@arm.com> (raw)
In-Reply-To: <22591300-a09f-1ab2-fd6b-6c4875641035@suse.com>

Hi Jan,

On 2022/4/26 17:20, Jan Beulich wrote:
> On 18.04.2022 11:07, Wei Chen wrote:
>> --- a/xen/arch/x86/srat.c
>> +++ b/xen/arch/x86/srat.c
>> @@ -271,6 +271,35 @@ 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 check_node_memory_interleave(nodeid_t nid,
>> +                                                paddr_t start, paddr_t end)
>> +{
>> +	nodeid_t i;
>> +	const struct node *nd = &nodes[nid];
>> +
>> +	for_each_node_mask(i, memory_nodes_parsed)
>> +	{
>> +		/* Skip itself */
>> +		if (i == nid)
>> +			continue;
>> +
>> +		nd = &nodes[i];
>> +		if (start < nd->start && nd->end < end) {
>> +			printk(KERN_ERR
>> +			       "Node %u: (%"PRIpaddr"-%"PRIpaddr") interleaves with node %u (%"PRIpaddr"-%"PRIpaddr")\n",
>> +			       nid, start, end, i, nd->start, nd->end);
>> +			return true;
>> +		}
>> +	}
>> +
>> +	return false;
>> +}
>> +
>>   /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
>>   void __init
>>   acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
>> @@ -340,10 +369,22 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
> 
> Just up from here there already is overlap detection (via a call to
> conflicting_memblks(), and you even mention that in the earlier
> comment). If that doesn't cover all cases, I think it wants fixing
> there rather than introducing a 2nd checking function. But afaics
> that code covers the "fully contains" case.
> 

Yes, that makes sense, I will try to add this case check in 
conflicting_memblks.

Thanks,
Wei Chen

> Jan
> 
>>   			nd->start = start;
>>   			nd->end = end;
>>   		} else {
>> -			if (start < nd->start)
>> -				nd->start = start;
>> -			if (nd->end < end)
>> -				nd->end = end;
>> +			paddr_t new_start = nd->start;
>> +			paddr_t new_end = nd->end;
>> +
>> +			if (start < new_start)
>> +				new_start = start;
>> +			if (new_end < end)
>> +				new_end = end;
>> +
>> +			/* Check whether new range contains memory for other nodes */
>> +			if (check_node_memory_interleave(node, new_start, new_end)) {
>> +				bad_srat();
>> +				return;
>> +			}
>> +
>> +			nd->start = new_start;
>> +			nd->end = new_end;
>>   		}
>>   	}
>>   	printk(KERN_INFO "SRAT: Node %u PXM %u %"PRIpaddr"-%"PRIpaddr"%s\n",
> 


  reply	other threads:[~2022-04-26 11:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  9:07 [PATCH v2 00/10] Device tree based NUMA support for Arm - Part#1 Wei Chen
2022-04-18  9:07 ` [PATCH v2 01/10] xen/arm: Print a 64-bit number in hex from early uart Wei Chen
2022-04-19  9:13   ` Jiamei Xie
2022-04-21  7:05     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 02/10] xen/x86: move reusable EFI stub functions from x86 to common Wei Chen
2022-04-21  0:17   ` Stefano Stabellini
2022-04-26  8:53   ` Jan Beulich
2022-04-26 10:37     ` Wei Chen
2022-04-26 14:31       ` Jan Beulich
2022-04-27  2:56         ` Wei Chen
2022-04-27  5:54           ` Jan Beulich
2022-04-27  6:26             ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 03/10] xen/arm: add CONFIG_ARM_EFI to stub EFI API Wei Chen
2022-04-21  0:25   ` Stefano Stabellini
2022-04-21  7:01     ` Wei Chen
2022-04-21 21:35       ` Stefano Stabellini
2022-04-18  9:07 ` [PATCH v2 04/10] xen/arm: Keep memory nodes in device tree when Xen boots from EFI Wei Chen
2022-04-21  0:30   ` Stefano Stabellini
2022-04-18  9:07 ` [PATCH v2 05/10] xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid Wei Chen
2022-04-21  0:37   ` Stefano Stabellini
2022-04-26  9:02   ` Jan Beulich
2022-04-26 10:59     ` Wei Chen
2022-04-26 14:42       ` Jan Beulich
2022-04-27  3:52         ` Wei Chen
2022-04-27  5:56           ` Jan Beulich
2022-04-27  6:27             ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 06/10] xen: introduce an arch helper for default dma zone status Wei Chen
2022-04-19  9:18   ` Jan Beulich
2022-04-21  7:03     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 07/10] xen: decouple NUMA from ACPI in Kconfig Wei Chen
2022-04-18  9:07 ` [PATCH v2 08/10] xen/arm: use !CONFIG_NUMA to keep fake NUMA API Wei Chen
2022-04-18  9:07 ` [PATCH v2 09/10] xen/x86: use paddr_t for addresses in NUMA node structure Wei Chen
2022-04-26  9:11   ` Jan Beulich
2022-04-26 10:42     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 10/10] xen/x86: add detection of memory interleaves for different nodes Wei Chen
2022-04-26  9:20   ` Jan Beulich
2022-04-26 11:07     ` Wei Chen [this message]
2022-04-19  9:29 ` [PATCH v2 00/10] Device tree based NUMA support for Arm - Part#1 Wei Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efc5dd55-0fc9-5741-520e-f98000ddb324@arm.com \
    --to=wei.chen@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=nd@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.