On 23/9/25 04:39, Richard Henderson wrote:
We need not call tb_flush once per cpu, only once per vmload.

By moving the call from cpu_common_post_load to a tcg-specific
vm_change_state_handler, we do even better than that: we only
flush when called from HMP triggered loadvm, when we had old
state to flush.

Nice!

Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
---
Cc: Peter Xu <[email protected]>
---
  accel/tcg/tcg-all.c  | 21 +++++++++++++++++++++
  hw/core/cpu-system.c |  8 --------
  2 files changed, 21 insertions(+), 8 deletions(-)


diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 09c928c1f9..1fd9571017 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -207,14 +207,6 @@ static int cpu_common_post_load(void *opaque, int 
version_id)
          cpu_reset_interrupt(cpu, 0x01);
tlb_flush(cpu);
-
-        /*
-         * loadvm has just updated the content of RAM, bypassing the
-         * usual mechanisms that ensure we flush TBs for writes to
-         * memory we've translated code from. So we must flush all TBs,
-         * which will now be stale.
-         */
-        tb_flush(cpu);
      }

To squash:

-- >8 --
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -25,3 +25,2 @@
 #include "system/memory.h"
-#include "exec/tb-flush.h"
 #include "qemu/target-info.h"---
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>


Reply via email to