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

Re: [PATCH v4 3/3] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 2 May 2022 08:11:54 +0200
  • 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=n1xttg9DPI47C8bDODjVmNp1gMhrQ6eaSKaARBgvnI4=; b=iELH8n3piYUX5E6aWp2LA+TcK6uM9yl7WcoCLGDbWGprDMzYE9az3Dp9qswDWDWKxh5P0OWs6mvch6nqGYuI/FMBrEcCT7x5hlYWQn11MMEE9ErazJHIYWhOBy9B0goja6qxFLusAmpLgHIRTW9HDYy1dmjsxIgWGHvka6uQ69RkGCQxjMj9WP5wU/335t0tByfl8mremVfDruCtfNrTBWSdH379TMQD9JeYqTQxEI269XPfkDn90MAfeZ5sO95+FEGODLhWgOZLy6UBAFFQRbnvKqmPxuoKWLJklYTGLJKBv0bv1XNEHAfvv3oDkTdxwmw5ym2t3SdWpsVEVADy/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHB9HTY+3VEhT/mjinmNm7tgHOfFJdvph+C5ipwb8zNlU4tLupI/rqpS/omjOMCaR+DLpHsCFflLGHwg+MY4EIQFPxTPvNoL5d19r+M6QqiHR+DJiR50PCdwgjUIpRtGBbkNc/k20PwF3OLiHSudIMVRyimvnLMrHEmpIeuUV72Uy3TqQoMj+Frp2OKwgf5iz0TaU3qCKsWP7t4lnnLQBFKh3FTWTy4g98wI4HVwVwXUDg7akXUA5/bJGcZu9HmsXCEH6xU56wFC0jKkaIXbh3UHe67ISILyowQHX4fEv4a7wMOKqrzEiu3t/J8gHBCBsVxyYnu8atohmMd6crLdKQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 02 May 2022 06:12:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.04.2022 17:49, Roger Pau Monné wrote:
> On Fri, Apr 29, 2022 at 12:59:58PM +0200, Jan Beulich wrote:
>> On 27.04.2022 12:47, Roger Pau Monne wrote:
>>> @@ -3138,6 +3140,9 @@ void vmentry_virt_spec_ctrl(void)
>>>  
>>>      if ( cpu_has_virt_ssbd )
>>>          wrmsr(MSR_VIRT_SPEC_CTRL, current->arch.msrs->virt_spec_ctrl.raw, 
>>> 0);
>>> +    else
>>> +        amd_set_legacy_ssbd(current->arch.msrs->virt_spec_ctrl.raw &
>>> +                            SPEC_CTRL_SSBD);
>>
>> Would seem cheaper to use !val here (and then val for symmetry in
>> the other function).
> 
> I could even use !opt_ssbd, and that would be more similar to what's
> done in vmexit_virt_spec_ctrl?

Might be an option, yet when using "val" there as well I don't see
benefit similarity-wise. Using a local variable would imo still be
cheaper than accessing a global one. But that's a matter of taste
to a fair degree, so I'll leave it to you - all I'd really prefer
to have is the functions using as similar / symmetric as possible
conditions.

Jan




 


Rackspace

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