Skip to content

Use of TSTEQ/TSTNE has regressed the cdrom test when running a 32 bit build of qemu-system-x86_64 using TCG

Host environment

  • Operating system: Debian Bookworm
  • OS/kernel version: Linux draig 6.9.4-ajb #14 SMP PREEMPT_DYNAMIC Sat Jun 15 09:30:07 BST 2024 x86_64 GNU/Linux
  • Architecture: x86_64
  • QEMU flavor: qemu-system-x86_64
  • QEMU version: 15957eb9
  • QEMU command line: meson test -t 0.05 qtest-x86_64/cdrom-test V=1

Emulated/Virtualized environment

  • Architecture: qtest-x86_64/cdrom-test (/x86_64/cdrom/boot/lsi53c895a)

Description of problem

The test freezes, eventually timing out. The bisect was confused by other SEV related things so I had to whittle down the config to --disable-kvm.

Steps to reproduce

  1. '../../configure' '--disable-docs' '--disable-user' '--cross-prefix=i686-linux-gnu-' '--target-list=x86_64-softmmu' '--enable-debug' '--disable-kvm'
  2. ninja
  3. meson test -t 0.05 qtest-x86_64/cdrom-test V=1

Additional information

Bisect run pointed at:

commit 15957eb9efe2da67c796612cead95cba28ba9bda
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Fri Oct 27 05:57:31 2023 +0200

    target/i386: use TSTEQ/TSTNE to test low bits
    
    When testing the sign bit or equality to zero of a partial register, it
    is useful to use a single TSTEQ or TSTNE operation.  It can also be used
    to test the parity flag, using bit 0 of the population count.
    
    Do not do this for target_ulong-sized values however; the optimizer would
    produce a comparison against zero anyway, and it avoids shifts by 64
    which are undefined behavior.
    
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

 target/i386/tcg/translate.c | 28 ++++++++++++++++++++--------
 target/i386/tcg/emit.c.inc  |  5 ++---
 2 files changed, 22 insertions(+), 11 deletions(-)
bisect found first bad commit⏎                                                          
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information