From: Petr Tesarik <ptesarik@suse.com>
To: Thorsten Blum <blum@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Hans Peter Anvin <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Juergen Gross <jgross@suse.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Petr Tesarik <ptesarik@suse.com>
Subject: [PATCH v2 0/3] x86/tsc: Remove some magic constants
Date: Wed, 14 Oct 2026 15:29:29 +0200 [thread overview]
Message-ID: <20261014132932.1495303-1-ptesarik@suse.com> (raw)
The TSC code is full of various magic constants, making it difficult to
understand the calculations. This patch series tries to document their
actual meaning.
No functional change intended, but the code is not bit-for-bit
identical; some 32-bit multiplications are converted into 64-bit
multiplications, because HZ_PER_KHZ is an unsigned long. If anything,
this should reduce the risk of arithmetic overflow.
Changes from v1:
- Use TICK_NSEC instead of (NSEC_PER_SEC / HZ)
- Use HZ_PER_KHZ and KHZ_PER_MHZ from <linux/units.h>
Petr Tesarik (3):
x86/tsc: Replace magic constants with xxx_PER_SEC
x86/tsc: Use HZ_PER_KHZ and KHZ_PER_MHZ
x86/tsc: Use TSC_CALIBRATE_MULT for the TSC multiplier
arch/x86/kernel/tsc.c | 54 +++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 27 deletions(-)
--
2.55.0
next reply other threads:[~2026-10-14 13:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 13:29 Petr Tesarik [this message]
2026-10-14 13:29 ` [PATCH v2 1/3] x86/tsc: Replace magic constants with xxx_PER_SEC Petr Tesarik
2026-10-14 13:29 ` [PATCH v2 2/3] x86/tsc: Use HZ_PER_KHZ and KHZ_PER_MHZ Petr Tesarik
2026-10-14 13:29 ` [PATCH v2 3/3] x86/tsc: Use TSC_CALIBRATE_MULT for the TSC multiplier Petr Tesarik
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=20261014132932.1495303-1-ptesarik@suse.com \
--to=ptesarik@suse.com \
--cc=blum@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@kernel.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®