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

Re: [PATCH] x86/Xen: make use of IBPB controlling VM assist


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 20 Mar 2023 11:21:52 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=1AgsO75KsI7eDG/DVWdCrDHkkRSXz0njVdMClLogt9U=; b=oTDK5wgsvb9Bbc12Db4ZHAjzl2o102Uy7wC/wfngBaaJPYla7kQrurJmbWfhRyR0UZCe85ZZjHN68TEr0RGQccdA+dPjXZ6NgH69NkyKM9ExsMeB2TA6jCdkloFs3ioNgOYY1vOCtbMLFtPA9ZaVvOcDfH1ASArp/KrQvQNFbXP8QUm1ywV60ZHwKitk6+FAcbon+MHnYtcPaDTu9J7w15egv5ZdvOz0fSbp2H8TLreyx+Fk9FUpsz4sTOvVIpMCmpYbhnGfHWV865g5SxwpZnqZs6/soDiTcHlk6x/swFLbN4UgoJ+0/N3SYOrlDrfoYcr3VgsXmWAYp1z47enYbA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O7s76aJdRJ6V9xb6US7al8N0XLm0RIvzkzvKuM8aJavyjIId0HzJw2c+qcQRWoonNygdGqcxmJWEDsM2/Ut5G4X1XrS4ZswJxnp08oHNGIKQJ12W/TjMHZ3F5iV86Pt4tUJe5IyS6WPgEqP8KqnOzm2vwPZV/i5npbNKDmFjeGVw3i0VRtWAKZ4Gxv2s6bDtMn+i0V42HmRCW88xObfDwqz5/xyom1aMMvnJlTrk2yzdd5JOse/P3gkavMjUBtmfB1cGnfHyVqu+Ad5/SV2ZdixpSS3so7+e6vBnB6r8Tih9lrhFfuX8QqkQk0m7JZw1AOKANh2hKYtWLBr3EaPpyQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Delivery-date: Mon, 20 Mar 2023 10:22:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.03.2023 15:21, Andrew Cooper wrote:
> On 17/03/2023 1:56 pm, Juergen Gross wrote:
>> --- a/arch/x86/xen/enlighten_pv.c
>> +++ b/arch/x86/xen/enlighten_pv.c
>> @@ -1476,6 +1476,23 @@ static uint32_t __init xen_platform_pv(void)
>>         return 0;
>>  }
>>
>> +int __init xen_vm_assist_ibpb(bool enable)
>> +{
>> +       /*
>> +        * Note that the VM-assist is a disable, so a request to
>> enable IBPB
>> +        * on our behalf needs to turn the functionality off (and vice
>> versa).
>> +        */
>> +       return HYPERVISOR_vm_assist(enable ? VMASST_CMD_disable
>> +                                          : VMASST_CMD_enable,
>> +                                   VMASST_TYPE_mode_switch_no_ibpb);
>> +}
>> +
>> +void __init xen_pv_fix_mitigations(void)
>> +{
>> +       if (!xen_vm_assist_ibpb(true))
>> +               setup_clear_cpu_cap(X86_FEATURE_ENTRY_IBPB);
> 
> If nothing else, this needs a comment explaining what's going on.
> 
> "Xen PV guest kernels run in ring3, so share the same prediction domain
> as userspace.  Xen (since version $X) default to issuing an IBPB on
> guest user -> guest kernel transitions on behalf of the guest kernel. 
> If Linux isn't depending on mode based prediction separation, turn this
> behaviour off".

I would have thought the comment in the public header - saying exactly
that - is sufficient.

> But this does open the next question.  Yes, unilaterally turning turning
> this off restores the prior behaviour, but is this really the best thing
> to do ?

Unless this is purely a question on Jürgen's suggested version (in which
case I'd let him answer) - what alternative do you suggest, within the
present policy used in the kernel?

Jan



 


Rackspace

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