[Top][All Lists]

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

[Qemu-commits] [qemu/qemu] 272662: exec.c: Factor out before/after actio

From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 272662: exec.c: Factor out before/after actions for notdir...
Date: Tue, 21 Nov 2017 04:47:38 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 27266271977c5a30f2f7d493e042be1897827bdd
  Author: Peter Maydell <address@hidden>
  Date:   2017-11-21 (Tue, 21 Nov 2017)

  Changed paths:
    M exec.c
    M include/exec/memory-internal.h

  Log Message:
  exec.c: Factor out before/after actions for notdirty memory writes

The function notdirty_mem_write() has a sequence of actions
it has to do before and after the actual business of writing
data to host RAM to ensure that dirty flags are correctly
updated and we flush any TCG translations for the region.
We need to do this also in other places that write directly
to host RAM, most notably the TCG atomic helper functions.
Pull out the before and after pieces into their own functions.

We use an API where the prepare function stashes the various
bits of information about the write into a struct for the
complete function to use, because in the calls for the atomic
helpers the place where the complete function will be called
doesn't have the information to hand.

Cc: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden

  Commit: 34d49937e480edfa173d71e8c17972ad866b56c6
  Author: Peter Maydell <address@hidden>
  Date:   2017-11-21 (Tue, 21 Nov 2017)

  Changed paths:
    M accel/tcg/atomic_template.h
    M accel/tcg/cputlb.c
    M accel/tcg/user-exec.c

  Log Message:
  accel/tcg: Handle atomic accesses to notdirty memory correctly

To do a write to memory that is marked as notdirty, we need
to invalidate any TBs we have cached for that memory, and
update the cpu physical memory dirty flags for VGA and migration.
The slowpath code in notdirty_mem_write() does all this correctly,
but the new atomic handling code in atomic_mmu_lookup() doesn't
do anything at all, it just clears the dirty bit in the TLB.

The effect of this bug is that if the first write to a notdirty
page for which we have cached TBs is by a guest atomic access,
we fail to invalidate the TBs and subsequently will execute
incorrect code. This can be seen by trying to run 'javac' on AArch64.

Use the new notdirty_call_before() and notdirty_call_after()
functions to correctly handle the update to notdirty memory
in the atomic codepath.

Cc: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden

Compare: https://github.com/qemu/qemu/compare/a61d343986c1...34d49937e480

reply via email to

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