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

Re: [PATCH v1 1/8] x86: Always use eager-fpu


  • To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 19 Mar 2026 16:22:58 +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=0ewCac4RB+z4tj4Pq7tSCM3EqezQxecL7xe5ZdDJw9E=; b=NIQpoTIFLKL2WIKM85qRkqqRc7kCGXqZTG0rGVzRUFmnWR23QW9jI4VXng7mE17uz4mG0blYp9zKQ5SGSu+lpMBsU7XHPzRyOSRhOo+/oeYpUq9Rw/tyhBxzY/fmK/kFsh1ya8u1rg5vf4pMPSmrCkRoe0nIStSp4Rds5wTf7/r1cR9LBeosUDRXfyuLk6I64SMETKww6J4iJaPZK8fh/BSNXcVdFWCrWsQ4MDEjQqtfF7PKqSrZIU60hyqPRk4mKsENV0c/iG3d3VwEJMBpiONqSt8hJ/iaC4JOfbYaoranWgawiOCo+ETDsrC3qDUt+IqR06zw5zhuzPQYmPCwuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KQmpDmaxlYIVg+BlrhTUykwnD/I3MFGR5fghj1MTIV8Xb5BXgoLysRvLFVCSZjG75tuTUqJkFh5rPtLPzaCjpQ7Yr9LGEHEdyd3w9JpvCtTuXUHZlgh/I4JwZDjMTyu6BTBeo8K1NP62mHjw7T/VCkD4X3DxGBOUa2pu4RJbjI6iaOfI2ppF/8gseHfSmqZbBp/kGB3QmLDBgGKySiVfT3N9uKZCFL6sM9Sld9MKNBbIjLCzHuSPA/1Ie6ZsO61w5lrdEewZzmRdR+laIQTdvxyZCoumeX7SQro5k7x8t0/tDXJC70JOCtckjzAUvwyLBV8QqmBT+VONdH6IN3R8Cw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Thu, 19 Mar 2026 16:23:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/03/2026 1:29 pm, Ross Lagerwall wrote:
> Lazy FPU avoids some work during a context switch but pushes the costs
> elsewhere:

I'd phrase this as "more expensive costs elsewhere".

We're trading off a slightly-longer XRSTOR now, for

1) in PV guests, an #NM exception
2) in HVM guests, an #NM exception and VMExit

and the longer XRSTOR.

Lazy is only a win even in theory if the sum of time handing #NM is less
than sum of time doing the longer XRSTOR, and with ...

> * For a workload running some Windows VMs, I measured about 83% of
>   context switches out had used the FPU so most of the time the FPU
>   save/restore is not avoided, just delayed.

... this "No, 83% of the time", falls firmly into "no not a win" category.

> * Setting/clearing the cr0.TS bit is serializing and reportedly slower
>   than the processor optimized xsave/restore.
> * Linux uses PKRU so a partial xsave/restore is performed on each
>   context switch anyway, followed by a second xsave/restore at some
>   point during execution.

"This interferes with the 'modified' optimisation that hardware uses to
try and reduce the cost of the following XSAVE".

>
> There is no measurable performance benefit for using lazy FPU and it
> adds unwanted complexity so remove the option and always use eager-fpu.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>

I think we want one other bullet point.

A key difference between 32bit and 64bit OSes is that %xmm is in the
base featureset for 64bit an thus get ubiquitous use in userspace.  This
is likely why we hit 83%.

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

> diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
> index e86f7d0dbef9..1553cb0bcb7f 100644
> --- a/docs/misc/hypfs-paths.pandoc
> +++ b/docs/misc/hypfs-paths.pandoc
> @@ -108,12 +108,10 @@ A populated Xen hypervisor file system might look like 
> the following example:
>              active-hvm/      directory for mitigations active in hvm doamins
>                  msr-spec-ctrl "No" or "Yes"
>                  rsb          "No" or "Yes"
> -                eager-fpu    "No" or "Yes"
>                  md-clear     "No" or "Yes"
>              active-pv/       directory for mitigations active in pv doamins
>                  msr-spec-ctrl "No" or "Yes"
>                  rsb          "No" or "Yes"
> -                eager-fpu    "No" or "Yes"
>                  md-clear     "No" or "Yes"
>                  xpti         "No" or list of "dom0", "domU", "PCID-on"
>                  l1tf-shadow  "No" or list of "dom0", "domU"

Juergen, do we want to nuke this whole paragraph?  I recall that we
never took the patch wiring up the speculation controls.

If so, it will be better to split this into a separate patch, rather
than to wonder why we've got a hypfs docs change with no associated code
change.

~Andrew



 


Rackspace

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