qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/9] tcg: signal-free qemu_cpu_kick
@ 2015-08-26  0:17 Paolo Bonzini
  2015-08-26  0:17 ` [Qemu-devel] [PATCH 1/9] i8257: rewrite DMA_schedule to avoid hooking into the CPU loop Paolo Bonzini
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Paolo Bonzini @ 2015-08-26  0:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: mttcg, cota, rth

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

 cpu-exec.c              | 33 ++++++++----------
 cpus.c                  | 91 ++++++++++++++-----------------------------------
 exec.c                  |  2 +-
 gdbstub.c               |  2 +-
 hw/block/fdc.c          |  2 +-
 hw/dma/i82374.c         |  5 +--
 hw/dma/i8257.c          | 31 +++++++++--------
 hw/i386/pc.c            | 13 +------
 hw/isa/i82378.c         |  3 +-
 hw/mips/mips_fulong2e.c | 13 +------
 hw/mips/mips_jazz.c     | 13 +------
 hw/mips/mips_malta.c    | 13 +------
 hw/ppc/prep.c           | 11 ------
 hw/ppc/spapr_rtas.c     |  2 +-
 hw/sparc/sun4m.c        |  4 +--
 hw/sparc64/sun4u.c      |  4 +--
 include/exec/exec-all.h |  5 +--
 include/hw/isa/isa.h    |  4 +--
 include/qemu/tls.h      | 52 ----------------------------
 include/qom/cpu.h       |  8 ++---
 qom/cpu.c               |  2 ++
 21 files changed, 80 insertions(+), 233 deletions(-)
 delete mode 100644 include/qemu/tls.h

-- 
2.4.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-08-28  8:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26  0:17 [Qemu-devel] [PATCH v2 0/9] tcg: signal-free qemu_cpu_kick Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 1/9] i8257: rewrite DMA_schedule to avoid hooking into the CPU loop Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 2/9] i8257: remove cpu_request_exit irq Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 3/9] tcg: introduce tcg_current_cpu Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 4/9] remove qemu/tls.h Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 5/9] tcg: assign cpu->current_tb in a simpler place Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 6/9] tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses Paolo Bonzini
2015-08-28  2:19   ` Emilio G. Cota
2015-08-28  8:50     ` Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 7/9] tcg: synchronize exit_request and tcg_current_cpu accesses Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 8/9] use qemu_cpu_kick instead of cpu_exit or qemu_cpu_kick_thread Paolo Bonzini
2015-08-26  0:17 ` [Qemu-devel] [PATCH 9/9] tcg: signal-free qemu_cpu_kick Paolo Bonzini
2015-08-28  4:21 ` [Qemu-devel] [PATCH v2 0/9] " Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).