From: Peter Zijlstra <peterz@infradead.org>
To: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, lenb@kernel.org,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
dave.hansen@linux.intel.com, bp@alien8.de, tglx@linutronix.de,
andi@lisas.de, puwen@hygon.cn, mario.limonciello@amd.com,
rui.zhang@intel.com, gpiccoli@igalia.com,
daniel.lezcano@linaro.org, ananth.narayan@amd.com,
gautham.shenoy@amd.com, Calvin Ong <calvin.ong@amd.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] x86,acpi: Limit "Dummy wait" workaround to older AMD and Intel processors
Date: Mon, 26 Sep 2022 14:07:56 +0200 [thread overview]
Message-ID: <YzGWHMIsD7RBhEP+@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220923153801.9167-1-kprateek.nayak@amd.com>
On Fri, Sep 23, 2022 at 09:08:01PM +0530, K Prateek Nayak wrote:
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index ef4775c6db01..fcd3617ed315 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -460,5 +460,6 @@
> #define X86_BUG_MMIO_UNKNOWN X86_BUG(26) /* CPU is too old and its MMIO Stale Data status is unknown */
> #define X86_BUG_RETBLEED X86_BUG(27) /* CPU is affected by RETBleed */
> #define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */
> +#define X86_BUG_STPCLK X86_BUG(29) /* STPCLK# signal does not get asserted in time during IOPORT based C-state entry */
>
> #endif /* _ASM_X86_CPUFEATURES_H */
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 48276c0e479d..8cb5887a53a3 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -988,6 +988,18 @@ static void init_amd(struct cpuinfo_x86 *c)
> if (!cpu_has(c, X86_FEATURE_XENPV))
> set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
>
> + /*
> + * CPUs based on the Zen microarchitecture (Fam 17h onward) can
> + * guarantee that STPCLK# signal is asserted in time after the
> + * P_LVL2 read to freeze execution after an IOPORT based C-state
> + * entry. Among the older AMD processors, there has been at least
> + * one report of an AMD Athlon processor on a VIA chipset
> + * (circa 2006) having this issue. Mark all these older AMD
> + * processor families as being affected.
> + */
> + if (c->x86 < 0x17)
> + set_cpu_bug(c, X86_BUG_STPCLK);
> +
> /*
> * Turn on the Instructions Retired free counter on machines not
> * susceptible to erratum #1054 "Instructions Retired Performance
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index 2d7ea5480ec3..96fe1320c238 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -696,6 +696,18 @@ static void init_intel(struct cpuinfo_x86 *c)
> ((c->x86_model == INTEL_FAM6_ATOM_GOLDMONT)))
> set_cpu_bug(c, X86_BUG_MONITOR);
>
> + /*
> + * Intel chipsets prior to Nehalem used the ACPI processor_idle
> + * driver for C-state management. Some of these processors that
> + * used IOPORT based C-states could not guarantee that STPCLK#
> + * signal gets asserted in time after P_LVL2 read to freeze
> + * execution properly. Since a clear cut-off point is not known
> + * as to when this bug was solved, mark all the chipsets as
> + * being affected. Only the ones that use IOPORT based C-state
> + * transitions via the acpi_idle driver will be impacted.
> + */
> + set_cpu_bug(c, X86_BUG_STPCLK);
> +
> #ifdef CONFIG_X86_64
> if (c->x86 == 15)
> c->x86_cache_alignment = c->x86_clflush_size * 2;
Quiz time:
#define X86_VENDOR_INTEL 0
#define X86_VENDOR_CYRIX 1
#define X86_VENDOR_AMD 2
#define X86_VENDOR_UMC 3
#define X86_VENDOR_CENTAUR 5
#define X86_VENDOR_TRANSMETA 7
#define X86_VENDOR_NSC 8
#define X86_VENDOR_HYGON 9
#define X86_VENDOR_ZHAOXIN 10
#define X86_VENDOR_VORTEX 11
#define X86_VENDOR_NUM 12
#define X86_VENDOR_UNKNOWN 0xff
For how many of the above have you changed behaviour?
Not to mention that this is the gazillion-th time AMD has failed to
change HYGON in lock-step. That's Zen too -- deal with it.
next prev parent reply other threads:[~2022-09-26 13:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 15:38 [PATCH v2] x86,acpi: Limit "Dummy wait" workaround to older AMD and Intel processors K Prateek Nayak
2022-09-23 15:46 ` Borislav Petkov
2022-09-23 16:25 ` K Prateek Nayak
2022-09-23 16:30 ` Borislav Petkov
2022-09-23 16:52 ` K Prateek Nayak
2022-09-26 8:19 ` David Laight
2022-09-26 12:07 ` Peter Zijlstra [this message]
2022-09-26 16:32 ` K Prateek Nayak
2022-09-26 19:55 ` Andreas Mohr
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=YzGWHMIsD7RBhEP+@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ananth.narayan@amd.com \
--cc=andi@lisas.de \
--cc=bp@alien8.de \
--cc=calvin.ong@amd.com \
--cc=daniel.lezcano@linaro.org \
--cc=dave.hansen@linux.intel.com \
--cc=gautham.shenoy@amd.com \
--cc=gpiccoli@igalia.com \
--cc=kprateek.nayak@amd.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=puwen@hygon.cn \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/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