[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/15] seqlock: remove optional mutex
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 02/15] seqlock: remove optional mutex |
Date: |
Fri, 10 Jun 2016 07:26:40 -0700 |
From: "Emilio G. Cota" <address@hidden>
This option is unused; besides, it bloats the struct when not needed.
Let's just let writers define their own locks elsewhere.
Reviewed-by: Sergey Fedorov <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
cpus.c | 2 +-
include/qemu/seqlock.h | 10 +---------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/cpus.c b/cpus.c
index 326742f..1c92362 100644
--- a/cpus.c
+++ b/cpus.c
@@ -621,7 +621,7 @@ int cpu_throttle_get_percentage(void)
void cpu_ticks_init(void)
{
- seqlock_init(&timers_state.vm_clock_seqlock, NULL);
+ seqlock_init(&timers_state.vm_clock_seqlock);
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
throttle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT,
cpu_throttle_timer_tick, NULL);
diff --git a/include/qemu/seqlock.h b/include/qemu/seqlock.h
index 70b01fd..e673482 100644
--- a/include/qemu/seqlock.h
+++ b/include/qemu/seqlock.h
@@ -19,22 +19,17 @@
typedef struct QemuSeqLock QemuSeqLock;
struct QemuSeqLock {
- QemuMutex *mutex;
unsigned sequence;
};
-static inline void seqlock_init(QemuSeqLock *sl, QemuMutex *mutex)
+static inline void seqlock_init(QemuSeqLock *sl)
{
- sl->mutex = mutex;
sl->sequence = 0;
}
/* Lock out other writers and update the count. */
static inline void seqlock_write_lock(QemuSeqLock *sl)
{
- if (sl->mutex) {
- qemu_mutex_lock(sl->mutex);
- }
++sl->sequence;
/* Write sequence before updating other fields. */
@@ -47,9 +42,6 @@ static inline void seqlock_write_unlock(QemuSeqLock *sl)
smp_wmb();
++sl->sequence;
- if (sl->mutex) {
- qemu_mutex_unlock(sl->mutex);
- }
}
static inline unsigned seqlock_read_begin(QemuSeqLock *sl)
--
2.5.5
- [Qemu-devel] [PULL 00/15] tb hash improvements, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 03/15] seqlock: rename write_lock/unlock to write_begin/end, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 02/15] seqlock: remove optional mutex,
Richard Henderson <=
- [Qemu-devel] [PULL 07/15] tb hash: hash phys_pc, pc, and flags with xxhash, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 04/15] include/processor.h: define cpu_relax(), Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 05/15] qemu-thread: add simple test-and-set spinlock, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 06/15] exec: add tb_hash_func5, derived from xxhash, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 01/15] compiler.h: add QEMU_ALIGNED() to enforce struct alignment, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 09/15] qdist: add test program, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 13/15] qht: add test-qht-par to invoke qht-bench from 'check' target, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 12/15] qht: add qht-bench, a performance benchmark, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 15/15] translate-all: add tb hash bucket info to 'info jit' dump, Richard Henderson, 2016/06/10
- [Qemu-devel] [PULL 14/15] tb hash: track translated blocks with qht, Richard Henderson, 2016/06/10