From: Thomas Gleixner <tglx@linutronix.de>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
the arch/x86 maintainers <x86@kernel.org>,
jose.souza@intel.com, "H. Peter Anvin" <hpa@zytor.com>,
Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Linux PCI <linux-pci@vger.kernel.org>,
rudolph@fb.com, xapienz@fb.com, bmilton@fb.com,
"Paul E. McKenney" <paulmck@kernel.org>,
Stable <stable@vger.kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Feng Tang <feng.tang@intel.com>, Harry Pan <harry.pan@intel.com>
Subject: Re: [PATCH RFT] x86/hpet: Use another crystalball to evaluate HPET usability
Date: Thu, 30 Sep 2021 19:07:14 +0200 [thread overview]
Message-ID: <87h7e26lh9.ffs@tglx> (raw)
In-Reply-To: <CAJZ5v0hH_h9V0dACEMomqZbwpQUf6GB_8UK9+S1AGEdFQqvPLQ@mail.gmail.com>
On Thu, Sep 30 2021 at 13:38, Rafael J. Wysocki wrote:
>> +static bool __init get_mwait_substates(unsigned int *mwait_substates)
>> +{
>> + unsigned int eax, ebx, ecx;
>> +
>> + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
>> + return false;
>> +
>> + if (!boot_cpu_has(X86_FEATURE_MWAIT))
>> + return false;
>> +
>> + if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
>> + return false;
>> +
>> + cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, mwait_substates);
>> +
>> + if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
>> + !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ||
>> + !*mwait_substates)
>> + return false;
>
> I would do
>
> return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) && (ecx &
> CPUID5_ECX_INTERRUPT_BREAK) && *mwait_substates;
>
> And this function could just return the mwait_substates value proper,
> because returning 0 then would be equivalent to returning 'false' from
> it as is.
Let me move that substates check into the function which makes it even simpler.
Thanks,
tglx
next prev parent reply other threads:[~2021-09-30 17:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 2:46 [PATCH v2] x86/intel: Disable HPET on another Intel Coffee Lake platform Jakub Kicinski
2021-09-27 22:36 ` Krzysztof Wilczyński
2021-09-29 13:11 ` Jakub Kicinski
2021-09-29 16:05 ` Bjorn Helgaas
2021-09-30 9:08 ` Thomas Gleixner
2021-09-30 11:15 ` [PATCH RFT] x86/hpet: Use another crystalball to evaluate HPET usability Thomas Gleixner
2021-09-30 11:38 ` Rafael J. Wysocki
2021-09-30 17:07 ` Thomas Gleixner [this message]
2021-09-30 17:21 ` [PATCH RFT v2] " Thomas Gleixner
2021-09-30 17:50 ` Jakub Kicinski
2021-10-01 11:08 ` Rafael J. Wysocki
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=87h7e26lh9.ffs@tglx \
--to=tglx@linutronix.de \
--cc=bhelgaas@google.com \
--cc=bmilton@fb.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=feng.tang@intel.com \
--cc=harry.pan@intel.com \
--cc=helgaas@kernel.org \
--cc=hpa@zytor.com \
--cc=jose.souza@intel.com \
--cc=kai.heng.feng@canonical.com \
--cc=kuba@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=rafael@kernel.org \
--cc=rudolph@fb.com \
--cc=stable@vger.kernel.org \
--cc=x86@kernel.org \
--cc=xapienz@fb.com \
/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;
as well as URLs for NNTP newsgroup(s).