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

Re: [PATCH v1 8/8] x86: Cleanup cr0.TS flag handling


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Mon, 23 Mar 2026 14:14:31 +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=V6Im1uHDgX/jyfDew07TwZhG+NvfF2Tn+QC95G5pJIA=; b=mGiM9I6Z0JfEXWHm+PgfVZyD6ZVrztfSDw1SiknxOlf5jeJ2VMErfH0pEepvJgZ0GDRQYgPHr4IF60Uh0om17kx0PYIo1TVgjSJJ4yJ4JqfLTExwERID+tcnvOeAha33IL2xocF9uqbs7TulHB4R3VJMnIPVnAb2rfrddBbAW0gGsRWa3/jTTmYlw/iLokVmXW+SIvKDNiDD74lMZ8nQcf2qkRGmqZRhcVIXmBncg/OtPrwSGQOdlvgMeNQDDxZEdPdjG2B792fOjsBz0BALXAkOAQEPWUx8Xe3d0Nvs+W+aWB0fY06QQIklftgtlgrGK475ginLnkqCovDEnurgCQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vevgn4wNOjbavpeq9PGdZ9TPrqFLZrk5Jujv4j8iZyinTsLcTX9lvoVRj8x+w78I7nUMZUgeS+GxBrDGw4RclYEhXa2CP15dxLBJ9W0tvbl+wkB2Q5hVXMztcxPuYPdMDnMxkmCjUXdQ9NvbjxV2mZDLb4m6FehmXCwpZPUbdLSDudLrxl6to6RqqInr6xJi4dAKS9S5tx2ZnyUpJKlPuoGgGUxTmQc1+GkLJgqpy6H5EIoTT3GJPo8AN4CDEY2e1+DUr7428d528Jjn3uL4ypE9NpscLBCh3LUPRatQ+CwKNJDJB5jGZqL2D2rm0H50jIj411arQWSOTdOsLtO+nw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 23 Mar 2026 14:15:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 3/23/26 12:30 PM, Jan Beulich wrote:
On 19.03.2026 14:29, Ross Lagerwall wrote:
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -883,9 +883,6 @@ void cpu_init(void)
        /* Install correct page table. */
        write_ptbase(current);
- /* Ensure FPU gets initialised for each domain. */
-       stts();

I'm a little concerned by the removal of this and ...

@@ -193,31 +190,18 @@ void vcpu_restore_fpu(struct vcpu *v)
   * On each context switch, save the necessary FPU info of VCPU being switch
   * out. It dispatches saving operation based on CPU's capability.
   */
-static bool _vcpu_save_fpu(struct vcpu *v)
+void vcpu_save_fpu(struct vcpu *v)
  {
      ASSERT(!is_idle_vcpu(v));
/* This can happen, if a paravirtualised guest OS has set its CR0.TS. */
-    clts();
+    if ( is_pv_vcpu(v) )
+        clts();
if ( cpu_has_xsave )
          fpu_xsave(v);
      else
          fpu_fxsave(v);
-
-    return true;
-}
-
-void vcpu_save_fpu(struct vcpu *v)
-{
-    _vcpu_save_fpu(v);
-    stts();

... this. At present it guards us against e.g. an idle CPU or context
switch code mistakenly using in particular XMM registers (but of course
also other extended state).


Given this concern and Andrew's comment, I could drop this patch for now.
It can be revisited in future if needed.

Ross



 


Rackspace

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