[PATCH linux-next] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-08 Thread Krister Johansen
nux-clock-source/ [2] https://www.brendangregg.com/blog/2021-09-26/the-speed-of-time.html [3] https://xenbits.xen.org/docs/unstable/man/xen-tscmode.7.html [4] Intel 64 and IA-32 Architectures Sofware Developer's Manual Volume 3b: System Programming Guide, Part 2, Section 17.17.1, Invariant TS

Re: [PATCH linux-next] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-12 Thread Krister Johansen
On Fri, Dec 09, 2022 at 02:32:15PM -0500, Boris Ostrovsky wrote: > > On 12/8/22 11:36 AM, Krister Johansen wrote: > > + /* > > +* As Dom0 is never moved, no penalty on using TSC there. > > +* > > +* If the guest has invariant tsc, then set xen_clock

[PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-12 Thread Krister Johansen
on 17.17.1, Invariant TSC Signed-off-by: Krister Johansen Code-reviewed-by: David Reaver --- v2: - Use cpuid information to determine if tsc is emulated. Do not use tsc as clocksource if it is. (feedback from Boris Ostrovsky) - Move tsc checks into their own helper function - Add de

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-12 Thread Krister Johansen
On Mon, Dec 12, 2022 at 05:46:29PM +0100, Jan Beulich wrote: > On 12.12.2022 17:05, Krister Johansen wrote: > > Both the Intel SDM[4] and the Xen tsc documentation explain that marking > > a tsc as invariant means that it should be considered stable by the OS > > and is el

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-12 Thread Krister Johansen
On Mon, Dec 12, 2022 at 01:48:24PM -0500, Boris Ostrovsky wrote: > > On 12/12/22 11:05 AM, Krister Johansen wrote: > > > > diff --git a/arch/x86/include/asm/xen/cpuid.h > > b/arch/x86/include/asm/xen/cpuid.h > > index 6daa9b0c8d11..d9d7432481e9 100644 > > --

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-13 Thread Krister Johansen
On Tue, Dec 13, 2022 at 08:23:29AM +0100, Jan Beulich wrote: > On 12.12.2022 23:05, Krister Johansen wrote: > > On Mon, Dec 12, 2022 at 05:46:29PM +0100, Jan Beulich wrote: > >> On 12.12.2022 17:05, Krister Johansen wrote: > >>> Both the Intel SDM[4] and the Xen

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-14 Thread Krister Johansen
On Tue, Dec 13, 2022 at 04:25:32PM -0500, Boris Ostrovsky wrote: > > On 12/12/22 5:09 PM, Krister Johansen wrote: > > On Mon, Dec 12, 2022 at 01:48:24PM -0500, Boris Ostrovsky wrote: > > > On 12/12/22 11:05 AM, Krister Johansen wrote: > > > > diff --git a

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-14 Thread Krister Johansen
On Wed, Dec 14, 2022 at 09:17:24AM +0100, Jan Beulich wrote: > On 13.12.2022 19:58, Krister Johansen wrote: > > On Tue, Dec 13, 2022 at 08:23:29AM +0100, Jan Beulich wrote: > >> On 12.12.2022 23:05, Krister Johansen wrote: > >>> On Mon, Dec 12, 2022 at 05:46

Re: [PATCH linux-next v2] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-16 Thread Krister Johansen
On Wed, Dec 14, 2022 at 04:46:10PM -0500, Boris Ostrovsky wrote: > > On 12/14/22 1:01 PM, Krister Johansen wrote: > > On Tue, Dec 13, 2022 at 04:25:32PM -0500, Boris Ostrovsky wrote: > > > On 12/12/22 5:09 PM, Krister Johansen wrote: > > > > On Mon, Dec 12

[PATCH linux-next v3] x86/xen/time: prefer tsc as clocksource when it is invariant

2022-12-16 Thread Krister Johansen
en-tscmode.7.html [4] Intel 64 and IA-32 Architectures Sofware Developer's Manual Volume 3b: System Programming Guide, Part 2, Section 17.17.1, Invariant TSC Signed-off-by: Krister Johansen Code-reviewed-by: David Reaver --- v3: - Temporarily drop references to public API headers

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

2023-01-24 Thread Krister Johansen
-77a2ac298...@oracle.com/ Signed-off-by: Krister Johansen --- 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/cpu

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

2023-01-25 Thread Krister Johansen
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

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

2023-01-25 Thread Krister Johansen
-77a2ac298...@oracle.com/ Signed-off-by: Krister Johansen --- 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 -

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

2023-01-25 Thread Krister Johansen
-77a2ac298...@oracle.com/ Signed-off-by: Krister Johansen --- 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/c

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

2023-01-26 Thread Krister Johansen
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 > &g

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

2023-01-26 Thread Krister Johansen
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

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

2023-01-27 Thread Krister Johansen
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/c

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

2023-01-27 Thread Krister Johansen
-77a2ac298...@oracle.com/ Signed-off-by: Krister Johansen --- 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 Beulic

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

2023-01-30 Thread Krister Johansen
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

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

2023-01-30 Thread Krister Johansen
-77a2ac298...@oracle.com/ Signed-off-by: Krister Johansen --- 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

[PATCH linux-next 0/2] x86/xen TSC related cleanups

2023-02-20 Thread Krister Johansen
6/xen/time.c that was previously only numerically defined. Krister Johansen (2): xen: update arch/x86/include/asm/xen/cpuid.h x86/xen/time: cleanup xen_tsc_safe_clocksource arch/x86/include/asm/xen/cpuid.h | 22 ++ arch/x86/xen/time.c | 4 ++-- 2 files change

[PATCH linux-next 1/2] xen: update arch/x86/include/asm/xen/cpuid.h

2023-02-20 Thread Krister Johansen
Update arch/x86/include/asm/xen/cpuid.h from the Xen tree to get newest definitions. This picks up some TSC mode definitions and comment formatting changes. Signed-off-by: Krister Johansen --- arch/x86/include/asm/xen/cpuid.h | 22 ++ 1 file changed, 18 insertions(+), 4

[PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-20 Thread Krister Johansen
ff-by: Krister Johansen --- arch/x86/xen/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 95140609c8a8..cf6dd9f9fa6a 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -20,6 +20,7 @@ #include #include #in

Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-20 Thread Krister Johansen
On Mon, Feb 20, 2023 at 11:01:18PM +0100, Thomas Gleixner wrote: > On Mon, Feb 20 2023 at 09:17, Krister Johansen wrote: > > @@ -495,8 +496,7 @@ static int __init xen_tsc_safe_clocksource(void) > > /* Leaf 4, sub-leaf 0 (0x4x03) */ > > cpuid_count(xen_cpuid_base

Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-20 Thread Krister Johansen
On Mon, Feb 20, 2023 at 08:14:40PM -0800, Krister Johansen wrote: > On Mon, Feb 20, 2023 at 11:01:18PM +0100, Thomas Gleixner wrote: > > On Mon, Feb 20 2023 at 09:17, Krister Johansen wrote: > > > @@ -495,8 +496,7 @@ static int __init xen_tsc_safe_clocksource(void) > > &

Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-21 Thread Krister Johansen
On Tue, Feb 21, 2023 at 10:14:54AM +0100, Thomas Gleixner wrote: > On Mon, Feb 20 2023 at 21:51, Krister Johansen wrote: > > On Mon, Feb 20, 2023 at 08:14:40PM -0800, Krister Johansen wrote: > >> > static bool __init xen_tsc_safe_clocksource(void) > >> >

Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-21 Thread Krister Johansen
On Tue, Feb 21, 2023 at 09:47:24AM +0100, Juergen Gross wrote: > On 21.02.23 06:51, Krister Johansen wrote: > > On Mon, Feb 20, 2023 at 08:14:40PM -0800, Krister Johansen wrote: > > > On Mon, Feb 20, 2023 at 11:01:18PM +0100, Thomas Gleixner wrote: > > > > On Mon,

[PATCH linux-next v2 0/2] x86/xen TSC related cleanups

2023-02-22 Thread Krister Johansen
n x86/xen/time.c that was previously only numerically defined. Pedantic code from v1 is dropped in favor of a more appropriate return statement. Changes from v1: - Coding style fixup in arch/x86/xen/time.c (Feedback from Thomas Gleixner) Krister Johansen (2): xen: update arch/x86/include/as

[PATCH linux-next v2 1/2] xen: update arch/x86/include/asm/xen/cpuid.h

2023-02-22 Thread Krister Johansen
Update arch/x86/include/asm/xen/cpuid.h from the Xen tree to get newest definitions. This picks up some TSC mode definitions and comment formatting changes. Signed-off-by: Krister Johansen --- arch/x86/include/asm/xen/cpuid.h | 22 ++ 1 file changed, 18 insertions(+), 4

[PATCH linux-next v2 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-22 Thread Krister Johansen
ff-by: Krister Johansen --- arch/x86/xen/time.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 95140609c8a8..94056013a2a4 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -20,6 +20,7 @@ #include #in

Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

2023-02-23 Thread Krister Johansen
Hi Marcelo, On Thu, Feb 23, 2023 at 11:34:06AM -0300, Marcelo Tosatti wrote: > On Mon, Feb 20, 2023 at 08:14:40PM -0800, Krister Johansen wrote: > > On Mon, Feb 20, 2023 at 11:01:18PM +0100, Thomas Gleixner wrote: > > > On Mon, Feb 20 2023 at 09:17, Krister Johansen wrote: