qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Stuart Monteith <stuart.monteith@linaro.org>
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	[thread overview]
Message-ID: <1aaf0a6f-c38b-d80d-b09a-1a54545c7660@twiddle.net> (raw)
In-Reply-To: <1511184421-23535-3-git-send-email-peter.maydell@linaro.org>

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	other threads:[~2017-11-20 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 13:26 [Qemu-devel] [PATCH for-2.11 0/2] Fix TCG atomic writes to nondirty pages Peter Maydell
2017-11-20 13:27 ` [Qemu-devel] [PATCH for-2.11 1/2] exec.c: Factor out before/after actions for notdirty memory writes Peter Maydell
2017-11-20 14:28   ` Richard Henderson
2017-11-20 13:27 ` [Qemu-devel] [PATCH for-2.11 2/2] accel/tcg: Handle atomic accesses to notdirty memory correctly Peter Maydell
2017-11-20 14:27   ` Richard Henderson [this message]
2017-11-20 14:47     ` Peter Maydell
2017-11-20 15:00       ` Richard Henderson
2017-11-20 18:09         ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1aaf0a6f-c38b-d80d-b09a-1a54545c7660@twiddle.net \
    --to=rth@twiddle.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stuart.monteith@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).