From: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
To: Dave Hansen <dave.hansen@intel.com>, Borislav Petkov <bp@alien8.de>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>,
<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
<tony.luck@intel.com>, <linux-kernel@vger.kernel.org>,
<linux-edac@vger.kernel.org>, <CobeChen@zhaoxin.com>,
<TimGuo@zhaoxin.com>, <LeoLiu-oc@zhaoxin.com>,
"Lyle Li" <LyleLi@zhaoxin.com>
Subject: Re: [PATCH v1 1/3] x86/mce: Add centaur vendor to support Zhaoxin MCA
Date: Sat, 14 Sep 2024 17:36:39 +0800 [thread overview]
Message-ID: <64b1becd-ebf8-40ae-af5a-59d32b652362@zhaoxin.com> (raw)
In-Reply-To: <a25f878e-83d9-440a-9741-4cf86db4a716@intel.com>
On 2024/9/13 23:47, Dave Hansen wrote:
>
>
> [这封邮件来自外部发件人 谨防风险]
>
> On 9/13/24 07:27, Borislav Petkov wrote:
>>> + if (c->x86_vendor == X86_VENDOR_CENTAUR) {
>>> + /*
>>> + * All newer Centaur CPUs support MCE broadcasting. Enable
>>> + * synchronization with a one second timeout.
>>> + */
>>> + if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) ||
>>> + c->x86 > 6) {
>>> + if (cfg->monarch_timeout < 0)
>>> + cfg->monarch_timeout = USEC_PER_SEC;
>>> + }
>>> + }
>> So if centaur == zhaoxin, why aren't you moving this hunk to
>> mce_zhaoxin_feature_init() instead?
>
> The centaur and zhaoxin logic is also _really_ close here:
>
>> if (c->x86 > 6 || (c->x86_model == 0x19 || c->x86_model == 0x1f)) {
>> if (cfg->monarch_timeout < 0)
>> cfg->monarch_timeout = USEC_PER_SEC;
>> }
>
> vs
>
>> if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) ||
>> c->x86 > 6) {
>> if (cfg->monarch_timeout < 0)
>> cfg->monarch_timeout = USEC_PER_SEC;
>> }
>
> I'd just randomly guess that the zhaoxin version is buggy because it
> doesn't do a c->x86 check before the "(c->x86_model == 0x19 ||
> c->x86_model == 0x1f)".
>
Yes, the check for c->x86 == 6 is omitted in the zhaoxin version.
> So instead of copying and pasting the same block over and over, can we
> consolidate it a bit?
>
> foo()
> {
> /* Older CPUs do not do MCE broadcast: */
> if (c->x86 < 6)
> return;
> /* All newer ones do: */
> if (c->x86 > 6)
> goto mce_broadcast;
>
> /* Family 6 is mixed: */
> if (c->x86_vendor == X86_VENDOR_CENTAUR) {
> if (c->x86_model == 0xf &&
> c->x86_stepping >= 0xe)
> goto mce_broadcast;
> } else if (c->x86_vendor == X86_VENDOR_ZHAOXIN) {
> if (c->x86_model == 0x19 ||
> c->x86_model == 0x1f))
> goto mce_broadcast;
> }
>
> return;
>
> mce_broadcast:
> if (cfg->monarch_timeout < 0)
> cfg->monarch_timeout = USEC_PER_SEC;
> }
>
Thank you! That makes more sense, and will adopt it into zhaoxin.c
Sincerely!
TonyWWang-oc
next prev parent reply other threads:[~2024-09-14 10:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 10:43 [PATCH 0/3] x86/mce: Add Zhaoxin MCE support Tony W Wang-oc
2024-09-09 10:43 ` [PATCH v1 1/3] x86/mce: Add centaur vendor to support Zhaoxin MCA Tony W Wang-oc
2024-09-13 14:27 ` Borislav Petkov
2024-09-13 15:47 ` Dave Hansen
2024-09-14 9:36 ` Tony W Wang-oc [this message]
2024-09-14 9:36 ` Tony W Wang-oc
2024-09-13 14:28 ` Borislav Petkov
2024-09-09 10:43 ` [PATCH v1 2/3] x86/mce: Add zhaoxin.c " Tony W Wang-oc
2024-09-10 1:54 ` kernel test robot
2024-09-10 8:48 ` kernel test robot
2024-09-09 10:43 ` [PATCH v1 3/3] x86/mce: Add CMCI storm switching support for Zhaoxin Tony W Wang-oc
2024-09-10 5:53 ` kernel test robot
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=64b1becd-ebf8-40ae-af5a-59d32b652362@zhaoxin.com \
--to=tonywwang-oc@zhaoxin.com \
--cc=CobeChen@zhaoxin.com \
--cc=LeoLiu-oc@zhaoxin.com \
--cc=LyleLi@zhaoxin.com \
--cc=TimGuo@zhaoxin.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®