All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Resolving inconsistency with Intel processor manual
@ 2011-11-11 13:01 Ajaykumar Hotchandani
  2011-12-05 17:45 ` [tip:x86/urgent] x86/mtrr: Resolve " tip-bot for Ajaykumar Hotchandani
  0 siblings, 1 reply; 2+ messages in thread
From: Ajaykumar Hotchandani @ 2011-11-11 13:01 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Lucas De Marchi, linux-kernel

Following is from Notes of section 11.5.3 of Intel processor manual
available at http://www.intel.com/Assets/PDF/manual/325384.pdf:
For the Pentium 4 and Intel Xeon processors, after the sequence of
steps given above has been executed, the cache lines containing the
code between the end of the WBINVD instruction and before the
MTRRS have actually been disabled may be retained in the cache
hierarchy. Here, to remove code from the cache completely, a second
WBINVD instruction must be executed after the MTRRs have been
disabled.

This patch provides resolution for that.
Ideally, I will like to make changes only for Pentium 4 and Xeon processors.
But, I am not finding easier way to do it.
And, extra wbinvd() instruction does not hurt much for other processors.

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
---
  arch/x86/kernel/cpu/mtrr/generic.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/generic.c 
b/arch/x86/kernel/cpu/mtrr/generic.c
index a71efcdb..4cd9919 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -693,6 +693,7 @@ static void prepare_set(void) 
__acquires(set_atomicity_lock)

         /* Disable MTRRs, and set the default type to uncached */
         mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi);
+       wbinvd();
  }

  static void post_set(void) __releases(set_atomicity_lock)
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/urgent] x86/mtrr: Resolve inconsistency with Intel processor manual
  2011-11-11 13:01 [PATCH] x86: Resolving inconsistency with Intel processor manual Ajaykumar Hotchandani
@ 2011-12-05 17:45 ` tip-bot for Ajaykumar Hotchandani
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Ajaykumar Hotchandani @ 2011-12-05 17:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, torvalds, ajaykumar.hotchandani,
	lucas.demarchi, tglx, mingo

Commit-ID:  8dbf4a30033ff61091015f0076e872b5c8f717cc
Gitweb:     http://git.kernel.org/tip/8dbf4a30033ff61091015f0076e872b5c8f717cc
Author:     Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
AuthorDate: Fri, 11 Nov 2011 18:31:57 +0530
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 5 Dec 2011 15:06:15 +0100

x86/mtrr: Resolve inconsistency with Intel processor manual

Following is from Notes of section 11.5.3 of Intel processor
manual available at:

  http://www.intel.com/Assets/PDF/manual/325384.pdf

For the Pentium 4 and Intel Xeon processors, after the sequence of
steps given above has been executed, the cache lines containing the
code between the end of the WBINVD instruction and before the
MTRRS have actually been disabled may be retained in the cache
hierarchy. Here, to remove code from the cache completely, a
second WBINVD instruction must be executed after the MTRRs have
been disabled.

This patch provides resolution for that.

Ideally, I will like to make changes only for Pentium 4 and Xeon
processors. But, I am not finding easier way to do it.
And, extra wbinvd() instruction does not hurt much for other
processors.

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Link: http://lkml.kernel.org/r/4EBD1CC5.3030008@oracle.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/mtrr/generic.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index e1fe7f4..97b2635 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -694,6 +694,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
 
 	/* Disable MTRRs, and set the default type to uncached */
 	mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi);
+	wbinvd();
 }
 
 static void post_set(void) __releases(set_atomicity_lock)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-05 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-11 13:01 [PATCH] x86: Resolving inconsistency with Intel processor manual Ajaykumar Hotchandani
2011-12-05 17:45 ` [tip:x86/urgent] x86/mtrr: Resolve " tip-bot for Ajaykumar Hotchandani

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.