All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm tool: Add own barrier() definition
@ 2012-05-08  9:52 Cyrill Gorcunov
  2012-05-08 12:31 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2012-05-08  9:52 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Ingo Molnar, Asias He, Sasha Levin, KVM-ML

Otherwise I'm getting the following compile
problem on my Fedora machine. The helper is
rather taken from linux kernel.

 | [cyrill@moon kvm]$ make tags
 | x86/include/kvm/barrier.h:11:25: fatal error: asm/barrier.h: No such file or directory compilation terminated.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
---
 tools/kvm/x86/include/kvm/barrier.h |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Index: linux-2.6.git/tools/kvm/x86/include/kvm/barrier.h
===================================================================
--- linux-2.6.git.orig/tools/kvm/x86/include/kvm/barrier.h
+++ linux-2.6.git/tools/kvm/x86/include/kvm/barrier.h
@@ -1,13 +1,20 @@
 #ifndef _KVM_BARRIER_H_
 #define _KVM_BARRIER_H_
 
-/*
- * asm/system.h cannot be #included standalone on 32-bit x86 yet.
- *
- * Provide the dependencies here - we can drop these wrappers once
- * the header is fixed upstream:
- */
+#define barrier() asm volatile("": : :"memory")
 
-#include <asm/barrier.h>
+#define mb()	asm volatile ("mfence": : :"memory")
+#define rmb()	asm volatile ("lfence": : :"memory")
+#define wmb()	asm volatile ("sfence": : :"memory")
+
+#ifdef CONFIG_SMP
+#define smp_mb()	mb()
+#define smp_rmb()	rmb()
+#define smp_wmb()	wmb()
+#else
+#define smp_mb()	barrier()
+#define smp_rmb()	barrier()
+#define smp_wmb()	barrier()
+#endif
 
 #endif /* _KVM_BARRIER_H_ */

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

* Re: [PATCH] kvm tool: Add own barrier() definition
  2012-05-08  9:52 [PATCH] kvm tool: Add own barrier() definition Cyrill Gorcunov
@ 2012-05-08 12:31 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2012-05-08 12:31 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Ingo Molnar, Asias He, Sasha Levin, KVM-ML

On Tue, 8 May 2012, Cyrill Gorcunov wrote:
> Otherwise I'm getting the following compile
> problem on my Fedora machine. The helper is
> rather taken from linux kernel.
> 
>  | [cyrill@moon kvm]$ make tags
>  | x86/include/kvm/barrier.h:11:25: fatal error: asm/barrier.h: No such file or directory compilation terminated.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> Acked-by: Ingo Molnar <mingo@kernel.org>

Applied, thanks!

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

end of thread, other threads:[~2012-05-08 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-08  9:52 [PATCH] kvm tool: Add own barrier() definition Cyrill Gorcunov
2012-05-08 12:31 ` Pekka Enberg

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.