On 2/5/24 12:27, Philippe Mathieu-Daudé wrote:
On 30/4/24 23:42, Ilya Leoshkevich wrote:
On Tue, Apr 30, 2024 at 09:00:17PM +0200, Philippe Mathieu-Daudé wrote:
On 30/4/24 20:45, Philippe Mathieu-Daudé wrote:
Hi Ilya,
On 30/4/24 19:55, Ilya Leoshkevich wrote:
On Tue, Apr 30, 2024 at 02:27:54PM +0200, Philippe Mathieu-Daudé
wrote:
Missing WASM testing by Ilya (branch available at
https://gitlab.com/philmd/qemu/-/commits/tcg_flush_jmp_cache)
Hmm, it dies very early now:
# gdb --args ./qemu-s390x -L /usr/s390x-linux-gnu
/build/wasmtime/target/s390x-unknown-linux-gnu/debug/deps/component_fuzz_util-d10a3a6b4ad8af47
Thread 1 "qemu-s390x" received signal SIGSEGV, Segmentation fault.
0x000055555559b718 in cpu_common_realizefn (dev=0x5555557c28c0,
errp=<optimized out>) at
../home/iii/myrepos/qemu/hw/core/cpu-common.c:217
217 cpu->accel->plugin_state =
qemu_plugin_create_vcpu_state();
(gdb) bt
#0 0x000055555559b718 in cpu_common_realizefn
(dev=0x5555557c28c0, errp=<optimized out>) at
../home/iii/myrepos/qemu/hw/core/cpu-common.c:217
#1 0x000055555559f59a in s390_cpu_realizefn (dev=0x5555557c28c0,
errp=0x7fffffffe1a0) at
(gdb) p cpu
$1 = (CPUState *) 0x5555557c28c0
(gdb) p cpu->accel
$2 = (AccelCPUState *) 0x0
Configured with: '/home/iii/myrepos/qemu/configure'
'--target-list=s390x-linux-user' '--disable-tools' '--disable-slirp'
'--disable-fdt' '--disable-capstone' '--disable-docs'
Now I get:
Thread 1 "qemu-s390x" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007ffff7c41e8f in __pthread_kill_internal (signo=6,
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x00007ffff7bf2fb2 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#3 0x00007ffff7bdd472 in __GI_abort () at ./stdlib/abort.c:79
#4 0x00007ffff7bdd395 in __assert_fail_base (fmt=0x7ffff7d51a90
"%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x5555556d71b8 "cpu->accel",
file=file@entry=0x5555556d70e0
"../home/iii/myrepos/qemu/cpu-target.c", line=line@entry=158,
function=function@entry=0x5555556d7260 <__PRETTY_FUNCTION__.3>
"cpu_exec_realizefn") at ./assert/assert.c:92
#5 0x00007ffff7bebeb2 in __GI___assert_fail
(assertion=assertion@entry=0x5555556d71b8 "cpu->accel",
file=file@entry=0x5555556d70e0
"../home/iii/myrepos/qemu/cpu-target.c", line=line@entry=158,
function=function@entry=0x5555556d7260 <__PRETTY_FUNCTION__.3>
"cpu_exec_realizefn") at ./assert/assert.c:101
#6 0x00005555555d44ca in cpu_exec_realizefn
(cpu=cpu@entry=0x5555557c28c0, errp=errp@entry=0x7fffffffe140) at
../home/iii/myrepos/qemu/cpu-target.c:158
#7 0x000055555559f50b in s390_cpu_realizefn (dev=0x5555557c28c0,
errp=0x7fffffffe1a0) at ../home/iii/myrepos/qemu/target/s390x/cpu.c:261
From code review I think the problem is my commit bb6cf6f016
("accel/tcg: Factor tcg_cpu_reset_hold() out") which wanted
to restrict tlb_flush() to system emulation, but inadvertently
also restricted tcg_flush_jmp_cache(), which was before called
via Realize -> Reset -> cpu_common_reset_hold(). Apparently
now this code can't happen on user emulation.
This is indeed the root cause, I'll post a series fixing it.