From: Chuck Ebbert <cebbert@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Hans Rosenfeld <hans.rosenfeld@amd.com>,
Boris Ostrovsky <ostr@amd64.org>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH] cpu, AMD: Fix another bug in the new errata checking code
Date: Thu, 12 May 2011 19:59:38 -0400 [thread overview]
Message-ID: <20110512195938.1728ab52@katamari> (raw)
Fix a bug that causes CPU hangs due to missing timer interrupts,
introduced by these three patches:
(1) commit d78d671db478eb8b14c78501c0cee1cc7baf6967
"x86, cpu: AMD errata checking framework"
(2) commit 9d8888c2a214aece2494a49e699a097c2ba9498b
"x86, cpu: Clean up AMD erratum 400 workaround"
(3) commit b87cf80af3ba4b4c008b4face3c68d604e1715c6
"x86, AMD: Set ARAT feature on AMD processors"
Patch (1) introduced a new framework that allowed checking for errata
using AMD's OSVW (OS visible workaround) feature combined with
explicit lists of models. It checked OSVW first, and completely
relied on that if it was present and usable.
Patch (2) switched the checking for erratum 400 to use the new
framework. But the original code checked for an explicit model range
first, then used OSVW if the CPU was not within that range. Patch (2)
also inexplicably added a second model range (for Family 10h) that
was never in the original code.
Then patch (3) used the new erratum 400 checks to decide whether
to enable the ARAT feature (always running APIC timer.) However,
this causes notebooks using the Sempron processor (Family 10h
Model 6 Stepping 2) to enable ARAT when they shouldn't because the
explicit check for that model gets skipped.
The fix is to check the model list first, then use OSVW if the CPU
is not in that list.
Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
---
NOTE: Untested, but this looks like the obvious fix.
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -723,6 +723,17 @@ bool cpu_has_amd_erratum(const int *erra
if (cpu->x86_vendor != X86_VENDOR_AMD)
return false;
+ /*
+ * Must match family-model-stepping range first so that the
+ * range checks will override OSVW checking.
+ */
+ ms = (cpu->x86_model << 4) | cpu->x86_mask;
+ while ((range = *erratum++))
+ if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
+ (ms >= AMD_MODEL_RANGE_START(range)) &&
+ (ms <= AMD_MODEL_RANGE_END(range)))
+ return true;
+
if (osvw_id >= 0 && osvw_id < 65536 &&
cpu_has(cpu, X86_FEATURE_OSVW)) {
u64 osvw_len;
@@ -737,15 +748,6 @@ bool cpu_has_amd_erratum(const int *erra
}
}
- /* OSVW unavailable or ID unknown, match family-model-stepping range */
- ms = (cpu->x86_model << 4) | cpu->x86_mask;
- while ((range = *erratum++))
- if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
- (ms >= AMD_MODEL_RANGE_START(range)) &&
- (ms <= AMD_MODEL_RANGE_END(range)))
- return true;
-
return false;
}
-
EXPORT_SYMBOL_GPL(cpu_has_amd_erratum);
_
next reply other threads:[~2011-05-13 0:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 23:59 Chuck Ebbert [this message]
2011-05-13 10:21 ` [PATCH] cpu, AMD: Fix another bug in the new errata checking code Hans Rosenfeld
2011-05-13 13:03 ` Boris Ostrovsky
2011-05-13 14:59 ` Chuck Ebbert
2011-05-13 15:19 ` Hans Rosenfeld
2011-05-16 12:43 ` Chuck Ebbert
2011-05-16 13:38 ` Boris Ostrovsky
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=20110512195938.1728ab52@katamari \
--to=cebbert@redhat.com \
--cc=borislav.petkov@amd.com \
--cc=hans.rosenfeld@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ostr@amd64.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