From: Ingo Molnar <mingo@kernel.org>
To: Daniel Drake <drake@endlessm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
hpa@zytor.com, x86@kernel.org,
Linux Kernel <linux-kernel@vger.kernel.org>,
Len Brown <len.brown@intel.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
Linux Upstreaming Team <linux@endlessm.com>
Subject: Re: [PATCH 2/2] x86/tsc: set LAPIC timer frequency to crystal clock frequency
Date: Tue, 23 Apr 2019 12:30:34 +0200 [thread overview]
Message-ID: <20190423103034.GA8216@gmail.com> (raw)
In-Reply-To: <CAD8Lp44ZaifPf+809BzbLg=9ijsRsE=7JMVpXkqRenY9radpZA@mail.gmail.com>
* Daniel Drake <drake@endlessm.com> wrote:
> On Mon, Apr 22, 2019 at 8:04 PM Ingo Molnar <mingo@kernel.org> wrote:
> > Minor style nit: the parentheses are unnecessary, integer expressions
> > like this are evaluated left to right and multiplication and division has
> > the same precedence.
>
> Fair point, although the same could be said for cpu_khz_from_msr().
Yes, this standardization on mhz, if it makes sense, might have to be
propagated a bit to function names and any other variables.
Another naming quirk: what unit is 'lapic_timer_frequency' in? AFAICS
it's a "period" unit (number of clock cycles per jiffy), not a frequency
(which is number of cycles per second) - so the better name might be
lapic_timer_period?
> > But it might also make sense to actually store crystal_mhz instead of
> > crystal_khz, because both CPUID 15H and 16H provides MHz values.
> >
> > That way the above expression would simplify to:
> >
> > lapic_timer_frequency = crystal_mhz / HZ;
>
> Wouldn't it be
> lapic_timer_frequency = crystal_mhz * 1000000 / HZ;
> ?
Sorry, what I wanted to suggest is crystal_hz, not crystal_mhz.
I.e. store the raw unit that comes out of the CPUID, which appears to be
HZ, right?
That would change the calculation to:
lapic_timer_period = crystal_hz / HZ;
Note how clearly it's visible in that calculation that what we calculate
there is a 'period', not a frequency.
Thanks,
Ingo
next prev parent reply other threads:[~2019-04-23 10:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 10:15 [PATCH 1/2] x86/tsc: use CPUID.0x16 to calculate missing crystal frequency Daniel Drake
2019-04-22 10:15 ` [PATCH 2/2] x86/tsc: set LAPIC timer frequency to crystal clock frequency Daniel Drake
2019-04-22 12:04 ` Ingo Molnar
2019-04-23 3:06 ` Daniel Drake
2019-04-23 10:30 ` Ingo Molnar [this message]
2019-04-23 9:08 ` [PATCH 1/2] x86/tsc: use CPUID.0x16 to calculate missing crystal frequency Peter Zijlstra
2019-04-24 5:53 ` Daniel Drake
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=20190423103034.GA8216@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=drake@endlessm.com \
--cc=hpa@zytor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@endlessm.com \
--cc=mingo@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.