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

Krister Johansen posted 1 patch 1 year, 3 months ago
Test gitlab-ci passed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230124223516.GA1962@templeofstupid.com
There is a newer version of this series
xen/include/public/arch-x86/cpuid.h | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
Cpuid leaf 4 contains information about how the state of the tsc, its
mode, and some additional information.  A commit that is queued for
linux would like to use this to determine whether the tsc mode has been
set to 'no emulation' in order to make some decisions about which
clocksource is more reliable.

Expose this information in the public API headers so that they can
subsequently be imported into linux and used there.

Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
---
 xen/include/public/arch-x86/cpuid.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..97dc970417 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -71,6 +71,12 @@
  *             EDX: shift amount for tsc->ns conversion
  * 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)
 
 /*
  * Leaf 5 (0x40000x04)
-- 
2.25.1
Re: [PATCH] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 3 months ago
On 24.01.2023 23:35, Krister Johansen wrote:
> --- a/xen/include/public/arch-x86/cpuid.h
> +++ b/xen/include/public/arch-x86/cpuid.h
> @@ -71,6 +71,12 @@
>   *             EDX: shift amount for tsc->ns conversion
>   * 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)

This could do with a blank line between the two groups. You're also
missing mode 3. Plus, as a formal remark, please follow patch
submission rules: They are sent To: the list, with maintainers on
Cc:.

Jan
Re: [PATCH] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
On Wed, Jan 25, 2023 at 07:57:16AM +0100, Jan Beulich wrote:
> On 24.01.2023 23:35, Krister Johansen wrote:
> > --- a/xen/include/public/arch-x86/cpuid.h
> > +++ b/xen/include/public/arch-x86/cpuid.h
> > @@ -71,6 +71,12 @@
> >   *             EDX: shift amount for tsc->ns conversion
> >   * 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)
> 
> This could do with a blank line between the two groups. You're also
> missing mode 3. Plus, as a formal remark, please follow patch
> submission rules: They are sent To: the list, with maintainers on
> Cc:.

Thanks for the feedback.  I'll make those changes.

My apologies for the breach etiquette, and thank you for the reminder
about the norms.  I'll correct the To: and CC: headers on the next go
around.

-K
[PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
Cpuid leaf 4 contains information about how the state of the tsc, its
mode, and some additional information.  A commit that is queued for
linux would like to use this to determine whether the tsc mode has been
set to 'no emulation' in order to make some decisions about which
clocksource is more reliable.

Expose this information in the public API headers so that they can
subsequently be imported into linux and used there.

Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
---
v2.1:
  - Correct In-Reply-To header for proper threading
v2:
  - Fix whitespace between comment and #defines (feedback from Jan Beulich)
  - Add tsc mode 3: no emulate TSC_AUX (feedback from Jan Beulich)
---
 xen/include/public/arch-x86/cpuid.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..090f7f0034 100644
--- 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)
+
 /*
  * Leaf 5 (0x40000x04)
  * HVM-specific features
-- 
2.25.1
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 3 months ago
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.

Jan
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
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
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 3 months ago
On 26.01.2023 19:02, Krister Johansen wrote:
> 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.

Yes, it's the last variant you list that I was after. And I'd be okay to
leave dropping the so far private constants to a separate follow-on patch.

Jan
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
On Fri, Jan 27, 2023 at 08:16:18AM +0100, Jan Beulich wrote:
> On 26.01.2023 19:02, Krister Johansen wrote:
> > 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.
> 
> Yes, it's the last variant you list that I was after. And I'd be okay to
> leave dropping the so far private constants to a separate follow-on patch.

Ok, thanks. I'll send you a v3 that makes these changes, unless you've
already fixed this up and committed the v2.  In that case, feel free to
disregard.

-K
[PATCH v3] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
Cpuid leaf 4 contains information about how the state of the tsc, its
mode, and some additional information.  A commit that is queued for
linux would like to use this to determine whether the tsc mode has been
set to 'no emulation' in order to make some decisions about which
clocksource is more reliable.

Expose this information in the public API headers so that they can
subsequently be imported into linux and used there.

Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
---
v3
  - Additional formating cleanups (feedback from Jan Buelich)
  - Ensure that TSC_MODE #defines match the names of those in time.h (feedback
    from Jan Buelich)
v2:
  - Fix whitespace between comment and #defines (feedback from Jan Beulich)
  - Add tsc mode 3: no emulate TSC_AUX (feedback from Jan Beulich)
---
 xen/include/public/arch-x86/cpuid.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..3fbd912dcd 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -72,6 +72,15 @@
  * 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_ALWAYS_EMULATE        (1u)
+#define XEN_CPUID_TSC_MODE_NEVER_EMULATE         (2u)
+#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u)
+
 /*
  * Leaf 5 (0x40000x04)
  * HVM-specific features
-- 
2.25.1
Re: [PATCH v3] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 2 months ago
On 27.01.2023 19:51, Krister Johansen wrote:
> --- a/xen/include/public/arch-x86/cpuid.h
> +++ b/xen/include/public/arch-x86/cpuid.h
> @@ -72,6 +72,15 @@
>   * 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_ALWAYS_EMULATE        (1u)
> +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE         (2u)
> +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u)

While perhaps it doesn't matter much with the mode no longer supported,
I'd prefer if here we used the original name (PVRDTSCP) as well.
Preferably with that adjustment (which once again I'd be happy to do
while committing, albeit I'd like to wait with that until osstest is in
a better mood again)
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Re: [PATCH v3] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 2 months ago
Hi Jan,

On Mon, Jan 30, 2023 at 09:22:11AM +0100, Jan Beulich wrote:
> On 27.01.2023 19:51, Krister Johansen wrote:
> > --- a/xen/include/public/arch-x86/cpuid.h
> > +++ b/xen/include/public/arch-x86/cpuid.h
> > @@ -72,6 +72,15 @@
> >   * 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_ALWAYS_EMULATE        (1u)
> > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE         (2u)
> > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u)
> 
> While perhaps it doesn't matter much with the mode no longer supported,
> I'd prefer if here we used the original name (PVRDTSCP) as well.
> Preferably with that adjustment (which once again I'd be happy to do
> while committing, albeit I'd like to wait with that until osstest is in
> a better mood again)
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks for the additional feedback.  I'll send you a v4 that makes the
requested modification.

-K
[PATCH v4] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 2 months ago
Cpuid leaf 4 contains information about how the state of the tsc, its
mode, and some additional information.  A commit that is queued for
linux would like to use this to determine whether the tsc mode has been
set to 'no emulation' in order to make some decisions about which
clocksource is more reliable.

Expose this information in the public API headers so that they can
subsequently be imported into linux and used there.

Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
---
v4
  - Rename TSC_MODE_NEVER_EMULATE_TSC_AUX to TSC_MODE_PVRDTSCP (feedback from
    Jan Buelich)
v3
  - Additional formating cleanups (feedback from Jan Buelich)
  - Ensure that TSC_MODE #defines match the names of those in time.h (feedback
    from Jan Buelich)
v2:
  - Fix whitespace between comment and #defines (feedback from Jan Beulich)
  - Add tsc mode 3: no emulate TSC_AUX (feedback from Jan Beulich)
---
 xen/include/public/arch-x86/cpuid.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..9d02f86564 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -72,6 +72,15 @@
  * 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_ALWAYS_EMULATE        (1u)
+#define XEN_CPUID_TSC_MODE_NEVER_EMULATE         (2u)
+#define XEN_CPUID_TSC_MODE_PVRDTSCP              (3u)
+
 /*
  * Leaf 5 (0x40000x04)
  * HVM-specific features
-- 
2.25.1
Re: [PATCH v4] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 2 months ago
On 30.01.2023 18:44, Krister Johansen wrote:
> Cpuid leaf 4 contains information about how the state of the tsc, its
> mode, and some additional information.  A commit that is queued for
> linux would like to use this to determine whether the tsc mode has been
> set to 'no emulation' in order to make some decisions about which
> clocksource is more reliable.
> 
> Expose this information in the public API headers so that they can
> subsequently be imported into linux and used there.
> 
> Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
> Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
> Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>

As said:
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Jan Beulich 1 year, 3 months ago
On 25.01.2023 19:45, Krister Johansen wrote:
> v2:
>   - Fix whitespace between comment and #defines (feedback from Jan Beulich)

Hmm, ...

> --- 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)

... while I'm fine with the leading blank line, what my earlier comment was
about really are the two separate blocks of #define-s (the flag bits and the
modes). I'll take care of this while committing; with the adjustment

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Re: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4
Posted by Krister Johansen 1 year, 3 months ago
On Thu, Jan 26, 2023 at 09:57:43AM +0100, Jan Beulich wrote:
> On 25.01.2023 19:45, Krister Johansen wrote:
> > v2:
> >   - Fix whitespace between comment and #defines (feedback from Jan Beulich)
> 
> Hmm, ...
> 
> > --- 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)
> 
> ... while I'm fine with the leading blank line, what my earlier comment was
> about really are the two separate blocks of #define-s (the flag bits and the
> modes). I'll take care of this while committing; with the adjustment
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Sorry I miunderstood, and thanks for being willing to fix this up
while committing.

-K