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

Re: [PATCH 3/3] xen/arm64/mmu: head: Replace load_paddr with adr_l where appropriate


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 21 Nov 2023 19:13:38 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=OWvDDmf+MlGd3n6JlABwV6dqDBkeEKlElvoX0caSkUI=; b=XaCwpd73lQ47ZXxOurPeXqEaqLI2kE0g8bTdxwcXZTIy+m+cWKfOtkPJBC5GI7vuQb5uHgeDYHafX08HB/OclSS5i0ujY8ZnlMuX4bkkvsNMop6y01qurh3sNB5pBGBM6WwDL/eF22YYV+EglOTT3P2BwpR4K69eLw2hpqiqyAoa9Zy5a5Wj/6067G3aJPE1IeQolYah+DqowE+OyCofpbVs2JOd0PCP64Y0wrBwN4CkfXt3uP6SVt7O8kqpQMLNuGCv4Km+LNI4i19R7onG9BtivFNtZgVOduP1gd5UR8+VfnHyJ5UcLFmU+Lcow6Pum8KooBQTgDfKaJX2YsXS+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BH9uWCTMphyIlh4PTJsdx+NSTg3Pv4NlGTaOKyzQjT6xMLyWinBjlaXT40WADtZQ36/Z9BqIDqccfhYoAyykOOWRqDq+7RDMFE2uS/9S11cw4aJGge8zZ9Muie+7VRaUDXn65l9Sshwx0t4YraUzPJULCf6LoGndIumOE2LvGojrHxeandophWVp7V8iUyuJlhKapmfq/8uXPIclgSa+cUMMDN2igKn1jYBwN2WWZ3SpMAQgJvyZEf/BH2vBgGBBtYGQOdXgxu576emXNVK3CQWDaSWklCHXGljCwaWJ6/o4OBqgj2WbO+UtTlw2VxFJZKqqCnZ5g50fOS/wsuwx4w==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 21 Nov 2023 18:13:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 21/11/2023 17:30, Julien Grall wrote:
> 
> 
> Hi Michal,
> 
> On 21/11/2023 09:45, Michal Orzel wrote:
>> Macros load_paddr and adr_l are equivalent when used before the MMU is
>> enabled, resulting in obtaining physical address of a symbol. The former
>> requires to know the physical offset (PA - VA) and can be used both before
>> and after the MMU is enabled. In the spirit of using something only when
>> truly necessary, replace all instances of load_paddr with adr_l, except
> 
> I don't buy this argument. The advantage with using "load_paddr" is that
> it is pretty clear what you get from the call. With "adr_l" you will
> need to check whether the MMU is on or off.
> 
>> in create_table_entry macro. Even though there is currently no use of
>> load_paddr after MMU is enabled, this macro used to be call in such a
>> context and we can't rule out that it won't happen again.
>>
>> This way, the logic behind using load_paddr/adr_l is consistent between
>> arm32 and arm64, making it easier for developers to determine which one
>> to use and when.
> 
> Not really. See above. But there is also no documentation stating that
> "load_paddr" should not be used before the MMU is on. And as I said
> above, I find it easier to work with compare to "adr_l".
I guess it is a matter of taste. load_paddr requires adding a physical offset to
calculate an address, where in fact we have no places in the code where this is 
truly needed.
Seeing an instance of this macro makes me think that this piece of code runs 
with MMU enabled.
We could in fact remove it completely and the only reason I did not is because 
you told me [1] that
one day we might want to use it.

[1] 
https://lore.kernel.org/xen-devel/2b10267a-514c-4c9b-b715-f65c26d7f757@xxxxxxx/

~Michal



 


Rackspace

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