[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-sy
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode |
Date: |
Sun, 23 Aug 2015 18:07:04 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 23/08/2015 17:24, Emilio G. Cota wrote:
> Note that user-only uses mmap_lock for this.
>
> Signed-off-by: Emilio G. Cota <address@hidden>
Why is this needed? The RCU-like page_find should work just fine.
Paolo
> ---
> 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,
>
- [Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all, (continued)
- [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode, Emilio G. Cota, 2015/08/23
- Re: [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode,
Paolo Bonzini <=
- [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
- [Qemu-devel] [RFC 32/38] cpu list: convert to RCU QLIST, Emilio G. Cota, 2015/08/23