aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-02-22 20:50:29 -0500
committerRichard Henderson <richard.henderson@linaro.org>2018-06-15 07:42:55 -1000
commitfaa9372c07d062eb01f9da72e3f6c0f32efffca7 (patch)
tree96b3a39266f5222e795c5f90e03b86c91e28384a /accel
parent6d9abf85d538731ccff25fc29d7fa938115b1a80 (diff)
translate-all: introduce assert_no_pages_locked
The appended adds assertions to make sure we do not longjmp with page locks held. Note that user-mode has nothing to check, since page_locks are !user-mode only. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/cpu-exec.c1
-rw-r--r--accel/tcg/translate-all.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 7570c59f09..d75c35380a 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -273,6 +273,7 @@ void cpu_exec_step_atomic(CPUState *cpu)
tcg_debug_assert(!have_mmap_lock());
#endif
tb_lock_reset();
+ assert_no_pages_locked();
}
if (in_exclusive_region) {
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 8b378586f4..c75298d08a 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -658,6 +658,12 @@ do_assert_page_locked(const PageDesc *pd, const char *file, int line)
#define assert_page_locked(pd) do_assert_page_locked(pd, __FILE__, __LINE__)
+void assert_no_pages_locked(void)
+{
+ ht_pages_locked_debug_init();
+ g_assert(g_hash_table_size(ht_pages_locked_debug) == 0);
+}
+
#else /* !CONFIG_DEBUG_TCG */
#define assert_page_locked(pd)
@@ -829,6 +835,7 @@ page_collection_lock(tb_page_addr_t start, tb_page_addr_t end)
set->tree = g_tree_new_full(tb_page_addr_cmp, NULL, NULL,
page_entry_destroy);
set->max = NULL;
+ assert_no_pages_locked();
retry:
g_tree_foreach(set->tree, page_entry_lock, NULL);