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

Re: [PATCH] xen/arm: Missing N1/A76/A75 FP registers in vCPU context switch


  • To: Wei Chen <Wei.Chen@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 18 Aug 2020 08:49:20 +0000
  • Accept-language: en-GB, 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-SenderADCheck; bh=Vvu1p3o2Eoy2RYFgbXvnxxpBkEAai6FNil0RIQcOvF8=; b=BOB98Jz0JDXNDHxBDtKMrehWRL97BeCxP3tptKjtjpBN3twxPUqfJPE4DY1QoAIzuhWaBdzw7dl5XOjOxL5EPZhY/UClkGs/2fGNdgw8qBSCNvLNWuhQ6GCtWXwxFCTa2Wju/Jh6rlAJtFj97lrwPNGYxQWt5AxHlkbxRWGc/bzfK/vx9kZhLMLTVRQ46WZVBEQSQ637hhL3lby6KSJ3bzLTWgFjzI92wotbIB/FKW+iKN9CladQYTVEkwbm6Cai0MizUXl7sjWB1uVOF4r9kR5g2wGTUinxSTkF+XdGgNFxL4Gbxek6h3ZAMJhy+YQuc0TsIRPafXEiHNkMLZZCTA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aImjuQbZXP4e+waNvUtbvLwW1kADZ6vONE2qnDXZVbCO/U6BRGDHs3njjGp7+Zs3UBsNlyPYUef7kXaYBkpQqLyRmMfdRu5u11QYceFr3dLMhiCz3fiXInVbRX4a79QwtnogC3TcBrVJnle5Y5k6dTing4uMBOWvazdo0at65bcyAUY4PX74mTNL7199tX5+SLRTvKyAYTd5X89DpUcp+cx+TRYgbZOhHDFc7RCV6Hk3ZVNfsJLnKVvhjwqSrVzE7YuyxQJhjOnt/ITZEtLGQfU4uJbNK95PMujssXLBYcMw/aB92UpbUaKqgScgVeUGDWzH+VBwmW+osptB/MsLCA==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Steve Capper <Steve.Capper@xxxxxxx>, Kaly Xin <Kaly.Xin@xxxxxxx>, nd <nd@xxxxxxx>
  • Delivery-date: Tue, 18 Aug 2020 08:49:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWdQ1DgIquqcpHPEOT+qWxYeHAMqk9jtIA
  • Thread-topic: [PATCH] xen/arm: Missing N1/A76/A75 FP registers in vCPU context switch


> On 18 Aug 2020, at 04:11, Wei Chen <Wei.Chen@xxxxxxx> wrote:
> 
> Xen has cpu_has_fp/cpu_has_simd to detect whether the CPU supports
> FP/SIMD or not. But currently, this two MACROs only consider value 0
> of ID_AA64PFR0_EL1.FP/SIMD as FP/SIMD features enabled. But for CPUs
> that support FP/SIMD and half-precision floating-point features, the
> ID_AA64PFR0_EL1.FP/SIMD are 1. For these CPUs, xen will treat them as
> no FP/SIMD support. In this case, the vfp_save/restore_state will not
> take effect.
> 
> Unfortunately, Cortex-N1/A76/A75 are the CPUs support FP/SIMD and
> half-precision floatiing-point. Their ID_AA64PFR0_EL1.FP/SMID are 1
> (see Arm ARM DDI0487F.b, D13.2.64). In this case, on N1/A76/A75
> platforms, Xen will always miss the float pointer registers save/restore.
> If different vCPUs are running on the same pCPU, the float pointer
> registers will be corrupted randomly.
> 
> This patch fixes Xen on these new cores.
> 
> Signed-off-by: Wei Chen <wei.chen@xxxxxxx>

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

I tested this patch on an N1SDP and it solving random crashes issues.

Could we consider applying this to 4.14 ?

> ---
> xen/include/asm-arm/cpufeature.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/include/asm-arm/cpufeature.h 
> b/xen/include/asm-arm/cpufeature.h
> index 674beb0353..588089e5ae 100644
> --- a/xen/include/asm-arm/cpufeature.h
> +++ b/xen/include/asm-arm/cpufeature.h
> @@ -13,8 +13,8 @@
> #define cpu_has_el2_64    (boot_cpu_feature64(el2) >= 1)
> #define cpu_has_el3_32    (boot_cpu_feature64(el3) == 2)
> #define cpu_has_el3_64    (boot_cpu_feature64(el3) >= 1)
> -#define cpu_has_fp        (boot_cpu_feature64(fp) == 0)
> -#define cpu_has_simd      (boot_cpu_feature64(simd) == 0)
> +#define cpu_has_fp        (boot_cpu_feature64(fp) <= 1)
> +#define cpu_has_simd      (boot_cpu_feature64(simd) <= 1)
> #define cpu_has_gicv3     (boot_cpu_feature64(gic) == 1)
> #endif
> 
> -- 
> 2.17.1
> 




 


Rackspace

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