[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics |
Date: |
Fri, 1 Jul 2016 10:04:26 -0700 |
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
- [Qemu-devel] [PATCH v2 00/27] cmpxchg-based emulation of atomics,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 04/27] int128: Use __int128 if available, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 03/27] exec: Avoid direct references to Int128 parts, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 02/27] atomics: add atomic_op_fetch variants, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 08/27] HACK: Always enable parallel_cpus, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 01/27] atomics: add atomic_xor, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 11/27] target-i386: emulate LOCK'ed cmpxchg using cmpxchg helpers, Richard Henderson, 2016/07/01
- [Qemu-devel] [PATCH v2 06/27] int128: Use complex numbers if advisable, Richard Henderson, 2016/07/01