[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic |
Date: |
Fri, 28 Nov 2014 12:44:05 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Nov 27, 2014 at 01:21:54PM +0000, Peter Maydell wrote:
> On 27 November 2014 at 12:29, Stefan Hajnoczi <address@hidden> 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
pgpwDYlw2Vex6.pgp
Description: PGP signature
- [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions, (continued)
- [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions, Stefan Hajnoczi, 2014/11/27
- [Qemu-devel] [RFC 2/6] bitmap: add atomic test and clear, Stefan Hajnoczi, 2014/11/27
- [Qemu-devel] [RFC 4/6] migration: move dirty bitmap sync to ram_addr.h, Stefan Hajnoczi, 2014/11/27
- [Qemu-devel] [RFC 3/6] memory: use atomic ops for setting dirty memory bits, Stefan Hajnoczi, 2014/11/27
- [Qemu-devel] [RFC 5/6] memory: replace cpu_physical_memory_reset_dirty() with test-and-clear, Stefan Hajnoczi, 2014/11/27
- [Qemu-devel] [RFC 6/6] memory: make cpu_physical_memory_sync_dirty_bitmap() fully atomic, Stefan Hajnoczi, 2014/11/27
- Re: [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic, Peter Maydell, 2014/11/27
- Re: [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic,
Stefan Hajnoczi <=