On 24/03/2016 11:39, sergey.fedo...@linaro.org 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.

Paolo

Reply via email to