From: Krister Johansen <kjlx@templeofstupid.com>
To: Juergen Gross <jgross@suse.com>
Cc: Krister Johansen <kjlx@templeofstupid.com>,
Thomas Gleixner <tglx@linutronix.de>,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
Jan Beulich <jbeulich@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
David Reaver <me@davidreaver.com>,
Brendan Gregg <brendan@intel.com>
Subject: Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource
Date: Tue, 21 Feb 2023 09:22:00 -0800 [thread overview]
Message-ID: <20230221172200.GB1958@templeofstupid.com> (raw)
In-Reply-To: <cd9acc63-c352-93c8-56bf-52ef69e5e124@suse.com>
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, 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 (0x40000x03) */
> > > > > cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);
> > > > > - /* tsc_mode = no_emulate (2) */
> > > > > - if (ebx != 2)
> > > > > + if (ebx != XEN_CPUID_TSC_MODE_NEVER_EMULATE)
> > > > > return 0;
> > > > > return 1;
> > > >
> > > > What about removing more stupidity from that function?
> > > >
> > > > static bool __init xen_tsc_safe_clocksource(void)
> > > > {
> > > > u32 eax, ebx. ecx, edx;
> > > > /* Leaf 4, sub-leaf 0 (0x40000x03) */
> > > > cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);
> > > >
> > > > return ebx == XEN_CPUID_TSC_MODE_NEVER_EMULATE;
> > > > }
> > >
> > > I'm all for simplifying. I'm happy to clean up that return to be more
> > > idiomatic. I was under the impression, perhaps mistaken, though, that
> > > the X86_FEATURE_CONSTANT_TSC, X86_FEATURE_NONSTOP_TSC, and
> > > check_tsc_unstable() checks were actually serving a purpose: to ensure
> > > that we don't rely on the tsc in environments where it's being emulated
> > > and the OS would be better served by using a PV clock. Specifically,
> > > kvmclock_init() makes a very similar set of checks that I also thought
> > > were load-bearing.
> >
> > Bah, what I meant to say was emulated, unstable, or otherwise unsuitable
> > for use as a clocksource. IOW, even if TSC_MODE_NEVER_EMULATE is
> > set, it's possible that a user is attempting a migration from a cpu
> > that's not invariant, and we'd still want to check for that case and
> > fall back to a PV clocksource, correct?
>
> But Thomas' suggestion wasn't changing any behavior compared to your
> patch. It just makes it easier to read.
>
> If you are unsure your patch is correct, please verify the correctness
> before sending it.
Thanks, and apologies. I misunderstood and thought a more complex change
was requested.
-K
next prev parent reply other threads:[~2023-02-21 17:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 17:16 [PATCH linux-next 0/2] x86/xen TSC related cleanups Krister Johansen
2023-02-20 17:16 ` [PATCH linux-next 1/2] xen: update arch/x86/include/asm/xen/cpuid.h Krister Johansen
2023-02-20 17:17 ` [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource Krister Johansen
2023-02-20 22:01 ` Thomas Gleixner
2023-02-21 4:14 ` Krister Johansen
2023-02-21 5:51 ` Krister Johansen
2023-02-21 8:47 ` Juergen Gross
2023-02-21 17:22 ` Krister Johansen [this message]
2023-02-21 9:14 ` Thomas Gleixner
2023-02-21 17:21 ` Krister Johansen
2023-02-23 14:34 ` Marcelo Tosatti
2023-02-23 17:18 ` Krister Johansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230221172200.GB1958@templeofstupid.com \
--to=kjlx@templeofstupid.com \
--cc=aliguori@amazon.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=brendan@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=me@davidreaver.com \
--cc=mingo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®