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

Re: [PATCH 3/8] x86/svm: VMEntry/Exit logic for MSR_SPEC_CTRL


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 27 Jan 2022 08:25:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=uaotrinTgkLyYR0wKqR/kZNg2yeHCpazezaokuSXli8=; b=Lh4V2xhuBbmyrP3UGXLBd4WX1ysPQ48lraCD9hu51HbHudZmZp14XMaGqA1x16mY90TMeTAYmyRQqkC9mrCbv9L/wUgR6n7l+vnoNtU4dS0/94DK6cTGYFx8fTRxL4X72QCBcAhw5OBTKjYL+7arFBt46Rpn0ob5FXBqdRGAgW0TXHrgMIaEor/zVMdAN+uVG+Uju8yLucLZ7dQkzh7D8ifLgfkmaUJxt4pOQNLHGY4zCxgDP+oRZIixENE+9jiBlcrU8m5UichWeMeJeyTYFp/R0EIVDJR1RLF/qMO9VK9QrmEsCMQ/2+wcULOMZ+BnLGZX1o7ewojSqqLNjQreIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ej12aIky/cgW0n+CunJ6Kbgcb40AY1gl97YkUqnzrbnrXmlboMx8bwMW5KubB81c1ZLh1VFHVNw+EjrIXUvkr7WDO8D/eSG12hNLVYF/bcGW38EE0hia72dh4L3pHrqj5R+vicV88XuySZRorMZGi3hY+dX6GRAVaW6auLcCpUvDCmk+THTGgg+rEjCHOMIzD7Fvrnhz90/BjFiOt72b6y4eBROM5bnr/riTtJUKKeuX9CcMzyRF+sK77j9WNHcHGh0JJ7EH0anvSTZjEPvtl8iZtKneigbu/JJFPPcOCz/AjCD4nq2ZLlIps26M22qMRPBBNw4RupdPCU1rifzoKg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 27 Jan 2022 07:25:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.01.2022 21:16, Andrew Cooper wrote:
> On 26/01/2022 16:50, Jan Beulich wrote:
>> On 26.01.2022 09:44, Andrew Cooper wrote:
>>> 1) It would be slightly more efficient to pass curr and cpu_info into
>>>    vm{entry,exit}_spec_ctrl(), but setup of such state can't be in the
>>>    ALTERNATIVE block because then the call displacement won't get fixed up.
>>>    All the additional accesses are hot off the stack, so almost certainly
>>>    negligible compared to the WRMSR.
>> What's wrong with using two instances of ALTERNATIVE, one to setup the
>> call arguments and the 2nd for just the CALL?
> 
> Hmm
> 
> diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
> index c718328ac4cf..1d4be7e97ae2 100644
> --- a/xen/arch/x86/hvm/svm/entry.S
> +++ b/xen/arch/x86/hvm/svm/entry.S
> @@ -59,6 +59,7 @@ __UNLIKELY_END(nsvm_hap)
>  
>          /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
>          /* SPEC_CTRL_EXIT_TO_SVM       Req:                          
> Clob: C   */
> +        ALTERNATIVE "", __stringify(mov %rbx, %rdi; mov %rsp, %rsi),
> X86_FEATURE_SC_MSR_HVM
>          ALTERNATIVE "", __stringify(call vmentry_spec_ctrl),
> X86_FEATURE_SC_MSR_HVM
>  
>          pop  %r15
> 
> is somewhat of a long line, but isn't too terrible.
> 
> I'm tempted to switch back to using STR() seeing as we have both and it
> is much more concise.

No objections. In fact I think when I introduced stringify.h over 10 years
back, I didn't realize we already had STR(). Quite certainly first and
foremost because of its bogus placement in xen/config.h (same would go for
at least IS_ALIGNED() as well as KB() and friends).

I wouldn't even mind phasing out stringify.h again. Or maybe we want to
move STR() there ...

Jan




 


Rackspace

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