target/sparc: Enable MTTCG
cover target/sparc: Enable MTTCG
With the addition of TCG_GUEST_DEFAULT_MO, there's nothing in the cpu emulation preventing this from working. There is some board model work to be done for sparc64, where max_cpus = 1.
r~
Richard Henderson (2):
target/sparc: Set TCG_GUEST_DEFAULT_MO
configs: Enable MTTCG for sparc, sparc64
configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + target/sparc/cpu.h | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+)
Signature · 1 line
2.34.1
PATCH 1/2 target/sparc: Set TCG_GUEST_DEFAULT_MO
Always use TSO, per the Oracle 2015 manual.
This is slightly less restrictive than the TCG_MO_ALL default, and happens to match the i386 model, which will eliminate a few extra barriers on that host.
--- target/sparc/cpu.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
target/sparc/cpu.h +23 -0
@@ -6,6 +6,29 @@#include "exec/cpu-defs.h" #include "qemu/cpu-float.h" +/* +* From Oracle SPARC Architecture 2015: +* +* Compatibility notes: The PSO memory model described in SPARC V8 and +* SPARC V9 compatibility architecture specifications was never implemented +* in a SPARC V9 implementation and is not included in the Oracle SPARC +* Architecture specification. +* +* The RMO memory model described in the SPARC V9 specification was +* implemented in some non-Sun SPARC V9 implementations, but is not +* directly supported in Oracle SPARC Architecture 2015 implementations. +* +* Therefore always use TSO in QEMU. +* +* D.5 Specification of Partial Store Order (PSO) +* ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. +* +* D.6 Specification of Total Store Order (TSO) +* ... PSO with the additional requirement that all [stores] are followed +* by an implied MEMBAR #StoreStore. +*/ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) +#if !defined(TARGET_SPARC64 )#define TARGET_DPREGS 16#else
Signature · 1 line
2.34.1
Re: [PATCH 1/2] target/sparc: Set TCG_GUEST_DEFAULT_MO
Quoted 9 lines · Richard Henderson
Always use TSO, per the Oracle 2015 manual.
This is slightly less restrictive than theTCG_MO_ALLdefault, and happens to match the i386 model, which will eliminate a few extra barriers on that host.Signed-off-by Richard Henderson <[email protected]>--- target/sparc/cpu.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
PATCH 2/2 configs: Enable MTTCG for sparc, sparc64
In reply to Richard HendersonThis will be of small comfort to sparc64, because both sun4u and sun4v board models force max_cpus = 1. But it does enable actual smp for sparc32 sun4m.
--- configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + 2 files changed, 2 insertions(+)
configs/targets/sparc-softmmu.mak +1 -0
@@ -1,2 +1,3 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y
configs/targets/sparc64-softmmu.mak +1 -0
@@ -1,3 +1,4 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y
Signature · 1 line
2.34.1
Re: [PATCH 2/2] configs: Enable MTTCG for sparc, sparc64
Quoted 3 lines · Richard Henderson
This will be of small comfort to sparc64, because both sun4u and sun4v board models force
max_cpus= 1. But it does enable actual smp for sparc32 sun4m.
Yay \o/
Quoted 5 lines
Signed-off-by Richard Henderson <[email protected]>--- configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + 2 files changed, 2 insertions(+)
Quoted 3 lines · Richard Henderson
With the addition of
TCG_GUEST_DEFAULT_MO, there's nothing in the cpu emulation preventing this from working. There is some board model work to be done for sparc64, wheremax_cpus= 1.
I've tried testing this with the Advent Calendar image at https://qemu-advent-calendar.org/2018/download/day11.tar.xz and even without these patches applied I'm seeing hangs with -smp 2. When applied on top of the other "target/sparc: Use tcg_gen_lookup_and_goto_ptr" series I get assert() after a minute or two:
ERROR:../accel/tcg/tcg-accel-ops-mttcg.c:110:mttcg_cpu_thread_fn: assertion failed: (cpu->halted) Bail out! ERROR:../accel/tcg/tcg-accel-ops-mttcg.c:110:mttcg_cpu_thread_fn: assertion failed: (cpu->halted)
It may be wise to try and figure out what's going on with git head first before applying this. In particular /proc/cpuinfo suggests things aren't right with -smp 2:
# cat /proc/cpuinfo cpu : Texas Instruments, Inc. - SuperSparc-(II) fpu : SuperSparc on-chip FPU promlib : Version 3 Revision 2 prom : 2.25 type : sun4m ncpus probed : 2 ncpus active : 1 CPU0Bogo : 213.50 CPU0ClkTck : 0 MMU type : TI Viking/MXCC contexts : 65536 nocache total : 3145728 nocache used : 375552
Quoted 8 lines
Richard Henderson (2):
target/sparc: SetTCG_GUEST_DEFAULT_MO
configs: Enable MTTCG for sparc, sparc64configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + target/sparc/cpu.h | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+)
ATB,
Mark.
Quoted 7 lines · Mark Cave-Ayland
Quoted 3 lines · Richard Henderson
With the addition of
TCG_GUEST_DEFAULT_MO, there's nothing in the cpu emulation preventing this from working. There is some board model work to be done for sparc64, wheremax_cpus= 1.I've tried testing this with the Advent Calendar image at https://qemu-advent-calendar.org/2018/download/day11.tar.xz and even without these patches applied I'm seeing hangs with -smp 2. When applied on top of the other "target/sparc: Use
tcg_gen_lookup_and_goto_ptr" series I getassert()after a minute or two:
Would you try again, now that we've solved the issues with lookup_and_goto_ptr?
r~
Quoted 10 lines · Richard Henderson
Quoted 7 lines · Mark Cave-Ayland
Quoted 3 lines · Richard Henderson
With the addition of
TCG_GUEST_DEFAULT_MO, there's nothing in the cpu emulation preventing this from working. There is some board model work to be done for sparc64, wheremax_cpus= 1.I've tried testing this with the Advent Calendar image at https://qemu-advent-calendar.org/2018/download/day11.tar.xz and even without these patches applied I'm seeing hangs with -smp 2. When applied on top of the other "target/sparc: Use
tcg_gen_lookup_and_goto_ptr" series I getassert()after a minute or two:Would you try again, now that we've solved the issues with
lookup_and_goto_ptr?
The wording above is a bit clumsy on my part, but I was still seeing the hangs on git master with -smp 2, but with the older tcg_gen_lookup_and_goto_ptr series not only would I see the hangs but I would hit the assert() within a couple of minutes.
My notes on the wiki at https://wiki.qemu.org/Documentation/Platforms/SPARC#Timeline suggest that it was working on QEMU 6.2, so I'll need to find a moment to bisect it down to see where things broke.
ATB,
Mark.