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

Re: [PATCH v1 2/8] x86/vmx: Remove lazy FPU support


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Fri, 20 Mar 2026 10:45:28 +0000
  • 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=arcselector10001; 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=7Kkk6Zd6txHNwwoJi5Tyr+RvkDuM60jBULf2zj7xAgM=; b=vl+o/KPThXlW8Ps/h1awhrsZqE/u3xYOyVWEspMjeFmFPfg8iTsqlHS50titpODL6spjzeHVAr5jLZPTNN2mLC9UJP9FZNSQPwZ7O2ekbCtQjjRb3qFjRNzhL9SkNs5o3MCB2etYKf7BKjpj7T+O/u3/rFTur+PVqYNvig3T2OPcGewQqXOODo/TA5y5UBqw4L4/it0iUsuod/MoOFfdvcbs1pHVgO3SxM5+fs3t4mQxZ2RfLdozhZjTQqq/C2cuoz5SzPi4UhYkdonv0Maqw42Dzeq9M9EDITps3zKucN1Su9Q9DKo4j1DrNj0Gjo0SKiqdbSHF2KX+hlcJqhgxVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B2AYiN1/BMSdI8aBF8a1+DEXs2DYwrU9Kv4QopJErQb7Wtd79siBbZxnEa5NX0S4QNlg8l5h5DdC+KSmO4jNtdsOyaylUJtF47om5eRaHzodesUtZFA0E7FxZGFq6ftGXlM8FxnNjScgcFuyvwUaVcCVVfmgvtJ8rHO46lO4IUkRG737+EzBVFsOmGPmUdEgF1iRkLz4VndqJmggFy/eUVFqTR65Jg0lHqDu9ing+7sjysy+aNVCiKv+PZEz3/87QNo1xhx/qOFl7STG7GW6V9y4dPoUVUPpBGGgHIfmBwxXtZIK3apqnp2srDB9vMaz0JJ6C/GZad4Hq8w1IdmySg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 20 Mar 2026 10:46:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 3/19/26 4:54 PM, Andrew Cooper wrote:
On 19/03/2026 4:43 pm, Jan Beulich wrote:
On 19.03.2026 17:38, Andrew Cooper wrote:
On 19/03/2026 1:29 pm, Ross Lagerwall wrote:
Remove lazy FPU support from the VMX code since fully_eager_fpu is now
always true.

No functional change intended.

Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

---
  xen/arch/x86/hvm/vmx/vmcs.c             |  8 +--
  xen/arch/x86/hvm/vmx/vmx.c              | 70 +------------------------
  xen/arch/x86/hvm/vmx/vvmx.c             | 15 +-----
  xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 -
  4 files changed, 5 insertions(+), 90 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index c2e7f9aed39f..8e52ef4d497a 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1247,10 +1247,7 @@ static int construct_vmcs(struct vcpu *v)
      __vmwrite(HOST_TR_SELECTOR, TSS_SELECTOR);
/* Host control registers. */
-    v->arch.hvm.vmx.host_cr0 = read_cr0() & ~X86_CR0_TS;
-    if ( !v->arch.fully_eager_fpu )
-        v->arch.hvm.vmx.host_cr0 |= X86_CR0_TS;
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
+    __vmwrite(HOST_CR0, read_cr0());
(Not for this patch) but I'm pretty sure there's room to optimise this
further.

CR0 should be constant, both here and in SVM.  Reading the active cr0 is
an example of the anti-pattern we need to purge to make nested-virt work
better.
In which case, is it a good idea to purge the host_cr0 field?

Oh hmm, I take back my R-by slightly.  We still need to initialise
v->arch.hvm.vmx.host_cr0 for this patch to be no functional change.
Easy enough to fix, or fix on commit.


Not sure I follow why v->arch.hvm.vmx.host_cr0 is needed when this would
be the only place it is used?

For no function change, it should be probably be...

__vmwrite(HOST_CR0, read_cr0() & ~X86_CR0_TS);

... though that might be unnecessary after patch 8.

Ross



 


Rackspace

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