All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics
@ 2016-07-01 17:04 Richard Henderson
  2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 01/27] atomics: add atomic_xor Richard Henderson
                   ` (27 more replies)
  0 siblings, 28 replies; 48+ messages in thread
From: Richard Henderson @ 2016-07-01 17:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: cota, alex.bennee, pbonzini, peter.maydell, serge.fdrv

I spent a couple evenings this week tweaking Emilio's patch set.

The first major change is to "qemu/int128.h", so that we can use
that type in the context of a 16-byte cmpxchg.  I have yet to teach
TCG code generation about this type, so it's really only usable
from other helper functions.  But that's still an improvement over
having to return two uint64_t by reference.

The second major change is to funnel atomic operation generation
through functions in tcg-op.c.  There we can test whether or not
we're generating code in a parallel context and require atomic
operations.  This also centralizes the helper functions so that we
don't have to have the same sets in every target.

The third major change is providing a mechanism by which we can
trap on atomic operations that we do not support, exit the cpu loop,
stop the world, and then re-execute the instruction in a serial context.
This is obviously something that will need to be filled in further
as MTTCG progresses.

This minimally tested, but it is good enough to boot Fedora 24 x86-64,
even with the softmmu single-step stubbed out.  Perhaps unsurprisingly,
Fedora does not attempt an unaligned atomic operation.

Comments?


r~


Emilio G. Cota (18):
  atomics: add atomic_xor
  atomics: add atomic_op_fetch variants
  target-i386: emulate LOCK'ed cmpxchg using cmpxchg helpers
  target-i386: emulate LOCK'ed OP instructions using atomic helpers
  target-i386: emulate LOCK'ed INC using atomic helper
  target-i386: emulate LOCK'ed NOT using atomic helper
  target-i386: emulate LOCK'ed NEG using cmpxchg helper
  target-i386: emulate LOCK'ed XADD using atomic helper
  target-i386: emulate LOCK'ed BTX ops using atomic helpers
  target-i386: emulate XCHG using atomic helper
  target-i386: remove helper_lock()
  tests: add atomic_add-bench
  target-arm: emulate LL/SC using cmpxchg helpers
  target-arm: emulate SWP with atomic_xchg helper
  target-arm: emulate aarch64's LL/SC using cmpxchg helpers
  linux-user: remove handling of ARM's EXCP_STREX
  linux-user: remove handling of aarch64's EXCP_STREX
  target-arm: remove EXCP_STREX + cpu_exclusive_{test, info}

Richard Henderson (9):
  exec: Avoid direct references to Int128 parts
  int128: Use __int128 if available
  int128: Add int128_make128
  int128: Use complex numbers if advisable
  tcg: Add EXCP_ATOMIC
  HACK: Always enable parallel_cpus
  tcg: Add atomic helpers
  tcg: Add atomic128 helpers
  target-arm: Rearrange aa32 load and store functions

 Makefile.objs              |   1 -
 Makefile.target            |   1 +
 atomic_template.h          | 220 ++++++++++++++++++++++++++
 configure                  |  29 +++-
 cpu-exec-common.c          |   6 +
 cpu-exec.c                 |  23 +++
 cpus.c                     |   6 +
 cputlb.c                   |   9 +-
 exec.c                     |   4 +-
 include/exec/cpu-all.h     |   1 +
 include/exec/exec-all.h    |   1 +
 include/qemu-common.h      |   1 +
 include/qemu/atomic.h      |  21 +++
 include/qemu/int128.h      | 261 ++++++++++++++++++++++++++-----
 linux-user/main.c          | 277 +++++++--------------------------
 softmmu_template.h         | 264 +++++++++++++++++++++++++++++---
 target-arm/cpu.h           |  17 +--
 target-arm/helper-a64.c    | 135 ++++++++++++++++
 target-arm/helper-a64.h    |   2 +
 target-arm/internals.h     |   4 +-
 target-arm/translate-a64.c | 106 ++++++-------
 target-arm/translate.c     | 342 +++++++++++++++--------------------------
 target-arm/translate.h     |   4 -
 target-i386/helper.h       |   2 -
 target-i386/mem_helper.c   | 127 ++++++++-------
 target-i386/translate.c    | 374 ++++++++++++++++++++++++++++-----------------
 tcg-runtime.c              |  27 ++--
 tcg/tcg-op.c               | 324 +++++++++++++++++++++++++++++++++++++++
 tcg/tcg-op.h               |  44 ++++++
 tcg/tcg-runtime.h          |  75 +++++++++
 tcg/tcg.h                  |  76 +++++++++
 tests/.gitignore           |   1 +
 tests/Makefile.include     |   4 +-
 tests/atomic_add-bench.c   | 180 ++++++++++++++++++++++
 translate-all.c            |   1 +
 35 files changed, 2189 insertions(+), 781 deletions(-)
 create mode 100644 atomic_template.h
 create mode 100644 tests/atomic_add-bench.c

-- 
2.5.5

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

end of thread, other threads:[~2016-09-08 16:26 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01 17:04 [Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 01/27] atomics: add atomic_xor Richard Henderson
2016-08-11 17:19   ` Alex Bennée
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 02/27] atomics: add atomic_op_fetch variants Richard Henderson
2016-08-11 17:20   ` Alex Bennée
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 03/27] exec: Avoid direct references to Int128 parts Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 04/27] int128: Use __int128 if available Richard Henderson
2016-08-11 10:45   ` Alex Bennée
2016-08-25 19:09   ` [Qemu-devel] [PATCH] fixup! " Alex Bennée
2016-08-26 12:48     ` no-reply
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 06/27] int128: Use complex numbers if advisable Richard Henderson
2016-07-04 11:51   ` Paolo Bonzini
2016-07-04 12:07   ` Peter Maydell
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 07/27] tcg: Add EXCP_ATOMIC Richard Henderson
2016-09-08  8:38   ` Alex Bennée
2016-09-08 16:26     ` Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 08/27] HACK: Always enable parallel_cpus Richard Henderson
2016-09-08  8:39   ` Alex Bennée
2016-09-08 16:22     ` Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 09/27] tcg: Add atomic helpers Richard Henderson
2016-09-08 13:43   ` Alex Bennée
2016-09-08 16:08     ` Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 10/27] tcg: Add atomic128 helpers Richard Henderson
2016-07-08  3:00   ` Emilio G. Cota
2016-07-08  5:26     ` Richard Henderson
2016-08-11 10:02   ` Alex Bennée
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 11/27] target-i386: emulate LOCK'ed cmpxchg using cmpxchg helpers Richard Henderson
2016-07-08  3:08   ` Emilio G. Cota
2016-07-08  3:19     ` Emilio G. Cota
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 12/27] target-i386: emulate LOCK'ed OP instructions using atomic helpers Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 13/27] target-i386: emulate LOCK'ed INC using atomic helper Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 14/27] target-i386: emulate LOCK'ed NOT " Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 15/27] target-i386: emulate LOCK'ed NEG using cmpxchg helper Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 16/27] target-i386: emulate LOCK'ed XADD using atomic helper Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 17/27] target-i386: emulate LOCK'ed BTX ops using atomic helpers Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 18/27] target-i386: emulate XCHG using atomic helper Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 19/27] target-i386: remove helper_lock() Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 20/27] tests: add atomic_add-bench Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 21/27] target-arm: Rearrange aa32 load and store functions Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 22/27] target-arm: emulate LL/SC using cmpxchg helpers Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 23/27] target-arm: emulate SWP with atomic_xchg helper Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 24/27] target-arm: emulate aarch64's LL/SC using cmpxchg helpers Richard Henderson
2016-07-08  3:34   ` Emilio G. Cota
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 25/27] linux-user: remove handling of ARM's EXCP_STREX Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 26/27] linux-user: remove handling of aarch64's EXCP_STREX Richard Henderson
2016-07-01 17:04 ` [Qemu-devel] [PATCH v2 27/27] target-arm: remove EXCP_STREX + cpu_exclusive_{test, info} Richard Henderson
2016-07-01 17:23 ` [Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics Richard Henderson
2016-07-08  2:53 ` Emilio G. Cota

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.