[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: Wed, 19 Jan 2022 08:55:13 +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=g0U6oOn6KRiFjOO6BAnB7j0SDUpwov2umluK7tI/wD0=; b=n5OGIa5oe31GrWYNLemRK+zRiX/wYr6ZJutIH01YUK6orrjRXX8TNg5sADQvTPfeAA40nxZEKtwcyyH/6H9l5LY6UzZOliWrbt5qFkTyfcUwrJlhmxl+l5YXpwZEj6pVSh21E2DPz1V3iOYl0KnA8R2Rb/PRtoy/3ncsBlk6fKvwNei7a8of+IsJXuA+fjKMET+LlPOjftEfbxYEF9uMqyQwUqm1u7YRT/F29kklkfrrrY3Pp6F4VlgitYxjb+1lGvcx1wm2atXyZAU1t4wH1gEpYoAsk9cZQt4Wl2O3jFHD7v+xvMH+B/a6rSl/NLXdY7fpBn48fs1e2I5/X45phA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UqXqdrS1rvzx6iXRfN+wx+IwFuCMOVWooaXNzdTf4keGkvJuhPr24NlqYtJMFs2tuCw8xoi4DK4t6T83jwji1By0qWOExFLXuH30wUYD6I7A/6PkYC9UP0yrRJBt/dY3cBdeCCTt+BeJ9Lk6gRjVHFsoxwDXj33RuHNeTHefZO0Uv+FzWDr8vtIjhmsLKUxwJIKECptxLt7UMktRhnkmeQDwEPCJCqJVeBKU3CXG4Z78fdN+uq8U+k83JzYfJOKaKIZC/TGMjg4hqSG87ckJ9y0eURBYuHHNDBUUk72ACeAg+auJmKdnlTI/3cQ6FY4rWB0EGKxvqjOLso/Z1cHz4w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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 07:55:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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?

>>> @@ -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.

Jan




 


Rackspace

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