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

Re: [PATCH v8 5/6] xen/x86: move NUMA process nodes nodes code from x86 to common


  • To: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 17 Nov 2022 16:38:07 +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=Nf2ZhOc393Vbq7veFfSkuaozHPcfKNKg6DK+3VET304=; b=fBGaEXdEDMngqMaiVhopIPPgQvkdf7FDdkfQW03bJ9FZgROBfDyu+rYlvWxfQEpRukiHWw+3C80p2nRONG2l7nOWLdE8W6xtCSj2o5j2zOGMhqNZQOoCnXlAEd/ANftucABFlSq0XMYd0n4/vuIOb/+JGuJDY9v6Z9XoGgt55jLOKhUsOGSIQ9Ez1ljKuATYnJMfrlHfcyvMPAaxytiVA6bquD34bazxEB2vSSRE5u5Es76odRIvT7z5D/WbfOGX6qbXG6tffRwNTRxqGCfhwnUl3+t5ZxZak2nTysnQgv71fuUenTOBrmvvYwQ//TDdfzZjjxFBTi3KSVtyi+ineQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j7nb6k9ojcELdvct2t0v4iswcJqYNJuoDqs3kvSvfX6yRDNqql8SKhw/Df0NOcfVsH4KzYvCSl4QAFKXs2oUecOa2mqL0/O17PFjOqj6wzw5fnxQHG7vD7vnEJDiJd4yh0rZmzZ2BWjZhy8RftByTMhBUp69Ln4Evfj1buiSyvnxBjPjFcoa2ZkZvjr8Ek9yK4msmGyFkFRnxowpb6TUSQDWA9zwBVnpVs8maAKV5Kx2lLmitz4Y1RwXYChY4YrueQUMzacdmGnUYkRtDf1vwrFdhfM5aZi+zE//dWUgwNMNI0aCZax66VUkcqO1NvTBchIa0htSmQlNoWdSfYFhcA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: nd@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 17 Nov 2022 15:38:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.11.2022 07:34, Wei Chen wrote:
> x86 has implemented a set of codes to process NUMA nodes. These
> codes will parse NUMA memory and processor information from
> ACPI SRAT table. But except some ACPI specific codes, most
> of the process code like memory blocks validation, node memory
> range updates and some sanity check can be reused by other
> NUMA implementation.
> 
> So in this patch, we move some variables and related functions
> for NUMA memory and processor to common as library. At the
> same time, numa_set_processor_nodes_parsed has been introduced
> for ACPI specific code to update processor parsing results.
> With this helper, we can reuse most of NUMA memory affinity init
> code from ACPI. As bad_srat and node_to_pxm functions have been
> used in common code to do architectural fallback and node to
> architectural node info translation. But it doesn't make sense
> to reuse the functions names in common code, we have rename them
> to neutral names as well.
> 
> PXM is an ACPI specific item, we can't use it in common code
> directly. As an alternative, we extend the parameters of
> numa_update_node_memblks. The caller can pass the PXM as print
> messages' prefix or as architectural node id.

The use of "prefix" here must have been stale for a while, perhaps
resulting from an incomplete re-write of what was here earlier on?

> -static int __init nodes_cover_memory(void)
> -{
> -     unsigned int i;
> -
> -     for (i = 0; ; i++) {
> -             int err;
> -             unsigned int j;
> -             bool found;
> -             paddr_t start, end;
> -
> -             /* Try to loop memory map from index 0 to end to get RAM 
> ranges. */
> -             err = arch_get_ram_range(i, &start, &end);
> -
> -             /* Reached the end of the memory map? */
> -             if (err == -ENOENT)
> -                     break;
> -
> -             /* Skip non-RAM entries. */
> -             if (err)
> -                     continue;
> -
> -             do {
> -                     found = false;
> -                     for_each_node_mask(j, memory_nodes_parsed)
> -                             if (start < nodes[j].end
> -                                 && end > nodes[j].start) {
> -                                     if (start >= nodes[j].start) {
> -                                             start = nodes[j].end;
> -                                             found = true;
> -                                     }
> -                                     if (end <= nodes[j].end) {
> -                                             end = nodes[j].start;
> -                                             found = true;
> -                                     }
> -                             }
> -             } while (found && start < end);
> -
> -             if (start < end) {
> -                     printk(KERN_ERR "NUMA: No NODE for RAM range: "
> -                             "[%"PRIpaddr", %"PRIpaddr"]\n", start, end - 1);
> -                     return 0;
> -             }
> -     }
> -     return 1;
> +     numa_fw_nid_name = "PXM";

I guess this can't go without a comment, now that we have ...

> +     if (!numa_update_node_memblks(node, pxm, ma->base_address, ma->length,
> +                                   ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE))
> +             numa_fw_bad();
>  }
>  
>  void __init acpi_numa_arch_fixup(void) {}
> @@ -534,6 +295,7 @@ void __init srat_parse_regions(paddr_t addr)
>           acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat))
>               return;
>  
> +     numa_fw_nid_name = "PXM";

... this as well. Otherwise someone may spot the redundancy and either
propose to drop one, or it'll take them quite a bit of time to figure
why both are there. I thought this would go without saying, so I'm
sorry for not making this explicit earlier on.

Jan



 


Rackspace

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