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

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


  • To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 19 Mar 2026 20:53:40 +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=TLbNAvip8YJzclx6/g/U2ztaBg6OlcU/mISGpANgMCw=; b=rgeQTDvnq28Ho8nvqtzjwRmLDtnvMDich85BjCPJyg45uLyprmWN7BM1T3lw15+ngftXv1yc6BGrmdeohh35I2DgUHFdzjVdCE20CvoeXTZOzs0uKS8RKETSdUSVkLzhAcFCBmg1S/8B91KWdUP9Xp0GErkXUxd4dQMExMazFIGHylaD2LYc83yAM2NAUxfLKUd9/AQKNDnFQNb55XbMPC5mEkMw5JWxsAPHWkUWxn6yGJCFlH4QHklPJ34o2G/jdn3q8LrqKxJGzMHLB4tnUONCkMwme+f+ujVNUlJ1OQAxSbxN1sHzDXj1G67o/ouHNtxiWB9qavz5TlXLyiTN9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aOlXiErP16zsM1nFQPjeh61MnRG3YTwIdfNwmihD8MGgP2Et9TbkQ6CYLTXCzTT7GV5oQ8fyIxnStLUQ4KkmPrEHdOs6nGby7LN+sgK2F0cRZuavLa3UrH592AQrd1xIJ5aXkqL79bavwjp16vI4ee+7khOL7TQHYyILY5POsATuzC4jnL/jRnfPBAwDyg0x7kQGU+/ea7wweqFHQhukhT6N7tTiHo3HZogkX3xiECVnv96p5O/QwdXrrR272vvjnla/wFY8qrIEhvtOB2eLw/ia9+cipOtXdlSxFyx5P8yoMWFh8Cm5IvEBg0hHhGtCzf+IH9m3tP7jI2oud6s0SQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 19 Mar 2026 20:54:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/03/2026 1:29 pm, Ross Lagerwall wrote:
> diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
> index 9acaaf4673df..336bc83b6e13 100644
> --- a/xen/arch/x86/i387.c
> +++ b/xen/arch/x86/i387.c
> @@ -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();
>  

It's quite likely that this would be quicker to just leave as unconditional.

is_pv_vcpu() has evaluate_nospec() in it, so forces LFENCEs, and CLTS
has a fast nop path even in very early implementations.

~Andrew



 


Rackspace

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