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

Re: [PATCH v2 10/10] xen/x86: add detection of memory interleaves for different nodes


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 26 Apr 2022 19:07:33 +0800
  • 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k5BqB17tVcu5/rRvTTNBFR/32NiBn8L7cdCLyzRYD3o=; b=NjF1/wsMt+QSzjUfV6OW3qAEDYmGu5cOoBFkgB7GdjD25WqTfjqC/Nk3xPalxCoxLTQ4I1TAdm4UeJ/jvn2TKT9s6Qa7+beT5FkiYVBfLhS1V8859gtmacZ7XETrde/Ueir8hKj7M7uzimdlJ+QZeHicl9/jfh7ergAJx3o+f7Ni1bGqOo2+M8A7i4yxqwMzVGnqbY8tWqvY6fIi1Nff/xBbJ0A89YvOYSNmNAgSVS79GH4SZjuIg0nLWShj2n2Cl490bhW+wK7pAD1AxBr0yb3aeltZEUXsRahvQ9fYBo5N84AbTCpQ2uArHSX5ItJt6uluzZCvIfdPxdqcf2++wA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jprzCejm7E5Qhw1V7RZ4TfxdIdS/dZNCMZDua7S6Af7rZRuCgX+rRn0M2Ed3QB4Un7i8Mz2i4OHjuGmMC1qsOkK1zvlg9eq02G5rGHnVsqEYxtkDvODyoDabgCZCyNg1UjNxxJ6bzW6ExBVxTiLnzjO/quhBif/ur2jp0j+G2QgnbvlCeqN4LSboQTVLlKR1Jat32AenSnzjaytM98ZZCWYtQ4Z7sfmEW1bfavdmvZDzMoHcbDhMeMiILfHbdRDRYUhO93ihUJ+tdpQL2MctQUKB0KmURce7I85WIFHFaHC5xagDKj7/Mr0fTDlUo+folVBo06A0vvDP/vqrLRThSA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: nd@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 26 Apr 2022 11:08:00 +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;

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",




 


Rackspace

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