qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 0/9] tcg: signal-free qemu_cpu_kick


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 0/9] tcg: signal-free qemu_cpu_kick
Date: Thu, 27 Aug 2015 21:21:14 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/25/2015 05:17 PM, Paolo Bonzini wrote:
This version of the signal-free qemu_cpu_kick patches is, ehm, much
better.  Variable are accessed either with Java-style volatiles or
protected by memory barriers, and the cleanups go further by removing
qemu/tls.h and C volatiles.

The logic is relatively simple.  The I/O thread does (letters in
parentheses indicates the synchronizes-with edges):

     run_on_cpu or similar
     ...
     seq_cst write 1 to exit_request        (C)
     seq_cst read tcg_current_cpu to cpu    (B)
     if not NULL
        write 1 to cpu->exit_request
        release barrier                     (A)
        write 1 to cpu->tcg_exit_req

The CPU thread does either this:

     (in generated code) read cpu->tcg_exit_req
     acquire barrier                        (A)
     read cpu->exit_request
     exit from cpu_exec
     seq_cst write 0 to exit_request
     ...
     flush_queued_work or similar

or this:

     seq_cst write to tcg_current_cpu       (B)
     seq_cst read from exit_request         (C)
     exit from cpu_exec
     seq_cst write 0 to exit_request
     ...
     flush_queued_work or similar

The non-TLS tcg_current_cpu will go away with multi-threaded TCG.

Paolo

Paolo Bonzini (9):
   i8257: rewrite DMA_schedule to avoid hooking into the CPU loop
   i8257: remove cpu_request_exit irq
   tcg: introduce tcg_current_cpu
   remove qemu/tls.h
   tcg: assign cpu->current_tb in a simpler place
   tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses
   tcg: synchronize exit_request and tcg_current_cpu accesses
   use qemu_cpu_kick instead of cpu_exit or qemu_cpu_kick_thread
   tcg: signal-free qemu_cpu_kick

Reviewed-by: Richard Henderson <address@hidden>


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]