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

Re: [PATCH 3/7] xen/arm64: head: Add missing isb in setup_fixmap()


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 21 Jun 2023 12:13:17 +0200
  • 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
  • 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=/e4c+oejmR7Hfh62Ug3MuVdOq7eSsu+gA6zYXnV8JJ8=; b=ghqiDbhd0CH/6IG+Otge7EIxhMTjCRWMXfWP3GCoKy1Y0R+G+bah5g+Cd0wHvZMmcuISTON7igVv5WR1apGynxrb/v+FMSkPEVD/9eD9YBGTWZd7fFLSpnjk7ATARbKD5hs4Ghp0fB7awSEP9WA9bCofSHacXd6/B3hG9F7f6zFGoSjxR6BI519Tc3c82MHosMMWnsbh6ctYr4FiVrcEzR5pK16vf9+ng5ACz2HMteW6Yg+vN7NMWKWABJoStUA91/9pGI74cq2DLef7Yev2zO0dbOIE8ECR5VU37Of+8b6SZ1MI3H6bChbXscKHzFv/K5ddXMDFaXxj9EFzjyZ4Bg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jz4cVQYQsc0JrZWx6ggy6r97lwnTmTALmLfooEAfRHq6JaOTo1McIIwSpdIGn/UnC/9ncAlfu4INlwPkc5RUgnLUzjpEpyMoH0+8s42E773xT6bMkU5cSnpXrGGz+0EiD6N3ueLfceM+fcHzuV3Vh0L8+ajae1LfcJj94RdJzcb2jn5oY3bEp6EB8zK7Ld2NEBtqzKf7ok50mCM4+B3CQTsVamPkznvAJGAlXc/K91ii2rLD7mLO/W6xRtNJ3PiALRjWpQ+7AGwfKIhUfRg4Ko37rBPWohg0Ay1NlJE2pPRBkS3WR0w3wMzZCPSoFm6APi+IGQflNmPwONyIg1Ik+w==
  • Cc: <Luca.Fancellu@xxxxxxx>, <Henry.Wang@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 21 Jun 2023 10:13:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 21/06/2023 12:02, Julien Grall wrote:
> 
> 
> Hi,
> 
> On 21/06/2023 10:33, Michal Orzel wrote:
>>
>>
>> On 19/06/2023 19:01, Julien Grall wrote:
>>>
>>>
>>> From: Julien Grall <jgrall@xxxxxxxxxx>
>>>
>>> On older version of the Arm Arm (ARM DDI 0487E.a, B2-125) there were
>>> the following paragraph:
>>>
>>> "DMB and DSB instructions affect reads and writes to the memory system
>>> generated by Load/Store instructions and data or unified cache
>>> maintenance instructions being executed by the PE. Instruction fetches
>>> or accesses caused by a hardware translation table access are not
>>> explicit accesses."
>>>
>>> Newer revision (e.g. ARM DDI 0487J.a) doesn't have the second sentence
>>> (it might be somewhere else in the Arm Arm). But the interpretation is
>>> not much different.
>>>
>>> In setup_fixmap(), we write the fixmap area and may be used soon after,
>>> for instance, to write to the UART. IOW, there could be hardware
>>> translation table access. So we need to ensure the 'dsb' has completed
>>> before continuing. Therefore add an 'isb'.
>>>
>>> Fixes: 2b11c3646105 ("xen/arm64: head: Remove 1:1 mapping as soon as it is 
>>> not used")
>>> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
>> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
>>
>> I'm happy with the whole series but I do not see a point in flooding each 
>> patch with my tag
>> since you already got two (from Henry and Luca).
> 
> Thanks. To clarify, shall I add it in each patch or only this one?
Whatever you prefer. If you care about my tag and want to have more than two, 
feel free to add it to
all the patches.

> 
>>
>> When it comes to essential isb() after dsb() in arm64 head.S, I can see that 
>> we are missing one in enable_mmu()
>> after TLB invalidation. On HW without FEAT_ETS the TLB is "guaranteed to be 
>> complete after the execution of
>> DSB by that PE, followed by a Context synchronization event", so I view isb 
>> as necessary there.
> 
> While there is no ISB directly after DSB NSH, there are one right after
> MSR. I don't think we need one before because nothing will use the TLBs
> between before the ISB.
> 
>          /*
>           * The state of the TLBs is unknown before turning on the MMU.
>           * Flush them to avoid stale one.
>           */
>          tlbi  alle2                  /* Flush hypervisor TLBs */
>          dsb   nsh
> 
>          /* Write Xen's PT's paddr into TTBR0_EL2 */
>          load_paddr x0, boot_pgtable
>          msr   TTBR0_EL2, x0
>          isb
> 
Although having isb after dsb would be clearer to the user and consistent with 
other TBL invalidations,
the one after msr can do the job for now, I agree.

~Michal



 


Rackspace

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