From: Vegard Nossum <vegard.nossum@gmail.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Ingo Molnar <mingo@elte.hu>, Pekka Enberg <penberg@cs.helsinki.fi>
Subject: [PATCH] kmemcheck: disable fast string operations on P4 CPUs
Date: Sat, 21 Feb 2009 14:36:01 +0100 [thread overview]
Message-ID: <1235223364-2097-2-git-send-email-vegard.nossum@gmail.com> (raw)
In-Reply-To: <1235223364-2097-1-git-send-email-vegard.nossum@gmail.com>
This patch may allow us to remove the REP emulation code from
kmemcheck.
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
arch/x86/kernel/cpu/intel.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 1f137a8..65e9717 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -75,6 +75,29 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
*/
if (c->x86 == 6 && c->x86_model < 15)
clear_cpu_cap(c, X86_FEATURE_PAT);
+
+#ifdef CONFIG_KMEMCHECK
+ /*
+ * P4s have a "fast strings" feature which causes single-
+ * stepping REP instructions to only generate a #DB on
+ * cache-line boundaries.
+ *
+ * Ingo Molnar reported a Pentium D (model 6) and a Xeon
+ * (model 2) with the same problem.
+ */
+ if (c->x86 == 15) {
+ u64 misc_enable;
+
+ rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+
+ if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) {
+ printk(KERN_INFO "kmemcheck: Disabling fast string operations\n");
+
+ misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
+ wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+ }
+ }
+#endif
}
#ifdef CONFIG_X86_32
--
1.6.0.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-02-21 13:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-21 13:36 Vegard Nossum
2009-02-21 13:36 ` Vegard Nossum [this message]
2009-02-21 16:21 ` [PATCH] kmemcheck: disable fast string operations on P4 CPUs Pekka Enberg
2009-02-22 3:13 ` H. Peter Anvin
2009-02-22 10:51 ` Vegard Nossum
2009-02-21 13:36 ` [PATCH] kmemcheck: rip out REP instruction emulation Vegard Nossum
2009-02-21 16:21 ` Pekka Enberg
2009-02-21 13:36 ` [PATCH] kmemcheck: add hooks for page- and sg-dma-mappings Vegard Nossum
2009-02-21 16:22 ` Pekka Enberg
2009-02-21 17:13 ` Vegard Nossum
2009-02-21 17:15 ` Pekka Enberg
2009-02-21 13:36 ` [PATCH] kmemcheck: add hooks for the page allocator Vegard Nossum
2009-02-21 15:23 ` Ingo Molnar
2009-02-21 16:34 ` Pekka Enberg
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=1235223364-2097-2-git-send-email-vegard.nossum@gmail.com \
--to=vegard.nossum@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
/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