[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe |
Date: |
Fri, 23 Sep 2016 11:06:09 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 09/23/2016 12:31 AM, Paolo Bonzini wrote:
+ unsigned tb_flush_req = (unsigned) (uintptr_t) data;
Extra cast?
- tcg_ctx.tb_ctx.tb_flush_count++;
+ atomic_inc(&tcg_ctx.tb_ctx.tb_flush_count);
Since this is the only place this value is incremented, and we're under a lock,
it should be cheaper to use
atomic_mb_set(&tcg_ctx.tb_ctx.tb_flush_count, tb_flush_req + 1);
+ uintptr_t tb_flush_req = (uintptr_t)
+ atomic_read(&tcg_ctx.tb_ctx.tb_flush_count);
Extra cast?
That said, it's correct as-is so,
Reviewed-by: Richard Henderson <address@hidden>
r~
- [Qemu-devel] [PATCH 10/16] docs: include formal model for TCG exclusive sections, (continued)
- [Qemu-devel] [PATCH 10/16] docs: include formal model for TCG exclusive sections, Paolo Bonzini, 2016/09/23
- [Qemu-devel] [PATCH 09/16] cpus-common: move exclusive work infrastructure from linux-user, Paolo Bonzini, 2016/09/23
- [Qemu-devel] [PATCH 11/16] cpus-common: always defer async_run_on_cpu work items, Paolo Bonzini, 2016/09/23
- [Qemu-devel] [PATCH 13/16] cpus-common: simplify locking for start_exclusive/end_exclusive, Paolo Bonzini, 2016/09/23
- [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe, Paolo Bonzini, 2016/09/23
- Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe,
Richard Henderson <=
[Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_cpu(), Paolo Bonzini, 2016/09/23
[Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_exec_start/end, Paolo Bonzini, 2016/09/23