[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: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Wed, 19 Jan 2022 08:36:38 +0000
  • Accept-language: en-US
  • 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=asmlneFWSKypadQxTIj5OMq1etjWDUh/XoRMH1iPduE=; b=JJO9UN87F05DDwi7lGwljEiVPj0ng+q+sgAiadfYLX9nxMWmsCqnxK9xXFfVWYr0Nc9hbqGFThuX0+HqjIzdyqOAJEEfHYSidssdxI5LluM69siFxX84BgzN5hdgbslg2XT5nT9MyUOu5Ts5uHuig4Bx0zX24VrlzhNvE9ngCnQBZwTmtt+ZTrxuwdd9ENMPGcHyLEA1RCj8lxh0ZLztFzGn3Xry3q+7NPJAq2IeejXgODObHnzxUC/hrxfmBu4/FOEqoHQ0ql37hdw5KNj6h0z6bisoMugHvFvwkfOePupzHxHsRKe+Ha2x6x3z/2heoupWphWuGtwn5bI6MHnPxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y446pT2rkeC3Tn/Pvr6uJuUzIpoNtRToqEsgjwEt2sUYoJfLaAYdJFhaYOdy89A7Y31Ashm4uCrfcK4Vq6z3qG6Dk4pqIgJQQlGRIyNxOOBATvuGzU9zCz+8YsI0l2eoZwny23ZFdm1ludlNi3pqTDSnjVZ1sXgZgjJ39fAIMAurWozWoMMmHs8wzWQnsXAx5wsgxxv0/jj3EWjl9+fazNQHRGcIjLaFGL0a8Aqb0V298ovEuF6mpumwPBUJDClLWhcOFIcsJq1rALyVKhuip70mAX47U8wY6rBCg2surIctTgPtiZJC9xPU15gzhVmzgdiNrwwgTEKDw+4FUtRUvQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>
  • Delivery-date: Wed, 19 Jan 2022 08:36:54 +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;
  • Thread-index: AQHXsHMRNGZeupZbtEeYycYXK8HrbKxpnZqAgAD0aqCAACDcgIAACs8w
  • Thread-topic: [PATCH 07/37] xen/x86: use paddr_t for addresses in NUMA node structure

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年1月19日 15:55
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx; sstabellini@xxxxxxxxxx; julien@xxxxxxx
> Subject: Re: [PATCH 07/37] xen/x86: use paddr_t for addresses in NUMA node
> structure
> 
> On 19.01.2022 07:33, Wei Chen wrote:
> >> From: Jan Beulich <jbeulich@xxxxxxxx>
> >> Sent: 2022年1月18日 23:23
> >>
> >> On 23.09.2021 14:02, Wei Chen wrote:
> >>> @@ -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.
> >
> > But if this function returns in numa_fake && !numa_emulation,
> > will the two pfn_to_paddr operations be waste?
> 
> And what harm would that do?

Ok, two or three instructions waste in init time will not
take too much harm. I will move them above with initializers.

> 
> >>> @@ -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.
> >>
> >
> > current addr type has been changed to paddr_t, but pdx_init_mask
> > accept parameter type is u64. I know paddr_t is a typedef of
> > u64 on Arm64/32, or unsinged long on x86. In current stage,
> > their machine byte-lengths are the same. But in case of future
> > changes I think an explicit case here maybe better?
> 
> It may only ever be an up-cast, yet the compiler would do a widening
> conversion (according to the usual type conversion rules) for us
> anyway no matter whether there's a cast. Down-casts (in the general
> compiler case, i.e. considering a wider set than just gcc and clang)
> sometimes need making explicit to silence compiler warnings about
> truncation, but I've not observed any compiler warning when widening
> values.

Ok, I will drop that cast.

> 
> Jan


 


Rackspace

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