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

Re: [PATCH 07/37] xen/x86: use paddr_t for addresses in NUMA node structure


  • To: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jan 2022 16:22:49 +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=qY+zkviUaTJdFINFr0LJAdxZeeCgqLUR4vnVi52YXvU=; b=M3DscRjfOSppoGONY0ntOEcznzY9IP5k0nxZAckj8YFIdb2nACpUtbKxloED4ZASRH9xikoJ9i/Er4WpLqjVP9njA9CLqbkVsMFX8sXvu4zsZnI41MIY/TlHsldLmEJfzHWAIv16EnD45XNg4XG9nAeQTwwPZFsEViFySeG+ZjzMxxEdJsSpAsIS8jTjPRzVCujx1sdvYerLy1GBDtMw2RN6ahUc4l87pLS6+uwS+KJtijiBxS8UuJLiCuoUV0pfFbPRJsydK6PyTdc+Xms6+w2yy6rlzUr7ex9pP4NX2C4pYN9gAwcS07uGHRY0lBeCA/7XdUH826wj13/Wf3NoLw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Udm6GCUR4ccIJYuU4guqcuwHXZNhITL1ygG5IdGfmlvrypb+FvsYL04Hv5B7oxpg8wNDgNyEYf3ghMvucMvXAtJ+FVjS1sFD591hUMOZF1ZZJxIGh0ZvOxvQ2q8+ieJtXqV+EH+/J9KNSVPzqNjHz/HB8/Em/LcDcTgAQD7+etfvn8tgcMx2WALnBMBlbHqxz2vCGe+GedelXys7BFGV/gpAW+CQRWaUquKje3k8LDtpGqB3ZIichQ1hFxS3sd8y5gYD+ywPrIelGyO/7JThd8aXAmycIgxs75z7Ski0eTR4Kx3YMXT6ncn8TBy8nO4F3keynLIV3sIsvOdtPQOiSA==
  • 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 15:23:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.09.2021 14:02, Wei Chen wrote:
> @@ -201,11 +201,12 @@ void __init numa_init_array(void)
>  static int numa_fake __initdata = 0;
>  
>  /* Numa emulation */
> -static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
> +static int __init numa_emulation(unsigned long start_pfn,
> +                                 unsigned long end_pfn)
>  {
>      int i;
>      struct node nodes[MAX_NUMNODES];
> -    u64 sz = ((end_pfn - start_pfn)<<PAGE_SHIFT) / numa_fake;
> +    u64 sz = pfn_to_paddr(end_pfn - start_pfn) / numa_fake;

Nit: Please convert to uint64_t (and alike) whenever you touch a line
anyway that uses being-phased-out types.

> @@ -249,24 +250,26 @@ static int __init numa_emulation(u64 start_pfn, u64 
> end_pfn)
>  void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
>  { 
>      int i;
> +    paddr_t start, end;
>  
>  #ifdef CONFIG_NUMA_EMU
>      if ( numa_fake && !numa_emulation(start_pfn, end_pfn) )
>          return;
>  #endif
>  
> +    start = pfn_to_paddr(start_pfn);
> +    end = pfn_to_paddr(end_pfn);

Nit: Would be slightly neater if these were the initializers of the
variables.

>  #ifdef CONFIG_ACPI_NUMA
> -    if ( !numa_off && !acpi_scan_nodes((u64)start_pfn << PAGE_SHIFT,
> -         (u64)end_pfn << PAGE_SHIFT) )
> +    if ( !numa_off && !acpi_scan_nodes(start, end) )
>          return;
>  #endif
>  
>      printk(KERN_INFO "%s\n",
>             numa_off ? "NUMA turned off" : "No NUMA configuration found");
>  
> -    printk(KERN_INFO "Faking a node at %016"PRIx64"-%016"PRIx64"\n",
> -           (u64)start_pfn << PAGE_SHIFT,
> -           (u64)end_pfn << PAGE_SHIFT);
> +    printk(KERN_INFO "Faking a node at %016"PRIpaddr"-%016"PRIpaddr"\n",
> +           start, end);

When switching to PRIpaddr I suppose you did look up what that one
expands to? IOW - please drop the 016 from here.

> @@ -441,7 +441,7 @@ void __init srat_parse_regions(u64 addr)
>           acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat))
>               return;
>  
> -     srat_region_mask = pdx_init_mask(addr);
> +     srat_region_mask = pdx_init_mask((u64)addr);

I don't see the need for a cast here.

> @@ -489,7 +489,7 @@ int __init acpi_scan_nodes(u64 start, u64 end)
>       /* Finally register nodes */
>       for_each_node_mask(i, all_nodes_parsed)
>       {
> -             u64 size = nodes[i].end - nodes[i].start;
> +             paddr_t size = nodes[i].end - nodes[i].start;
>               if ( size == 0 )

Please take the opportunity and add the missing blank line between
declarations and statements.

> --- a/xen/include/asm-x86/numa.h
> +++ b/xen/include/asm-x86/numa.h
> @@ -16,7 +16,7 @@ extern cpumask_t     node_to_cpumask[];
>  #define node_to_cpumask(node)    (node_to_cpumask[node])
>  
>  struct node { 
> -     u64 start,end; 
> +     paddr_t start,end;

Please take the opportunity and add the missing blank after the comma.

Jan




 


Rackspace

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