[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode |
Date: |
Sun, 23 Aug 2015 20:24:00 -0400 |
Note that user-only uses mmap_lock for this.
Signed-off-by: Emilio G. Cota <address@hidden>
---
translate-all.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/translate-all.c b/translate-all.c
index e7b4a31..8f8c402 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1203,8 +1203,9 @@ void tb_invalidate_phys_range(tb_page_addr_t start,
tb_page_addr_t end)
* Called with mmap_lock held for user-mode emulation
* If called from generated code, iothread mutex must not be held.
*/
-void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
- int is_cpu_write_access)
+static void
+tb_invalidate_phys_page_range_locked(tb_page_addr_t start, tb_page_addr_t end,
+ int is_cpu_write_access)
{
TranslationBlock *tb, *tb_next, *saved_tb;
CPUState *cpu = current_cpu;
@@ -1236,7 +1237,6 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start,
tb_page_addr_t end,
/* we remove all the TBs in the range [start, end[ */
/* XXX: see if in some cases it could be faster to invalidate all
the code */
- tb_lock();
tb = p->first_tb;
while (tb != NULL) {
n = (uintptr_t)tb & 3;
@@ -1310,14 +1310,19 @@ void tb_invalidate_phys_page_range(tb_page_addr_t
start, tb_page_addr_t end,
cpu_resume_from_signal(cpu, NULL);
}
#endif
+}
+
+void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
+ int is_cpu_write_access)
+{
+ tb_lock();
+ tb_invalidate_phys_page_range_locked(start, end, is_cpu_write_access);
tb_unlock();
}
#ifdef CONFIG_SOFTMMU
-/* len must be <= 8 and start must be a multiple of len.
- * Called via softmmu_template.h, with iothread mutex not held.
- */
-void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
+
+static void tb_invalidate_phys_page_fast_locked(tb_page_addr_t start, int len)
{
PageDesc *p;
@@ -1352,9 +1357,19 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start,
int len)
}
} else {
do_invalidate:
- tb_invalidate_phys_page_range(start, start + len, 1);
+ tb_invalidate_phys_page_range_locked(start, start + len, 1);
}
}
+
+/* len must be <= 8 and start must be a multiple of len.
+ * Called via softmmu_template.h, with iothread mutex not held.
+ */
+void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
+{
+ tb_lock();
+ tb_invalidate_phys_page_fast_locked(start, len);
+ tb_unlock();
+}
#else
/* Called with mmap_lock held. */
static void tb_invalidate_phys_page(tb_page_addr_t addr,
--
1.9.1
- [Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_all, (continued)
- [Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_all, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 34/38] translate-all: use tcg_sched_work for tb_flush, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 19/38] tcg: add tcg_gen_smp_rmb(), Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 22/38] cpu: update interrupt_request atomically, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode,
Emilio G. Cota <=
- [Qemu-devel] [RFC 27/38] cpu-exec: convert tb_invalidated_flag into a per-TB flag, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 33/38] cpu: introduce cpu_tcg_sched_work to run work while other CPUs sleep, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 21/38] target-i386: emulate atomic instructions + barriers using AIE, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 38/38] Revert "target-i386: yield to another VCPU on PAUSE", Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 37/38] cpus: remove async_run_safe_work_on_cpu, Emilio G. Cota, 2015/08/23