On 27 November 2014 at 12:29, Stefan Hajnoczi <stefa...@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. -- PMM