qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.11 2/2] accel/tcg: Handle atomic accesses


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH for-2.11 2/2] accel/tcg: Handle atomic accesses to notdirty memory correctly
Date: Mon, 20 Nov 2017 15:27:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

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~



reply via email to

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