[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/8] tcg: Clarify "thread safaty" check in tb_ad
From: |
Sergey Fedorov |
Subject: |
Re: [Qemu-devel] [PATCH 5/8] tcg: Clarify "thread safaty" check in tb_add_jump() |
Date: |
Thu, 24 Mar 2016 15:41:58 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 24/03/16 14:31, Paolo Bonzini wrote:
> On 24/03/2016 11:39, address@hidden wrote:
>> + /* FIXME: This test provides only some probablistic "thread safety" for
>> + * user-mode emulation; appropriate synchronization/locking scheme
>> should
>> + * be implemented.
>> + */
> There is appropriate locking. This code:
>
> if (next_tb != 0 && tb->page_addr[1] == -1
> && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
> tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK),
> next_tb & TB_EXIT_MASK, tb);
> }
>
> in cpu-exec.c runs under tb_lock. However, two threads can decide to
> call tb_add_jump at the same time outside the lock, so we have to check
> inside the lock whether someone has already done the work.
>
> What the comment means is that, in single-threaded scenarios (current
> TCG and single-threaded user emulation), tb->jmp_list_next[n] is only
> set once.
Right, thanks for clarifying this. So I'm going to put mention this in
the comment, then.
Kind regards,
Sergey
- Re: [Qemu-devel] [PATCH 1/8] tcg: Clean up direct block chaining data fields, (continued)
[Qemu-devel] [PATCH 2/8] tcg: Use uintptr_t type for jmp_list_{next|first} fields of TB, sergey . fedorov, 2016/03/24
[Qemu-devel] [PATCH 5/8] tcg: Clarify "thread safaty" check in tb_add_jump(), sergey . fedorov, 2016/03/24
[Qemu-devel] [PATCH 3/8] tcg: Rearrange tb_link_page() to avoid forward declaration, sergey . fedorov, 2016/03/24
[Qemu-devel] [PATCH 6/8] tcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list(), sergey . fedorov, 2016/03/24
[Qemu-devel] [PATCH 8/8] tcg: Clean up tb_jmp_unlink(), sergey . fedorov, 2016/03/24