mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Krzysztof Piecuch <piecuch@protonmail.com>,
	Andy Lutomirski <luto@amacapital.net>
Cc: "corbet\@lwn.net" <corbet@lwn.net>,
	"mingo\@redhat.com" <mingo@redhat.com>,
	"bp\@alien8.de" <bp@alien8.de>, "hpa\@zytor.com" <hpa@zytor.com>,
	"x86\@kernel.org" <x86@kernel.org>,
	"mchehab+samsung\@kernel.org" <mchehab+samsung@kernel.org>,
	"jpoimboe\@redhat.com" <jpoimboe@redhat.com>,
	"gregkh\@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"pawan.kumar.gupta\@linux.intel.com" 
	<pawan.kumar.gupta@linux.intel.com>,
	"paulmck\@linux.ibm.com" <paulmck@linux.ibm.com>,
	"jgross\@suse.com" <jgross@suse.com>,
	"rafael.j.wysocki\@intel.com" <rafael.j.wysocki@intel.com>,
	"viresh.kumar\@linaro.org" <viresh.kumar@linaro.org>,
	"drake\@endlessm.com" <drake@endlessm.com>,
	"malat\@debian.org" <malat@debian.org>,
	"mzhivich\@akamai.com" <mzhivich@akamai.com>,
	"juri.lelli\@redhat.com" <juri.lelli@redhat.com>,
	"linux-doc\@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/tsc: Add tsc_tuned_baseclk flag disabling CPUID.16h use for tsc calibration
Date: Mon, 20 Jan 2020 14:42:22 +0100	[thread overview]
Message-ID: <871rru4535.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <pdsz0EbsOFH8qmBn1Uv20EOOr71rKXljZIItC75EhT9KO4TKEKrt83Es88ZeaAh3MYuk0UM8F6XKfvmmRHgZjF50CXk9sigWEH_SyXp6lZE=@protonmail.com>

Krzysztof,

Krzysztof Piecuch <piecuch@protonmail.com> writes:
> On Friday, January 17, 2020 4:37 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> Wouldn’t it be better to have an option tsc_max_refinement= to increase the 1%?
>
> All that is in the commends about it say that:
>
>  * If there are any calibration anomalies (too many SMIs, etc),
>  * or the refined calibration is off by 1% of the fast early
>  * calibration, we throw out the new calibration and use the
>  * early calibration.
>
> I still don't fully understand why the "1% rule" exists.

Simply because all of this is horribly fragile and if you put virt into
the picture it gets even worse.

The initial calibration via PIT/HPET is halfways accurate in most cases
and we use the 1% as a sanity check.

> Ideally it would be better to get the early calibration right than
> risk getting it wrong because of an "anomaly".

Ideally we would just have a way to read the stupid frequency from some
reliable place, but there is no such thing.

Guess why we have all this code, surely not because we have nothing
better to do than dreaming up a variety of weird ways to figure out that
frequency.

> OTOH if you system doesn't support any of the early calibration
> methods other than CPUID.16h (mine doesn't support either PIT or MSR)
> "tsc_max_refinement" would allow you to control max tsc_hz error.

Widening the error window here is clearly a hack. As you have to supply
a valid number there, then why not just providing the frequency itself
on the command line? That would at least make most sense and would avoid
to use completely wrong data in the early boot stage.

Thanks,

        tglx

  reply	other threads:[~2020-01-20 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 15:13 Krzysztof Piecuch
2020-01-17 16:37 ` Andy Lutomirski
2020-01-20 11:15   ` Krzysztof Piecuch
2020-01-20 13:42     ` Thomas Gleixner [this message]
2020-01-20 14:20       ` Krzysztof Piecuch

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=871rru4535.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=drake@endlessm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@redhat.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=malat@debian.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mzhivich@akamai.com \
    --cc=paulmck@linux.ibm.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=piecuch@protonmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=viresh.kumar@linaro.org \
    --cc=x86@kernel.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®