Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Mon, May 22, 2017 at 06:00:12PM +0430, ali saeedi wrote: >> does this code 'atomic_rcu_read(&migration_bitmap_rcu)->bmap' return bitmap >> of dirty blocks or bitmap of pages? > > This code changed recently. Please refer to qemu.git/master when asking > questions on qemu-devel. > > I think you're asking about what is now RAMBlock->bmap. This bitmap > describes pages (each page is TARGET_PAGE_SIZE bytes). > > This comment looks outdated, I don't think it returns a byte offset: > > /** > * migration_bitmap_find_dirty: find the next dirty page from start > * > * Called with rcu_read_lock() to protect migration_bitmap > * > * Returns the byte offset within memory region of the start of a dirty page > * > * @rs: current RAM state > * @rb: RAMBlock where to search for dirty pages > * @start: page where we start the search > */ > static inline > unsigned long migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, > unsigned long start) > > Evidence: > > static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again) > { > pss->page = migration_bitmap_find_dirty(rs, pss->block, pss->page); > ... > if ((pss->page << TARGET_PAGE_BITS) >= pss->block->used_length) { > > Stefan
Oops, thanks you are right. We used to have a global dirty bitmap. As far as I know, it has always worked on pages. TARGET_PAGE_SIZE to be exact. Since 2.10 open out, we moved to a bitmap by RAMBlock. It used to return an absolute page number, now it returns a page number relative to the start of the block. Later, Juan.