On 11/20/2017 02:27 PM, Peter Maydell wrote:
> - return (void *)((uintptr_t)addr + tlbe->addend);
> + hostaddr = (void *)((uintptr_t)addr + tlbe->addend);
> +
> + memory_notdirty_write_prepare(ndi, ENV_GET_CPU(env), addr,
> + qemu_ram_addr_from_host_nofail(hostaddr),
> + 1 << s_bits);
These calls should be conditional on TLB_NOTDIRTY being set.
We certainly don't need to do anything like taking a lock otherwise.
Perhaps an extra bool in NDI, like
ndi->active = false;
if (unlikely(tlb_addr & TLB_NOTDIRTY)) {
ndi->active = true;
memory_notdirty_write_prepare(ndi, ...);
}
and
#define ATOMIC_MMU_CLEANUP \
do { \
if (unlikely(ndi->active)) { \
memory_notdirty_write_complete(ndi); \
} \
} while (0)
r~