Skip to content

target-ppc/linux-user: NPTL support

Nathan Froyd qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7linux-user: initialize mmap_mutex properlylinux-user/mmap.c+1 -10 replies
2/7target-ppc: fix cpu_clone_regstarget-ppc/cpu.h+1 -30 replies
3/7target-ppc: add cpu_set_tlstarget-ppc/cpu.h+11 -00 replies
4/7target-ppc: retain l{w,d}arx loaded valuetarget-ppc/cpu.h target-ppc/helper.c target-ppc/machine.c +2 more+17 -101 reply
5/7target-ppc: add exceptions for conditional storestarget-ppc/cpu.h target-ppc/translate.c+56 -200 replies
6/7linux-user: handle POWERPC_EXCP_STCXlinux-user/main.c+68 -00 replies
7/7enable NPTL for ppc-linux-user targets in configureconfigure+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/7] target-ppc/linux-user: NPTL support

This patch series adds NPTL support in Linux user-mode emulation to 32-bit PowerPC targets.

The main complication comes from implementing atomic instructions properly. We chose to implement a simplistic model:

- reserved loads record the value loaded;

- conditional stores check that the memory at the effective address contains the value loaded by the previous reserved load, in addition to all other checks. if so, the store succeeds; otherwise, it fails.

It is possible to implement something more sophisticated using mprotect:

- reserved loads write-protect the page from which the value is loaded;

- regular stores to the page (through SIGSEGV handling) remove the write protection (which is roughly how the architecture really works);

- conditional stores fail if the page was not write-protected, in addition to all other checks. If the store succeeds, then the page is unprotected.

but the simple scheme works well enough and should be somewhat faster. The simple scheme is what's already done for system mode, too; it's even slightly dumber in system mode because we don't check for equality of values.

The patch series has been tested against the glibc testsuite, where it passes a good chunk (90%+) of the testsuite. The other 10% are basically things that are not going to work in QEMU anytime soon (e.g. sharing futexes between multiple processes, using clone(2) directly, etc.). I should note that proper testing requires a patch to use a correct exit status for uncaught signals; such a patch has been posted to this list before by Riku Voipio. (I have a different local version that I used instead.) Testing with recent glibc also requires adding support for private futexes and a few other futex operations; again, a patch for this has been posted by Riku and I used a slightly different local version.

-Nathan

Nathan Froyd (7):
linux-user: initialize mmap_mutex properly
target-ppc: fix cpu_clone_regs
target-ppc: add cpu_set_tls
target-ppc: retain l{w,d}arx loaded value
target-ppc: add exceptions for conditional stores
linux-user: handle POWERPC_EXCP_STCX
enable NPTL for ppc-linux-user targets in configure

 configure              |    2 +
 linux-user/main.c      |   68 ++++++++++++++++++++++++++++++++++++++
 linux-user/mmap.c      |    2 +-
 target-ppc/cpu.h       |   24 +++++++++++--
 target-ppc/helper.c    |    2 +-
 target-ppc/machine.c   |    4 +-
 target-ppc/op_helper.c |    4 +-
 target-ppc/translate.c |   84 ++++++++++++++++++++++++++++++++++--------------
 8 files changed, 156 insertions(+), 34 deletions(-)