aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUmesh Deshpande <udeshpan@redhat.com>2011-08-17 00:01:33 -0700
committerJuan Quintela <quintela@redhat.com>2012-12-20 23:08:47 +0100
commitb2a8658ef5dc57ea9e7a45091724a719dd4bdcd3 (patch)
tree0ec9f7220ae6bc55adaca771b7ac0f144dd14e7f /include
parentf798b07f517143df3a1e38bccc3f72ade2f080dc (diff)
downloadqemu-b2a8658ef5dc57ea9e7a45091724a719dd4bdcd3.zip
qemu-b2a8658ef5dc57ea9e7a45091724a719dd4bdcd3.tar.gz
qemu-b2a8658ef5dc57ea9e7a45091724a719dd4bdcd3.tar.bz2
protect the ramlist with a separate mutex
Add the new mutex that protects shared state between ram_save_live and the iothread. If the iothread mutex has to be taken together with the ramlist mutex, the iothread shall always be _outside_. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/exec/cpu-all.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index f052b38..439e88d 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -22,6 +22,7 @@
#include "qemu-common.h"
#include "qemu/tls.h"
#include "exec/cpu-common.h"
+#include "qemu/thread.h"
/* some important defines:
*
@@ -487,6 +488,9 @@ typedef struct RAMBlock {
ram_addr_t length;
uint32_t flags;
char idstr[256];
+ /* Reads can take either the iothread or the ramlist lock.
+ * Writes must take both locks.
+ */
QTAILQ_ENTRY(RAMBlock) next;
#if defined(__linux__) && !defined(TARGET_S390X)
int fd;
@@ -494,8 +498,11 @@ typedef struct RAMBlock {
} RAMBlock;
typedef struct RAMList {
+ QemuMutex mutex;
+ /* Protected by the iothread lock. */
uint8_t *phys_dirty;
RAMBlock *mru_block;
+ /* Protected by the ramlist lock. */
QTAILQ_HEAD(, RAMBlock) blocks;
uint32_t version;
} RAMList;
@@ -516,6 +523,8 @@ extern int mem_prealloc;
void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
ram_addr_t last_ram_offset(void);
+void qemu_mutex_lock_ramlist(void);
+void qemu_mutex_unlock_ramlist(void);
#endif /* !CONFIG_USER_ONLY */
int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr,