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

Re: [PATCH] xen/arm: Properly clean update to init_ttbr and smp_up_cpu


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 31 Jan 2024 07:57:41 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=iyg6TwBFORyPI49bh74f6ruCgePYH00SbmdfUiNfFSQ=; b=CK3sRGmgrB5JeMRM5/r6nxJbFzB5pHS09A9weM881coUMKY4RNDqmpgtdL9H/fKEYbZkkQyskEQanwShjrttpE8OKUvCuRKB6xGXwsFKtGd0j5IVW+xEQprjV+Ym8bSaok/chihJhl9pHUqcMVbVoYAri4VaEGU/GoGpYdu43gMd40OL2KibiP/2FZdSn2IWn9nHmOcPnpVcckg+KhZzqnpnuH3vXKDqyKne0ENOphvOzW9C1WDVkR2wT83fBQ6rEjOgos7nIV1rY8gdFLEl9jrFfdSEFnIntvwzs7JZj80+ct0N+WvZc6AoteSdpelRpD740uHSpqYTzlcKzBvvIg==
  • 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=iyg6TwBFORyPI49bh74f6ruCgePYH00SbmdfUiNfFSQ=; b=ercjPNM/hrE/KaZksGmYOIM5S4GjnkphQT45Hu9cRC/Nu1ishAtnSc916v50qUR0FdGKItam76l9VjbvlI9aKJUGOWgvR1uzKn+3UroJq4nam1rnKN+Gq7x+iNopjrEb6+3UD7QEJxWqixhB+5oqeMF8/TN5ZhpOoovAYI808gcY9oo7Eh42twVz6M2FZKlMuk7qx5ND6tP6jvJw0ZOdj2mkazQgd6y5vlFbLQ8/6aKXDHqq65oMnCIneP1QTAjmj1JT/RbtQx5bYroxQDJyfqJUovvqlvxVB73nPOwmXDY1nnFHEaB4G8qNPchkdHj5EGp90ph+MPr/MpznlGwZAw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=MRT34i6NzN5Z/Ysi25Pgjne6frJNPeaFo8D7lRMOjvmSScxeqv99BOiYvVSdUKXO+Owz1yhGyeEpdtNmg1qC+6fJolKUgVe7MlnCqICW8m+jXCSgZODMj+PPoLEYEhpEjvXKRb11+fQsBfx2C1ZIQoS2Z3k/ARO6PB2QJ0TP8aGQhsTy/pNvrVySW2mWn6syV6GfLuZLB4lG2MmeVSnlt/Ur/spVZE/X4W6f6R7WkN1Vcs863j4NhIUeSfZTWJhPLHV9kH518ETR6gkm0KgnS9N/bBPrVLf+RfHiQbmNzcl4Nz0N0U4kqz6GOieA80w0ieE2rPx783vsh2xJZl0Baw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CgSsVTm8x1IeW2VHK0HWmODPBkljxfjXcI5955n59U+77u8YlHpSzVTAJ38Gxtm9o24bwr2Wykmq+QR7OFOng5RqiSutZYJRtGOxu6UJLzRUvNTIPibTi6jhze30DxkyRlUmL24w3oFmM9hhqN/tbsfI+uf1IpvyJvwXgpDTC3uGetpjbx3K6UVyS6oIzQ3zVoSec24rf0pt6EGHHtEoAuZpew2PMNHpsgEGxGnEyRr6Y/tNQLS7sr5Xr02aD1UXwP6cP1weP1So8ElEzZnuszO+TRwrZ+SlQQKryKR5YKWgaYN0+02mL1mdT0S8ezdyKQ8Lp8UOy+Yul6MEByO1dw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • Delivery-date: Wed, 31 Jan 2024 07:58:26 +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: AQHaU6HzSvigBwHs9EiZEUauSjpcEbDzjwMA
  • Thread-topic: [PATCH] xen/arm: Properly clean update to init_ttbr and smp_up_cpu

Hi Julien,

Nice finding :-)

> On 30 Jan 2024, at 18:29, Julien Grall <julien@xxxxxxx> wrote:
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Recent rework to the secondary boot code modified how init_ttbr and
> smp_up_cpu are accessed. Rather than directly accessing them, we
> are using a pointer to them.
> 
> The helper clean_dcache() is expected to take the variable in parameter
> and then clean its content. As we now pass a pointer to the variable,
> we will clean the area storing the address rather than the content itself.
> 
> Switch to use clean_dcache_va_range() to avoid casting the pointer.
> 
> Fixes: a5ed59e62c6f ("arm/mmu: Move init_ttbr to a new section .data.idmap")
> Fixes: 9a5114074b04 ("arm/smpboot: Move smp_up_cpu to a new section 
> .data.idmap)
> 
> Reported-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> xen/arch/arm/mmu/smpboot.c | 2 +-
> xen/arch/arm/smpboot.c     | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/mmu/smpboot.c b/xen/arch/arm/mmu/smpboot.c
> index bc91fdfe3331..4ffc8254a44b 100644
> --- a/xen/arch/arm/mmu/smpboot.c
> +++ b/xen/arch/arm/mmu/smpboot.c
> @@ -88,7 +88,7 @@ static void set_init_ttbr(lpae_t *root)
>      * init_ttbr will be accessed with the MMU off, so ensure the update
>      * is visible by cleaning the cache.
>      */
> -    clean_dcache(ptr);
> +    clean_dcache_va_range(ptr, sizeof(uint64_t));
> 
>     unmap_domain_page(ptr);
> }
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 119bfa3160ad..a84e706d77da 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -449,7 +449,7 @@ static void set_smp_up_cpu(unsigned long mpidr)
>      * smp_up_cpu will be accessed with the MMU off, so ensure the update
>      * is visible by cleaning the cache.
>      */
> -    clean_dcache(ptr);
> +    clean_dcache_va_range(ptr, sizeof(unsigned long));
> 
>     unmap_domain_page(ptr);
> 
> -- 
> 2.40.1
> 




 


Rackspace

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