[PATCH for-8.1 v2 0/3] accel/tcg: Take mmap_lock in load_atomic*_or_exit

Richard Henderson posted 3 patches 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230722113507.78332-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Laurent Vivier <laurent@vivier.eu>
include/exec/exec-all.h        | 10 ++++++++++
bsd-user/mmap.c                |  1 +
linux-user/mmap.c              |  1 +
accel/tcg/ldst_atomicity.c.inc | 32 ++++++++++++++++++--------------
4 files changed, 30 insertions(+), 14 deletions(-)
[PATCH for-8.1 v2 0/3] accel/tcg: Take mmap_lock in load_atomic*_or_exit
Posted by Richard Henderson 9 months, 2 weeks ago
For user-only, the probe for page writability may race with another
thread's mprotect.  Take the mmap_lock around the operation.  This
is still faster than the start/end_exclusive fallback.

Changes for v2:
  * Introduce WITH_MMAP_LOCK_GUARD, to simplify the changes.
  * Fix the probes for not-writable.
  * Handle load_atomic8_or_exit and load_atomic16_or_exit similarly.


r~


Richard Henderson (3):
  include/exec: Add WITH_MMAP_LOCK_GUARD
  accel/tcg: Fix sense of read-only probes in ldst_atomicity
  accel/tcg: Take mmap_lock in load_atomic*_or_exit

 include/exec/exec-all.h        | 10 ++++++++++
 bsd-user/mmap.c                |  1 +
 linux-user/mmap.c              |  1 +
 accel/tcg/ldst_atomicity.c.inc | 32 ++++++++++++++++++--------------
 4 files changed, 30 insertions(+), 14 deletions(-)

-- 
2.34.1