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

Re: [PATCH 3/5] x86/PV: restrict guest-induced WBINVD (or alike) to cache writeback


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 19 Apr 2023 21:10:20 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=PvW8nhshFmywhubnDrkF86hWHYWnj8nZfNpbs2AdZ9Q=; b=jaU/5ylxPYt7SbMxetsIIKmdkubTKAbPwbE1NtYuUVGy4rj6pICXkMiAMgRqpUHY/rBEL1RaPo1b8+LmPbcqDkdi/v8lwI4EbFZ1fh0vYBt2kp/jiBzMEqEZxI9sN4zmQovjxzMpxSrB+0lnvm+jY5x4kozsUKim8/jmmYr0pDrXCao5GaMXjiVo+0SDOZVj47zL/ZvTlPtuhIZOm6hp/rWrA6eqLUa1O+KxFGupC2RY0exrpicVFEKSmIhmURBjb77ohixx94IgyQ1gD3EoETtEtYhQkMLccXpRgCStJZnegzsbgH1DijaF8SRBKFyvkt4s1qgrbYRLmBprWU64mw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iR6qkiG8M7tFq6ZhZSuu//czQvXqlm/BffIaYiGw+2ciAHucj8lMaR7kVF4kXxXqB3vdIKxBSPyQP4r4/3ktS5dFr3fQ5k54cTJzGyiAs8+zdJuaZUuBEaxFt+BtC6fVsNLVnLj7SYG83U6gpVCsGe415mvUns9s37KWR714badd38cvfxALaFdC66o/XOe4Pwo9R8mPwDtZ2F5cCdf1cd7fHU/XVVnRx5hhIIGMoTDOec6kTzjOug3CfJWjE5pKJ/2ee4MWw8pLFLyz+mwEVU7P1Bo0uhBeESdV0LOBD0SUxQ83WAgaIhZMZXzFUbIuEvKGH+PvHxbdCZjAA/Lkog==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 19 Apr 2023 20:10:50 +0000
  • Ironport-data: A9a23:ncEH96hcbgQ+JDWDPzA7dN6yX161QhEKZh0ujC45NGQN5FlHY01je htvUD+BaK6NZWqned1xOYrloUhX6JOHz9JqGgtlqyswQSIb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmYpHlUMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWj0N8klgZmP6sT4AaPzyN94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQfcGkLNUu7i9uog6OjGu9nqst6HfDkadZ3VnFIlVk1DN4AaLWaGeDv2oUd2z09wMdTAfzZe swVLyJ1awjNaAFOPVFRD48imOCvhT/0dDgwRFC9/PJrpTSMilIvluS2WDbWUoXiqcF9t0CUv G/ZuU/+BQkXLoe3wjuZ6HO8wOTImEsXXapLTOPlqKMx3Qf7Kmo7CRo7cUCmpfWCpmmXRdlcD kgt3ix3hP1nnKCsZpynN/Gim1aGtBMBX9tbE8Uh9RqAjKHT5m6xFmUCCzJMdtEinMs3XiAxk E+EmcvzAj5iu6HTTmiSnp+LqRuiNC5TKnUNDRLoViMA6tjn5YQs1BTGS485FLbv1oGuXzbt3 zqNsS4ywa0JitIG3Lm6+laBhC+wop/OTUg+4QC/sn+Z0z6VrbWNP+SAgWU3J94ZRGpFZjFtZ EQ5pvU=
  • Ironport-hdrordr: A9a23:1htQbaAHy3GjG4XlHemo55DYdb4zR+YMi2TDtnocdfUxSKelfq +V88jzuSWbtN9yYhEdcKG7WZVoKEm0nfQZ3WB7B8bAYOCJghrNEKhSqafk3j38C2nf24dmpM BdmnFFeb/N5I5B/KPH3DU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/04/2023 11:45 am, Jan Beulich wrote:
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -3772,7 +3772,7 @@ long do_mmuext_op(
>              else if ( unlikely(!cache_flush_permitted(currd)) )
>                  rc = -EACCES;
>              else
> -                wbinvd();
> +                wbnoinvd();
>              break;

It occurs to me that this is fundamentally broken.

The guest is not in any position to know (or control) whether it gets
rescheduled elsewhere between now and it logically continuing execution.

So if there is actually any cache maintenance to do, it can't be a
WB{...} of any form on just this CPU alone.

> --- a/xen/include/public/arch-x86/cpufeatureset.h
> +++ b/xen/include/public/arch-x86/cpufeatureset.h
> @@ -238,7 +238,7 @@ XEN_CPUFEATURE(EFRO,          7*32+10) /
>  /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */
>  XEN_CPUFEATURE(CLZERO,        8*32+ 0) /*A  CLZERO instruction */
>  XEN_CPUFEATURE(RSTR_FP_ERR_PTRS, 8*32+ 2) /*A  (F)X{SAVE,RSTOR} always 
> saves/restores FPU Error pointers */
> -XEN_CPUFEATURE(WBNOINVD,      8*32+ 9) /*S  WBNOINVD instruction */
> +XEN_CPUFEATURE(WBNOINVD,      8*32+ 9) /*A  WBNOINVD instruction */

Given that PV guests do have several real hypercalls for doing this, I'm
not particularly inclined to let them do it via an emulated path,
however easy it might be at a technical level.

I doubt anything good can come from it.

~Andrew



 


Rackspace

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