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

Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>
  • Date: Thu, 26 Jan 2023 10:02:44 -0800
  • Arc-authentication-results: i=1; rspamd-9476994bd-kbl4q; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@xxxxxxxxxxxxxxxxxx
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674756169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0h75USw75PEGBO20cN1/ibS8ETsuoLrcwhoitcGBX6c=; b=BHR7BiDKdJ1SntEX1cBO0PfaNNxwDHLp+30G7VrOakbdq/KV69mJKur9Gu06BYj54kvVni wVGm9sfUbr41MeaZQ2COEr5AtUziL00m/nTWAP+4/HyTauMIBMDyYcG/OgwdDVjHfNL01O gSoQ6Is1W7kOfy5VwNXsu80RTzZ6DoQV0BYzgNSGHJJu+tlg3HxA4SPZytS7+fNicsOZ1D JnF9J5Osq4we+4MPT8RpA9sQAaB6v0M13/iAbGSxofDbUhD4wcpS0uWe1mKE4EBkff7vLu PNNmVUvpVfO5VeKFgSmIADxRMLMMpR4l+2Fut6WXhV06FsYp1QT0PdAs9LFcKQ==
  • Arc-seal: i=1; s=arc-2022; d=mailchannels.net; t=1674756169; a=rsa-sha256; cv=none; b=m+F75p7unMf/DGAEQAxbnR+zXDdWAgGhYW8HjvdjZ0Hod0DyabuhDUnsAzIWJqYgjIdznl IR5KCTZMj11Cju+QtbNGJzKmXZz7lC5HoUXaGuALdRG2FUxsnBkconashgGRvj10xZ5CI7 4rzLSVNL2dnBBOQCzbSw2juI6/vKuWBqlb46BdKdTvNrtnmubwnZnT3unpmfj8CR2OF4Vh CZW1C/rumpE84+lTMPuC1NFqRetZYl9MchAWzwOdYLnGUb+M2f/YgFy6ctHcT/KuvDcpYi Z7faWG4MdbAtiz9x9iu/Tur2mH1+0C7Y/N+f0UCx9zyxsFxEeZiFYFoSAJSPAg==
  • Cc: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, David Reaver <me@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 26 Jan 2023 18:03:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Jan 26, 2023 at 10:57:01AM +0100, Jan Beulich wrote:
> On 25.01.2023 19:45, Krister Johansen wrote:
> > --- a/xen/include/public/arch-x86/cpuid.h
> > +++ b/xen/include/public/arch-x86/cpuid.h
> > @@ -72,6 +72,14 @@
> >   * Sub-leaf 2: EAX: host tsc frequency in kHz
> >   */
> >  
> > +#define XEN_CPUID_TSC_EMULATED               (1u << 0)
> > +#define XEN_CPUID_HOST_TSC_RELIABLE          (1u << 1)
> > +#define XEN_CPUID_RDTSCP_INSTR_AVAIL         (1u << 2)
> > +#define XEN_CPUID_TSC_MODE_DEFAULT           (0)
> > +#define XEN_CPUID_TSC_MODE_EMULATE           (1u)
> > +#define XEN_CPUID_TSC_MODE_NOEMULATE         (2u)
> > +#define XEN_CPUID_TSC_MODE_NOEMULATE_TSC_AUX (3u)
> 
> Actually I think we'd better stick to the names found in asm/time.h
> (and then replace their uses, dropping the #define-s there). If you
> agree, I'd be happy to make the adjustment while committing.

Just to confirm, this would be moving these:

   #define TSC_MODE_DEFAULT          0
   #define TSC_MODE_ALWAYS_EMULATE   1
   #define TSC_MODE_NEVER_EMULATE    2
   
To cpuid.h?  I'm generally fine with this.  I don't see anything in
Linux that's using these names.  The only question I have is whether
we'd still want to prefix the names with XEN so that if they're pulled
in to Linux it's clear that the define is Xen specific?  E.g. something
like this perhaps?

   #define XEN_TSC_MODE_DEFAULT          0
   #define XEN_TSC_MODE_ALWAYS_EMULATE   1
   #define XEN_TSC_MODE_NEVER_EMULATE    2

That does increase the number of files we'd need to touch to make the
change, though. (And the other defines in that file all start with
XEN_CPUID).

Though, if you mean doing it this way:

   #define XEN_CPUID_TSC_MODE_DEFAULT          0
   #define XEN_CPUID_TSC_MODE_ALWAYS_EMULATE   1
   #define XEN_CPUID_TSC_MODE_NEVER_EMULATE    2
 
then no objection to that at all.  Apologies for overlooking the naming
overlap when I put this together the first time.

-K



 


Rackspace

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