From: Stefan Hajnoczi <stefanha@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic
Date: Fri, 28 Nov 2014 12:44:05 +0000 [thread overview]
Message-ID: <20141128124405.GJ13631@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAFEAcA9DMuhVbTnuDXeMg9Bam5BDAgmvmY7CTXYPsitdXMcxfw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]
On Thu, Nov 27, 2014 at 01:21:54PM +0000, Peter Maydell wrote:
> On 27 November 2014 at 12:29, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> > 1. Convert all cpu_physical_memory_*_dirty() callers to use the API atomically.
> > There are TCG callers who things along the lines of:
> >
> > if (!cpu_physical_memory_get_dirty(addr)) {
> > cpu_physical_memory_set_dirty(addr); /* not atomic! */
> > }
>
> Which bit of code is this? Note that for the TCG DIRTY_MEMORY_CODE
> flag you have bigger problems than just whether the bitmap updates
> are atomic, because the sequence is:
> write to memory
> if (!dirty) {
> flush generated code tbs;
> set dirty;
> }
>
> and what you care about is that the existence of cached translations
> for this area of memory should be in sync with the state of the dirty
> bit, so the whole operation of "flush affected translations and set
> the dirty bit" needs to be thread-safe, I think.
This is an example of what I mean.
I'm not going to work on making TCG thread-safe in this series, and
there is no dangerous race condition in this code if we leave it as is.
But I'm not 100% sure of all cases, so I'll audit them again.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-11-28 12:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 12:29 [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions Stefan Hajnoczi
2014-11-27 16:42 ` Paolo Bonzini
2014-12-01 13:52 ` Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 2/6] bitmap: add atomic test and clear Stefan Hajnoczi
2014-11-27 16:43 ` Paolo Bonzini
2014-12-01 13:53 ` Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 3/6] memory: use atomic ops for setting dirty memory bits Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 4/6] migration: move dirty bitmap sync to ram_addr.h Stefan Hajnoczi
2014-11-27 16:29 ` Dr. David Alan Gilbert
2014-12-01 14:01 ` Stefan Hajnoczi
2014-12-01 14:49 ` Dr. David Alan Gilbert
2014-11-27 12:29 ` [Qemu-devel] [RFC 5/6] memory: replace cpu_physical_memory_reset_dirty() with test-and-clear Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 6/6] memory: make cpu_physical_memory_sync_dirty_bitmap() fully atomic Stefan Hajnoczi
2014-11-27 13:21 ` [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic Peter Maydell
2014-11-28 12:44 ` Stefan Hajnoczi [this message]
2015-03-23 11:09 ` Paolo Bonzini
2015-03-24 16:48 ` Stefan Hajnoczi
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=20141128124405.GJ13631@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@redhat.com \
--cc=stefanha@redhat.com \
/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).