mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH] x86: add memory clobber in switch_to()
@ 2008-09-14 17:03 Vegard Nossum
  2008-09-15  7:54 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Vegard Nossum @ 2008-09-14 17:03 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel

There are more places which have segment register reloads without
adding memory clobbers. Should we fix them up? Here's one of them:

>From 5f135687f7730fbdd979b6fb408fd3ca08a0a678 Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Sun, 14 Sep 2008 18:53:22 +0200
Subject: [PATCH] x86: add memory clobber in switch_to()

Segment registers are reloaded, so we should add a memory clobber. The
generated assembly code is identical in my tests, but this doesn't mean
it is necessarily true for all configurations/compilers.

x86_64 already has the memory clobber.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 include/asm-x86/system.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
index 983ce37..fed6482 100644
--- a/include/asm-x86/system.h
+++ b/include/asm-x86/system.h
@@ -64,7 +64,10 @@ do {									\
 		       							\
 		       /* regparm parameters for __switch_to(): */	\
 		       [prev]     "a" (prev),				\
-		       [next]     "d" (next));				\
+		       [next]     "d" (next)				\
+									\
+		     : /* reloaded segment registers */			\
+			"memory");					\
 } while (0)
 
 /*
-- 
1.5.5.1


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

* Re: [RFC][PATCH] x86: add memory clobber in switch_to()
  2008-09-14 17:03 [RFC][PATCH] x86: add memory clobber in switch_to() Vegard Nossum
@ 2008-09-15  7:54 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-09-15  7:54 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: x86, linux-kernel, Jeremy Fitzhardinge


* Vegard Nossum <vegard.nossum@gmail.com> wrote:

> There are more places which have segment register reloads without 
> adding memory clobbers. Should we fix them up? Here's one of them:

yes, i think so.

> >From 5f135687f7730fbdd979b6fb408fd3ca08a0a678 Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Sun, 14 Sep 2008 18:53:22 +0200
> Subject: [PATCH] x86: add memory clobber in switch_to()
> 
> Segment registers are reloaded, so we should add a memory clobber. The 
> generated assembly code is identical in my tests, but this doesn't 
> mean it is necessarily true for all configurations/compilers.

applied to tip/x86/core, thanks Vegard.

	Ingo

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

end of thread, other threads:[~2008-09-15  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-14 17:03 [RFC][PATCH] x86: add memory clobber in switch_to() Vegard Nossum
2008-09-15  7:54 ` Ingo Molnar

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®