From 67cb6d16ffdb3d07b1a18e3977b1927cb5d531b2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 17 Mar 2018 19:19:23 -0400 Subject: [PATCH] membarrier: introduce qemu/sys_membarrier.h This new header file provides heavy-weight "global" memory barriers that enforce memory ordering on each running thread belonging to the current process. For now, use a dummy implementation that issues memory barriers on both sides (matching what QEMU has been doing so far). Backports commit c8d3877e48c4f57381d72eaf8d016bff12ce2d7c from qemu --- qemu/include/qemu/sys_membarrier.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 qemu/include/qemu/sys_membarrier.h diff --git a/qemu/include/qemu/sys_membarrier.h b/qemu/include/qemu/sys_membarrier.h new file mode 100644 index 00000000..9ce7f521 --- /dev/null +++ b/qemu/include/qemu/sys_membarrier.h @@ -0,0 +1,17 @@ +/* + * Process-global memory barriers + * + * Copyright (c) 2018 Red Hat, Inc. + * + * Author: Paolo Bonzini + */ + +#ifndef QEMU_SYS_MEMBARRIER_H +#define QEMU_SYS_MEMBARRIER_H 1 + +/* Keep it simple, execute a real memory barrier on both sides. */ +static inline void smp_mb_global_init(void) {} +#define smp_mb_global() smp_mb() +#define smp_mb_placeholder() smp_mb() + +#endif