[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 07/13] qemu-thread: call cpu_relax() while spinni
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 07/13] qemu-thread: call cpu_relax() while spinning |
Date: |
Thu, 7 Apr 2016 13:32:32 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/qemu/thread.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index 1aa843b..599965e 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -2,6 +2,7 @@
#define __QEMU_THREAD_H 1
#include <errno.h>
+#include "qemu/processor.h"
#include "qemu/atomic.h"
typedef struct QemuMutex QemuMutex;
@@ -74,7 +75,9 @@ static inline void qemu_spin_init(QemuSpin *spin)
static inline void qemu_spin_lock(QemuSpin *spin)
{
do {
- while (atomic_read(&spin->value));
+ while (atomic_read(&spin->value)) {
+ cpu_relax();
+ }
} while (atomic_xchg(&spin->value, true));
}
--
2.5.0
- Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock, (continued)
Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock, Richard Henderson, 2016/04/08
[Qemu-devel] [PATCH v2 10/13] tb hash: hash phys_pc, pc, and flags with xxhash, Emilio G. Cota, 2016/04/07
[Qemu-devel] [PATCH v2 02/13] compiler.h: add QEMU_ALIGNED() to enforce struct alignment, Emilio G. Cota, 2016/04/07
[Qemu-devel] [PATCH v2 08/13] qemu-thread: optimize spin_lock for uncontended locks, Emilio G. Cota, 2016/04/07
[Qemu-devel] [PATCH v2 07/13] qemu-thread: call cpu_relax() while spinning,
Emilio G. Cota <=
[Qemu-devel] [PATCH v2 03/13] seqlock: remove optional mutex, Emilio G. Cota, 2016/04/07
Re: [Qemu-devel] [PATCH v2 00/10] tb hash improvements, Alex Bennée, 2016/04/08
Message not available