qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] afd46f: icount: fix cpu_restore_state_from_tb


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] afd46f: icount: fix cpu_restore_state_from_tb for non-tb-e...
Date: Wed, 11 Apr 2018 08:12:27 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: afd46fcad2dceffda35c0586f5723c127b6e09d8
      
https://github.com/qemu/qemu/commit/afd46fcad2dceffda35c0586f5723c127b6e09d8
  Author: Pavel Dovgalyuk <address@hidden>
  Date:   2018-04-11 (Wed, 11 Apr 2018)

  Changed paths:
    M accel/tcg/cpu-exec-common.c
    M accel/tcg/cpu-exec.c
    M accel/tcg/translate-all.c
    M accel/tcg/user-exec.c
    M hw/misc/mips_itu.c
    M include/exec/exec-all.h
    M target/alpha/helper.c
    M target/alpha/mem_helper.c
    M target/arm/op_helper.c
    M target/cris/op_helper.c
    M target/i386/helper.c
    M target/i386/svm_helper.c
    M target/m68k/op_helper.c
    M target/moxie/helper.c
    M target/openrisc/sys_helper.c
    M target/tricore/op_helper.c
    M target/xtensa/op_helper.c

  Log Message:
  -----------
  icount: fix cpu_restore_state_from_tb for non-tb-exit cases

In icount mode, instructions that access io memory spaces in the middle
of the translation block invoke TB recompilation.  After recompilation,
such instructions become last in the TB and are allowed to access io
memory spaces.

When the code includes instruction like i386 'xchg eax, 0xffffd080'
which accesses APIC, QEMU goes into an infinite loop of the recompilation.

This instruction includes two memory accesses - one read and one write.
After the first access, APIC calls cpu_report_tpr_access, which restores
the CPU state to get the current eip.  But cpu_restore_state_from_tb
resets the cpu->can_do_io flag which makes the second memory access invalid.
Therefore the second memory access causes a recompilation of the block.
Then these operations repeat again and again.

This patch moves resetting cpu->can_do_io flag from
cpu_restore_state_from_tb to cpu_loop_exit* functions.

It also adds a parameter for cpu_restore_state which controls restoring
icount.  There is no need to restore icount when we only query CPU state
without breaking the TB.  Restoring it in such cases leads to the
incorrect flow of the virtual time.

In most cases new parameter is true (icount should be recalculated).
But there are two cases in i386 and openrisc when the CPU state is only
queried without the need to break the TB.  This patch fixes both of
these cases.

Signed-off-by: Pavel Dovgalyuk <address@hidden>
Message-Id: <address@hidden>
[rth: Make can_do_io setting unconditional; move from cpu_exec;
make cpu_loop_exit_{noexc,restore} call cpu_loop_exit.]
Signed-off-by: Richard Henderson <address@hidden>


  Commit: 6523eaca378df1455481f1cec65ada589d65df0e
      
https://github.com/qemu/qemu/commit/6523eaca378df1455481f1cec65ada589d65df0e
  Author: Peter Maydell <address@hidden>
  Date:   2018-04-11 (Wed, 11 Apr 2018)

  Changed paths:
    M accel/tcg/cpu-exec-common.c
    M accel/tcg/cpu-exec.c
    M accel/tcg/translate-all.c
    M accel/tcg/user-exec.c
    M hw/misc/mips_itu.c
    M include/exec/exec-all.h
    M target/alpha/helper.c
    M target/alpha/mem_helper.c
    M target/arm/op_helper.c
    M target/cris/op_helper.c
    M target/i386/helper.c
    M target/i386/svm_helper.c
    M target/m68k/op_helper.c
    M target/moxie/helper.c
    M target/openrisc/sys_helper.c
    M target/tricore/op_helper.c
    M target/xtensa/op_helper.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180411' into staging

Handle read-modify-write i/o with icount

# gpg: Signature made Wed 11 Apr 2018 00:07:23 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <address@hidden>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180411:
  icount: fix cpu_restore_state_from_tb for non-tb-exit cases

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/675608cb8468...6523eaca378d

reply via email to

[Prev in Thread] Current Thread [Next in Thread]