From: Thomas Gleixner <tglx@linutronix.de>
To: zhenwei pi <pizhenwei@bytedance.com>, pbonzini@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
x86@kernel.org, zhenwei pi <pizhenwei@bytedance.com>
Subject: Re: [PATCH 1/2] x86/cpu: introduce x86_get_freq
Date: Tue, 30 Nov 2021 22:36:43 +0100 [thread overview]
Message-ID: <87lf15ba1g.ffs@tglx> (raw)
In-Reply-To: <20211129052038.43758-1-pizhenwei@bytedance.com>
On Mon, Nov 29 2021 at 13:20, zhenwei pi wrote:
> Wrapper function x86_get_freq to get freq on a x86 platform, hide
> detailed implementation for proc routine.
Please rename this to x86_get_cpufreq_khz() simply because
x86_get_freq() is way too unspecific.
Please mention function names with 'function()' which makes it obvious
what it is. Here and in the Subject.
Also spell out frequency all over the place in the change log. There is
no reason for using abbreviations in text.
> +
> +unsigned int x86_get_freq(unsigned int cpu)
> +{
> + unsigned int freq = 0;
> +
> + if (cpu_has(&cpu_data(cpu), X86_FEATURE_TSC)) {
Please use cpu_feature_enabled(X86....) and make this condition
negated:
if (!cpu_feature_enabled(X86_FEATURE_TSC))
return 0;
which spares an indentation level and the 0 initialization of the variable.
Thanks,
tglx
prev parent reply other threads:[~2021-11-30 21:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 5:20 [PATCH 1/2] x86/cpu: introduce x86_get_freq zhenwei pi
2021-11-29 5:20 ` [PATCH 2/2] KVM: x86: use x86_get_freq to get freq for kvmclock zhenwei pi
2021-11-30 21:36 ` Thomas Gleixner [this message]
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=87lf15ba1g.ffs@tglx \
--to=tglx@linutronix.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pizhenwei@bytedance.com \
--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