[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chacha20-s390 broken in 8.2.0 in TCG on s390x
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: chacha20-s390 broken in 8.2.0 in TCG on s390x |
Date: |
Wed, 3 Jan 2024 12:53:59 +0100 |
User-agent: |
Mozilla Thunderbird |
Hi Richard,
On 3/1/24 09:54, Michael Tokarev wrote:
03.01.2024 03:22, Richard Henderson wrote:
On 12/22/23 01:51, Michael Tokarev wrote:
...
git bisect points to this commit:
commit ab84dc398b3b702b0c692538b947ef65dbbdf52f
Author: Richard Henderson <richard.henderson@linaro.org>
Date: Wed Aug 23 23:04:24 2023 -0700
tcg/optimize: Optimize env memory operations
So far, this seems to work on amd64 host, but fails on s390x host -
where this has been observed so far. Maybe it also fails in some
other combinations too, I don't yet know. Just finished bisecting
it on s390x.
I haven't been able to build a reproducer for this.
Have you an image or kernel you can share?
Sure.
Here's my actual testing "image":
http://www.corpit.ru/mjt/tmp/s390x-chacha.tar.gz
It contains vmlinuz and initrd - generated on a debian s390x system
using standard
debian tools.
Actual command line I used when doing bisection:
~/qemu/b/qemu-system-s390x -append "root=/dev/vda rw" -nographic -smp
2 -drive format=raw,file=vmlinuz,if=virtio -no-user-config -m 1G -kernel
vmlinuz -initrd initrd -snapshot
I had a quick look at the reproducer and reduced the code
area to:
void tcg_optimize(TCGContext *s)
{
...
switch (opc) {
case INDEX_op_ld_vec:
done = fold_tcg_ld_memcopy(&ctx, op);
static bool fold_tcg_ld_memcopy(OptContext *ctx, TCGOp *op)
{
...
if (src && src->base_type == type) {
return tcg_opt_gen_mov(ctx, op, temp_arg(dst), temp_arg(src));
}
static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst,
TCGArg src)
{
...
switch (ctx->type) {
case TCG_TYPE_V128:
new_op = INDEX_op_mov_vec;
By disabling this optimization, the test succeeds.
Looking at commit 4caad79f8d ("tcg/s390x: Support 128-bit load/store")
and remembering the constraints change on PPC LQ in
https://lore.kernel.org/qemu-devel/20240102013456.131846-1-richard.henderson@linaro.org/
I wondered if LPQ constraints are correct, but I disabled
TCG_TARGET_HAS_qemu_ldst_i128 and the bug persists (so
re-enabled).
Then disabling TCG_TARGET_HAS_v64 and TCG_TARGET_HAS_v128 the bug
disappears.
The problematic chacha20 guest code could be:
Restarting code generation with smaller translation block (max 86 insns)
----------------
IN:
0x3ff80025a62: eb67 f030 0024 stmg %r6, %r7, 0x30(%r15)
0x3ff80025a68: a719 ff60 lghi %r1, -0xa0
0x3ff80025a6c: b904 000f lgr %r0, %r15
0x3ff80025a70: 41f1 f000 la %r15, 0(%r1, %r15)
0x3ff80025a74: e300 f000 0024 stg %r0, 0(%r15)
0x3ff80025a7a: c070 0000 12c3 larl %r7, -0x7ffd8000
0x3ff80025a80: a708 000a lhi %r0, 0xa
0x3ff80025a84: e789 5000 0c36 .byte 0xe7, 0x89, 0x50, 0x00, 0x0c, 0x36
0x3ff80025a8a: e7a0 6000 0806 .byte 0xe7, 0xa0, 0x60, 0x00, 0x08, 0x06
0x3ff80025a90: e7bf 7000 4c36 .byte 0xe7, 0xbf, 0x70, 0x00, 0x4c, 0x36
0x3ff80025a96: e70b 0000 0456 .byte 0xe7, 0x0b, 0x00, 0x00, 0x04, 0x56
0x3ff80025a9c: e718 0000 0456 .byte 0xe7, 0x18, 0x00, 0x00, 0x04, 0x56
0x3ff80025aa2: e74b 0000 0456 .byte 0xe7, 0x4b, 0x00, 0x00, 0x04, 0x56
0x3ff80025aa8: e758 0000 0456 .byte 0xe7, 0x58, 0x00, 0x00, 0x04, 0x56
0x3ff80025aae: e78b 0000 0456 .byte 0xe7, 0x8b, 0x00, 0x00, 0x04, 0x56
0x3ff80025ab4: e798 0000 0456 .byte 0xe7, 0x98, 0x00, 0x00, 0x04, 0x56
0x3ff80025aba: e7cb 0000 0456 .byte 0xe7, 0xcb, 0x00, 0x00, 0x04, 0x56
0x3ff80025ac0: e7d8 0000 0456 .byte 0xe7, 0xd8, 0x00, 0x00, 0x04, 0x56
0x3ff80025ac6: e70b 0000 0c56 .byte 0xe7, 0x0b, 0x00, 0x00, 0x0c, 0x56
0x3ff80025acc: e718 0000 0c56 .byte 0xe7, 0x18, 0x00, 0x00, 0x0c, 0x56
0x3ff80025ad2: e74b 0000 0c56 .byte 0xe7, 0x4b, 0x00, 0x00, 0x0c, 0x56
0x3ff80025ad8: e758 0000 0c56 .byte 0xe7, 0x58, 0x00, 0x00, 0x0c, 0x56
0x3ff80025ade: e73a 0000 0456 .byte 0xe7, 0x3a, 0x00, 0x00, 0x04, 0x56
0x3ff80025ae4: e77a c000 26f3 .byte 0xe7, 0x7a, 0xc0, 0x00, 0x26, 0xf3
0x3ff80025aea: e7ba d000 26f3 .byte 0xe7, 0xba, 0xd0, 0x00, 0x26, 0xf3
0x3ff80025af0: e7fa e000 26f3 .byte 0xe7, 0xfa, 0xe0, 0x00, 0x26, 0xf3
0x3ff80025af6: e73b d000 2af3 .byte 0xe7, 0x3b, 0xd0, 0x00, 0x2a, 0xf3
0x3ff80025afc: e77b e000 2af3 .byte 0xe7, 0x7b, 0xe0, 0x00, 0x2a, 0xf3
0x3ff80025b02: e729 0000 0456 .byte 0xe7, 0x29, 0x00, 0x00, 0x04, 0x56
0x3ff80025b08: e769 0000 0456 .byte 0xe7, 0x69, 0x00, 0x00, 0x04, 0x56
0x3ff80025b0e: e7a9 0000 0456 .byte 0xe7, 0xa9, 0x00, 0x00, 0x04, 0x56
0x3ff80025b14: e7e9 0000 0456 .byte 0xe7, 0xe9, 0x00, 0x00, 0x04, 0x56
0x3ff80025b1a: e729 0000 0c56 .byte 0xe7, 0x29, 0x00, 0x00, 0x0c, 0x56
0x3ff80025b20: e769 0000 0c56 .byte 0xe7, 0x69, 0x00, 0x00, 0x0c, 0x56
0x3ff80025b26: e7c7 0000 0856 .byte 0xe7, 0xc7, 0x00, 0x00, 0x08, 0x56
0x3ff80025b2c: e7db 0000 0856 .byte 0xe7, 0xdb, 0x00, 0x00, 0x08, 0x56
0x3ff80025b32: e7ef 0000 0856 .byte 0xe7, 0xef, 0x00, 0x00, 0x08, 0x56
0x3ff80025b38: e700 1000 20f3 .byte 0xe7, 0x00, 0x10, 0x00, 0x20, 0xf3
0x3ff80025b3e: e744 5000 20f3 .byte 0xe7, 0x44, 0x50, 0x00, 0x20, 0xf3
0x3ff80025b44: e788 9000 20f3 .byte 0xe7, 0x88, 0x90, 0x00, 0x20, 0xf3
0x3ff80025b4a: e7cc d000 20f3 .byte 0xe7, 0xcc, 0xd0, 0x00, 0x20, 0xf3
0x3ff80025b50: e700 1000 2ef3 .byte 0xe7, 0x00, 0x10, 0x00, 0x2e, 0xf3
0x3ff80025b56: e744 5000 2ef3 .byte 0xe7, 0x44, 0x50, 0x00, 0x2e, 0xf3
0x3ff80025b5c: e733 0000 006d .byte 0xe7, 0x33, 0x00, 0x00, 0x00, 0x6d
0x3ff80025b62: e777 4000 006d .byte 0xe7, 0x77, 0x40, 0x00, 0x00, 0x6d
0x3ff80025b68: e7bb 8000 006d .byte 0xe7, 0xbb, 0x80, 0x00, 0x00, 0x6d
0x3ff80025b6e: e7ff c000 006d .byte 0xe7, 0xff, 0xc0, 0x00, 0x00, 0x6d
0x3ff80025b74: e733 0000 0e6d .byte 0xe7, 0x33, 0x00, 0x00, 0x0e, 0x6d
0x3ff80025b7a: e777 4000 0e6d .byte 0xe7, 0x77, 0x40, 0x00, 0x0e, 0x6d
0x3ff80025b80: e733 0010 2033 .byte 0xe7, 0x33, 0x00, 0x10, 0x20, 0x33
0x3ff80025b86: e777 0010 2033 .byte 0xe7, 0x77, 0x00, 0x10, 0x20, 0x33
0x3ff80025b8c: e7bb 0010 2033 .byte 0xe7, 0xbb, 0x00, 0x10, 0x20, 0x33
0x3ff80025b92: e7ff 0010 2033 .byte 0xe7, 0xff, 0x00, 0x10, 0x20, 0x33
0x3ff80025b98: e733 0010 2c33 .byte 0xe7, 0x33, 0x00, 0x10, 0x2c, 0x33
0x3ff80025b9e: e777 0010 2c33 .byte 0xe7, 0x77, 0x00, 0x10, 0x2c, 0x33
0x3ff80025ba4: e722 3000 20f3 .byte 0xe7, 0x22, 0x30, 0x00, 0x20, 0xf3
0x3ff80025baa: e766 7000 20f3 .byte 0xe7, 0x66, 0x70, 0x00, 0x20, 0xf3
0x3ff80025bb0: e7aa b000 20f3 .byte 0xe7, 0xaa, 0xb0, 0x00, 0x20, 0xf3
0x3ff80025bb6: e7ee f000 20f3 .byte 0xe7, 0xee, 0xf0, 0x00, 0x20, 0xf3
0x3ff80025bbc: e722 3000 2ef3 .byte 0xe7, 0x22, 0x30, 0x00, 0x2e, 0xf3
0x3ff80025bc2: e766 7000 2ef3 .byte 0xe7, 0x66, 0x70, 0x00, 0x2e, 0xf3
0x3ff80025bc8: e711 2000 006d .byte 0xe7, 0x11, 0x20, 0x00, 0x00, 0x6d
0x3ff80025bce: e755 6000 006d .byte 0xe7, 0x55, 0x60, 0x00, 0x00, 0x6d
0x3ff80025bd4: e799 a000 006d .byte 0xe7, 0x99, 0xa0, 0x00, 0x00, 0x6d
0x3ff80025bda: e7dd e000 006d .byte 0xe7, 0xdd, 0xe0, 0x00, 0x00, 0x6d
0x3ff80025be0: e711 2000 0e6d .byte 0xe7, 0x11, 0x20, 0x00, 0x0e, 0x6d
0x3ff80025be6: e755 6000 0e6d .byte 0xe7, 0x55, 0x60, 0x00, 0x0e, 0x6d
0x3ff80025bec: e711 000c 2033 .byte 0xe7, 0x11, 0x00, 0x0c, 0x20, 0x33
0x3ff80025bf2: e755 000c 2033 .byte 0xe7, 0x55, 0x00, 0x0c, 0x20, 0x33
0x3ff80025bf8: e799 000c 2033 .byte 0xe7, 0x99, 0x00, 0x0c, 0x20, 0x33
0x3ff80025bfe: e7dd 000c 2033 .byte 0xe7, 0xdd, 0x00, 0x0c, 0x20, 0x33
0x3ff80025c04: e711 000c 2c33 .byte 0xe7, 0x11, 0x00, 0x0c, 0x2c, 0x33
0x3ff80025c0a: e755 000c 2c33 .byte 0xe7, 0x55, 0x00, 0x0c, 0x2c, 0x33
0x3ff80025c10: e700 1000 20f3 .byte 0xe7, 0x00, 0x10, 0x00, 0x20, 0xf3
0x3ff80025c16: e744 5000 20f3 .byte 0xe7, 0x44, 0x50, 0x00, 0x20, 0xf3
0x3ff80025c1c: e788 9000 20f3 .byte 0xe7, 0x88, 0x90, 0x00, 0x20, 0xf3
0x3ff80025c22: e7cc d000 20f3 .byte 0xe7, 0xcc, 0xd0, 0x00, 0x20, 0xf3
0x3ff80025c28: e700 1000 2ef3 .byte 0xe7, 0x00, 0x10, 0x00, 0x2e, 0xf3
0x3ff80025c2e: e744 5000 2ef3 .byte 0xe7, 0x44, 0x50, 0x00, 0x2e, 0xf3
0x3ff80025c34: e733 0000 006d .byte 0xe7, 0x33, 0x00, 0x00, 0x00, 0x6d
0x3ff80025c3a: e777 4000 006d .byte 0xe7, 0x77, 0x40, 0x00, 0x00, 0x6d
0x3ff80025c40: e7bb 8000 006d .byte 0xe7, 0xbb, 0x80, 0x00, 0x00, 0x6d
0x3ff80025c46: e7ff c000 006d .byte 0xe7, 0xff, 0xc0, 0x00, 0x00, 0x6d
0x3ff80025c4c: e733 0000 0e6d .byte 0xe7, 0x33, 0x00, 0x00, 0x0e, 0x6d
0x3ff80025c52: e777 4000 0e6d .byte 0xe7, 0x77, 0x40, 0x00, 0x0e, 0x6d
0x3ff80025c58: e733 0008 2033 .byte 0xe7, 0x33, 0x00, 0x08, 0x20, 0x33
Regards,
Phil.
- Re: chacha20-s390 broken in 8.2.0 in TCG on s390x,
Philippe Mathieu-Daudé <=