Re: [Qemu-devel] [PATCH RFC 00/17] Dirty bitmaps postcopy migration

2016-03-25 Thread Vladimir Sementsov-Ogievskiy

Hi there.. ping. Hey, what do you think about this all?

On 12.02.2016 21:00, Vladimir Sementsov-Ogievskiy wrote:

Hi all!

These series are derived from my 'Dirty bitmaps migration' series. The
core idea is switch to postcopy migration and drop usage of meta
bitmaps.

These patches provide dirty bitmap postcopy migration feature. Only
named dirty bitmaps are to be migrated. Migration may be enabled using
migration capabilities.

The overall method (thanks to John Snow):

1. migrate bitmaps meta data in .save_live_setup
- create/find related bitmaps on target
- disable them
- create successors (anonimous children) only for enabled migrated
  bitmaps
2. do nothing in precopy stage
3. just before target vm start: enable successors, created in (1)
4. migrate bitmap data
5. reclaime bitmaps (merge successors to their parents)
6. enable bitmaps (only bitmaps, which was enabled in source)


Some patches are unchnaged from (v7) of 'Dirty bitmaps migration'
(DBMv7). I've left Reviewed-by's for them, if you don't like it, say me
and I'll drop them in the following version.

So, relatively to last DBMv7:

01-04: new patches, splitting common postcopy migration out of ram
postcopy migration
05: equal to DBMv7.05
06: new
07: equal to DBMv7.06
08: new
09: equal to DBMv7.07
10: new
11: derived from DBMv7.08, see below
12-15: equal to DBMv7.09-12
16: derived from DBMv7.13
- switch from fifo to socket, as postcopy don't work with fifo
  for now
- change parameters: size, granularity, regions
- add time.sleep, to wait for postcopy migration phase (bad
  temporary solution.
- drop Reviewed-by
17: new

11: the core patch of the series, it is derived from
[DBMv7.08: migration: add migration_block-dirty-bitmap.c]
There are a lot of changes related to switching from precopy to
postcopy, but functions related to migration stream itself
(structs, send/load sequences) are mostly unchnaged.

So, changes, to switch from precopy to postcopy:
- removed all staff related to meta bitmaps and dirty phase!!!
- add dirty_bitmap_mig_enable_successors, and call it before
  target vm start in loadvm_postcopy_handle_run
- add enabled_bitmaps list of bitmaps for
  dirty_bitmap_mig_enable_successors

- enabled flag is send with start bitmap chunk instead of
  completion chunk
- sectors_per_chunk is calculated directly from CHUNK_SIZE, not
  using meta bitmap granularity

- dirty_bitmap_save_iterate: remove dirty_phase, move bulk_phase
  to postcopy stage
- dirty_bitmap_save_pending: remove dirty phase related pending,
  switch pending to non-postcopyable
- dirty_bitmap_load_start: get enabled flag and prepare
  successors for enabled bitmaps, also add them to
  enabled_bitmaps list
- dirty_bitmap_load_complete: for enabled bitmaps: merge them
  with successors and enable

- savevm handlers:
  * remove separate savevm_dirty_bitmap_live_iterate_handlers state
(it was bad idea, any way), and move its save_live_iterate to
savevm_dirty_bitmap_handlers
  * add is_active_iterate savevm handler, which allows iterations
only in postcopy stage (after stopping source vm)
  * add has_postcopy savevm handler. (ofcourse, just returning true)
  * use save_live_complete_postcopy instead of
save_live_complete_precopy

Other changes:
- some debug output changed
- remove MIN_LIVE_SIZE, is_live_iterative and related staff (it
  was needed to omit iterations if bitmap data is small, possibly
  this should be reimplemented)

Vladimir Sementsov-Ogievskiy (17):
   migration: add has_postcopy savevm handler
   migration: fix ram_save_pending
   migration: split common postcopy out of ram postcopy
   migration: introduce postcopy-only pending
   block: add bdrv_next_dirty_bitmap()
   block: add bdrv_dirty_bitmap_enable_successor()
   qapi: add dirty-bitmaps migration capability
   migration: include migrate_dirty_bitmaps in migrate_postcopy
   migration/qemu-file: add qemu_put_counted_string()
   migration: add is_active_iterate handler
   migration: add postcopy migration of dirty bitmaps
   iotests: maintain several vms in test
   iotests: add add_incoming_migration to VM class
   qapi: add md5 checksum of last dirty bitmap level to query-block
   iotests: add default node-name
   iotests: add dirty bitmap migration test 117
   iotests: add dirty bitmap migration test 170

  block/dirty-bitmap.c   |  16 +
  include/block/dirty-bitmap.h   |   4 +
  include/migration/block.h  |   1 +
  include/migration/migration.h  |   5 +
  include/migration/qemu-file.h  |   2 +
  include/migration/vmstate.h|   7 +-
  include/qemu/hbitmap.h |   

Re: [Qemu-devel] [PATCH RFC 00/17] Dirty bitmaps postcopy migration

2016-03-14 Thread John Snow
Juan, have you had the chance to look at this yet?

--js

On 03/14/2016 07:37 AM, Vladimir Sementsov-Ogievskiy wrote:
> ping
> 
> On 12.02.2016 21:00, Vladimir Sementsov-Ogievskiy wrote:
>> Hi all!
>>
>> These series are derived from my 'Dirty bitmaps migration' series. The
>> core idea is switch to postcopy migration and drop usage of meta
>> bitmaps.
>>
>> These patches provide dirty bitmap postcopy migration feature. Only
>> named dirty bitmaps are to be migrated. Migration may be enabled using
>> migration capabilities.
>>
>> The overall method (thanks to John Snow):
>>
>> 1. migrate bitmaps meta data in .save_live_setup
>> - create/find related bitmaps on target
>> - disable them
>> - create successors (anonimous children) only for enabled migrated
>>   bitmaps
>> 2. do nothing in precopy stage
>> 3. just before target vm start: enable successors, created in (1)
>> 4. migrate bitmap data
>> 5. reclaime bitmaps (merge successors to their parents)
>> 6. enable bitmaps (only bitmaps, which was enabled in source)
>>
>>
>> Some patches are unchnaged from (v7) of 'Dirty bitmaps migration'
>> (DBMv7). I've left Reviewed-by's for them, if you don't like it, say me
>> and I'll drop them in the following version.
>>
>> So, relatively to last DBMv7:
>>
>> 01-04: new patches, splitting common postcopy migration out of ram
>> postcopy migration
>> 05: equal to DBMv7.05
>> 06: new
>> 07: equal to DBMv7.06
>> 08: new
>> 09: equal to DBMv7.07
>> 10: new
>> 11: derived from DBMv7.08, see below
>> 12-15: equal to DBMv7.09-12
>> 16: derived from DBMv7.13
>> - switch from fifo to socket, as postcopy don't work with fifo
>>   for now
>> - change parameters: size, granularity, regions
>> - add time.sleep, to wait for postcopy migration phase (bad
>>   temporary solution.
>> - drop Reviewed-by
>> 17: new
>>
>> 11: the core patch of the series, it is derived from
>> [DBMv7.08: migration: add migration_block-dirty-bitmap.c]
>> There are a lot of changes related to switching from precopy to
>> postcopy, but functions related to migration stream itself
>> (structs, send/load sequences) are mostly unchnaged.
>>
>> So, changes, to switch from precopy to postcopy:
>> - removed all staff related to meta bitmaps and dirty phase!!!
>> - add dirty_bitmap_mig_enable_successors, and call it before
>>   target vm start in loadvm_postcopy_handle_run
>> - add enabled_bitmaps list of bitmaps for
>>   dirty_bitmap_mig_enable_successors
>>
>> - enabled flag is send with start bitmap chunk instead of
>>   completion chunk
>> - sectors_per_chunk is calculated directly from CHUNK_SIZE, not
>>   using meta bitmap granularity
>>
>> - dirty_bitmap_save_iterate: remove dirty_phase, move bulk_phase
>>   to postcopy stage
>> - dirty_bitmap_save_pending: remove dirty phase related pending,
>>   switch pending to non-postcopyable
>> - dirty_bitmap_load_start: get enabled flag and prepare
>>   successors for enabled bitmaps, also add them to
>>   enabled_bitmaps list
>> - dirty_bitmap_load_complete: for enabled bitmaps: merge them
>>   with successors and enable
>>
>> - savevm handlers:
>>   * remove separate savevm_dirty_bitmap_live_iterate_handlers
>> state
>> (it was bad idea, any way), and move its save_live_iterate to
>> savevm_dirty_bitmap_handlers
>>   * add is_active_iterate savevm handler, which allows iterations
>> only in postcopy stage (after stopping source vm)
>>   * add has_postcopy savevm handler. (ofcourse, just returning
>> true)
>>   * use save_live_complete_postcopy instead of
>> save_live_complete_precopy
>>
>> Other changes:
>> - some debug output changed
>> - remove MIN_LIVE_SIZE, is_live_iterative and related staff (it
>>   was needed to omit iterations if bitmap data is small, possibly
>>   this should be reimplemented)
>>
>> Vladimir Sementsov-Ogievskiy (17):
>>migration: add has_postcopy savevm handler
>>migration: fix ram_save_pending
>>migration: split common postcopy out of ram postcopy
>>migration: introduce postcopy-only pending
>>block: add bdrv_next_dirty_bitmap()
>>block: add bdrv_dirty_bitmap_enable_successor()
>>qapi: add dirty-bitmaps migration capability
>>migration: include migrate_dirty_bitmaps in migrate_postcopy
>>migration/qemu-file: add qemu_put_counted_string()
>>migration: add is_active_iterate handler
>>migration: add postcopy migration of dirty bitmaps
>>iotests: maintain several vms in test
>>iotests: add add_incoming_migration to VM class
>>qapi: add md5 checksum of last dirty bitmap level to query-block
>>iotests: add default 

Re: [Qemu-devel] [PATCH RFC 00/17] Dirty bitmaps postcopy migration

2016-03-14 Thread Vladimir Sementsov-Ogievskiy

ping

On 12.02.2016 21:00, Vladimir Sementsov-Ogievskiy wrote:

Hi all!

These series are derived from my 'Dirty bitmaps migration' series. The
core idea is switch to postcopy migration and drop usage of meta
bitmaps.

These patches provide dirty bitmap postcopy migration feature. Only
named dirty bitmaps are to be migrated. Migration may be enabled using
migration capabilities.

The overall method (thanks to John Snow):

1. migrate bitmaps meta data in .save_live_setup
- create/find related bitmaps on target
- disable them
- create successors (anonimous children) only for enabled migrated
  bitmaps
2. do nothing in precopy stage
3. just before target vm start: enable successors, created in (1)
4. migrate bitmap data
5. reclaime bitmaps (merge successors to their parents)
6. enable bitmaps (only bitmaps, which was enabled in source)


Some patches are unchnaged from (v7) of 'Dirty bitmaps migration'
(DBMv7). I've left Reviewed-by's for them, if you don't like it, say me
and I'll drop them in the following version.

So, relatively to last DBMv7:

01-04: new patches, splitting common postcopy migration out of ram
postcopy migration
05: equal to DBMv7.05
06: new
07: equal to DBMv7.06
08: new
09: equal to DBMv7.07
10: new
11: derived from DBMv7.08, see below
12-15: equal to DBMv7.09-12
16: derived from DBMv7.13
- switch from fifo to socket, as postcopy don't work with fifo
  for now
- change parameters: size, granularity, regions
- add time.sleep, to wait for postcopy migration phase (bad
  temporary solution.
- drop Reviewed-by
17: new

11: the core patch of the series, it is derived from
[DBMv7.08: migration: add migration_block-dirty-bitmap.c]
There are a lot of changes related to switching from precopy to
postcopy, but functions related to migration stream itself
(structs, send/load sequences) are mostly unchnaged.

So, changes, to switch from precopy to postcopy:
- removed all staff related to meta bitmaps and dirty phase!!!
- add dirty_bitmap_mig_enable_successors, and call it before
  target vm start in loadvm_postcopy_handle_run
- add enabled_bitmaps list of bitmaps for
  dirty_bitmap_mig_enable_successors

- enabled flag is send with start bitmap chunk instead of
  completion chunk
- sectors_per_chunk is calculated directly from CHUNK_SIZE, not
  using meta bitmap granularity

- dirty_bitmap_save_iterate: remove dirty_phase, move bulk_phase
  to postcopy stage
- dirty_bitmap_save_pending: remove dirty phase related pending,
  switch pending to non-postcopyable
- dirty_bitmap_load_start: get enabled flag and prepare
  successors for enabled bitmaps, also add them to
  enabled_bitmaps list
- dirty_bitmap_load_complete: for enabled bitmaps: merge them
  with successors and enable

- savevm handlers:
  * remove separate savevm_dirty_bitmap_live_iterate_handlers state
(it was bad idea, any way), and move its save_live_iterate to
savevm_dirty_bitmap_handlers
  * add is_active_iterate savevm handler, which allows iterations
only in postcopy stage (after stopping source vm)
  * add has_postcopy savevm handler. (ofcourse, just returning true)
  * use save_live_complete_postcopy instead of
save_live_complete_precopy

Other changes:
- some debug output changed
- remove MIN_LIVE_SIZE, is_live_iterative and related staff (it
  was needed to omit iterations if bitmap data is small, possibly
  this should be reimplemented)

Vladimir Sementsov-Ogievskiy (17):
   migration: add has_postcopy savevm handler
   migration: fix ram_save_pending
   migration: split common postcopy out of ram postcopy
   migration: introduce postcopy-only pending
   block: add bdrv_next_dirty_bitmap()
   block: add bdrv_dirty_bitmap_enable_successor()
   qapi: add dirty-bitmaps migration capability
   migration: include migrate_dirty_bitmaps in migrate_postcopy
   migration/qemu-file: add qemu_put_counted_string()
   migration: add is_active_iterate handler
   migration: add postcopy migration of dirty bitmaps
   iotests: maintain several vms in test
   iotests: add add_incoming_migration to VM class
   qapi: add md5 checksum of last dirty bitmap level to query-block
   iotests: add default node-name
   iotests: add dirty bitmap migration test 117
   iotests: add dirty bitmap migration test 170

  block/dirty-bitmap.c   |  16 +
  include/block/dirty-bitmap.h   |   4 +
  include/migration/block.h  |   1 +
  include/migration/migration.h  |   5 +
  include/migration/qemu-file.h  |   2 +
  include/migration/vmstate.h|   7 +-
  include/qemu/hbitmap.h |   8 +
  include/sysemu/sysemu.h|   5 +-
  

[Qemu-devel] [PATCH RFC 00/17] Dirty bitmaps postcopy migration

2016-02-12 Thread Vladimir Sementsov-Ogievskiy
Hi all!

These series are derived from my 'Dirty bitmaps migration' series. The
core idea is switch to postcopy migration and drop usage of meta
bitmaps.

These patches provide dirty bitmap postcopy migration feature. Only
named dirty bitmaps are to be migrated. Migration may be enabled using
migration capabilities.

The overall method (thanks to John Snow):

1. migrate bitmaps meta data in .save_live_setup
   - create/find related bitmaps on target
   - disable them
   - create successors (anonimous children) only for enabled migrated
 bitmaps
2. do nothing in precopy stage
3. just before target vm start: enable successors, created in (1)
4. migrate bitmap data
5. reclaime bitmaps (merge successors to their parents)
6. enable bitmaps (only bitmaps, which was enabled in source)


Some patches are unchnaged from (v7) of 'Dirty bitmaps migration'
(DBMv7). I've left Reviewed-by's for them, if you don't like it, say me
and I'll drop them in the following version.

So, relatively to last DBMv7: 

01-04: new patches, splitting common postcopy migration out of ram
   postcopy migration
   05: equal to DBMv7.05
   06: new
   07: equal to DBMv7.06
   08: new
   09: equal to DBMv7.07
   10: new
   11: derived from DBMv7.08, see below
12-15: equal to DBMv7.09-12
   16: derived from DBMv7.13
   - switch from fifo to socket, as postcopy don't work with fifo
 for now
   - change parameters: size, granularity, regions
   - add time.sleep, to wait for postcopy migration phase (bad
 temporary solution.
   - drop Reviewed-by
   17: new

   11: the core patch of the series, it is derived from
   [DBMv7.08: migration: add migration_block-dirty-bitmap.c]
   There are a lot of changes related to switching from precopy to
   postcopy, but functions related to migration stream itself
   (structs, send/load sequences) are mostly unchnaged.

   So, changes, to switch from precopy to postcopy:
   - removed all staff related to meta bitmaps and dirty phase!!!
   - add dirty_bitmap_mig_enable_successors, and call it before
 target vm start in loadvm_postcopy_handle_run
   - add enabled_bitmaps list of bitmaps for
 dirty_bitmap_mig_enable_successors

   - enabled flag is send with start bitmap chunk instead of
 completion chunk
   - sectors_per_chunk is calculated directly from CHUNK_SIZE, not
 using meta bitmap granularity

   - dirty_bitmap_save_iterate: remove dirty_phase, move bulk_phase
 to postcopy stage
   - dirty_bitmap_save_pending: remove dirty phase related pending,
 switch pending to non-postcopyable
   - dirty_bitmap_load_start: get enabled flag and prepare
 successors for enabled bitmaps, also add them to
 enabled_bitmaps list
   - dirty_bitmap_load_complete: for enabled bitmaps: merge them
 with successors and enable

   - savevm handlers:
 * remove separate savevm_dirty_bitmap_live_iterate_handlers state
   (it was bad idea, any way), and move its save_live_iterate to
   savevm_dirty_bitmap_handlers
 * add is_active_iterate savevm handler, which allows iterations
   only in postcopy stage (after stopping source vm)
 * add has_postcopy savevm handler. (ofcourse, just returning true)
 * use save_live_complete_postcopy instead of
   save_live_complete_precopy

   Other changes:
   - some debug output changed
   - remove MIN_LIVE_SIZE, is_live_iterative and related staff (it
 was needed to omit iterations if bitmap data is small, possibly
 this should be reimplemented)

Vladimir Sementsov-Ogievskiy (17):
  migration: add has_postcopy savevm handler
  migration: fix ram_save_pending
  migration: split common postcopy out of ram postcopy
  migration: introduce postcopy-only pending
  block: add bdrv_next_dirty_bitmap()
  block: add bdrv_dirty_bitmap_enable_successor()
  qapi: add dirty-bitmaps migration capability
  migration: include migrate_dirty_bitmaps in migrate_postcopy
  migration/qemu-file: add qemu_put_counted_string()
  migration: add is_active_iterate handler
  migration: add postcopy migration of dirty bitmaps
  iotests: maintain several vms in test
  iotests: add add_incoming_migration to VM class
  qapi: add md5 checksum of last dirty bitmap level to query-block
  iotests: add default node-name
  iotests: add dirty bitmap migration test 117
  iotests: add dirty bitmap migration test 170

 block/dirty-bitmap.c   |  16 +
 include/block/dirty-bitmap.h   |   4 +
 include/migration/block.h  |   1 +
 include/migration/migration.h  |   5 +
 include/migration/qemu-file.h  |   2 +
 include/migration/vmstate.h|   7 +-
 include/qemu/hbitmap.h |   8 +
 include/sysemu/sysemu.h|   5 +-
 migration/Makefile.objs|   2 +-
 migration/block-dirty-bitmap.c | 646 +
 migration/block.c 

Re: [Qemu-devel] [PATCH RFC 00/17] Dirty bitmaps postcopy migration

2016-02-12 Thread Vladimir Sementsov-Ogievskiy

Oh, sorry, significant note:

These patches are based on Fam's [PATCH v2 00/13] Dirty bitmap changes 
for migration/persistence work



On 12.02.2016 21:00, Vladimir Sementsov-Ogievskiy wrote:

Hi all!

These series are derived from my 'Dirty bitmaps migration' series. The
core idea is switch to postcopy migration and drop usage of meta
bitmaps.

These patches provide dirty bitmap postcopy migration feature. Only
named dirty bitmaps are to be migrated. Migration may be enabled using
migration capabilities.

The overall method (thanks to John Snow):

1. migrate bitmaps meta data in .save_live_setup
- create/find related bitmaps on target
- disable them
- create successors (anonimous children) only for enabled migrated
  bitmaps
2. do nothing in precopy stage
3. just before target vm start: enable successors, created in (1)
4. migrate bitmap data
5. reclaime bitmaps (merge successors to their parents)
6. enable bitmaps (only bitmaps, which was enabled in source)


Some patches are unchnaged from (v7) of 'Dirty bitmaps migration'
(DBMv7). I've left Reviewed-by's for them, if you don't like it, say me
and I'll drop them in the following version.

So, relatively to last DBMv7:

01-04: new patches, splitting common postcopy migration out of ram
postcopy migration
05: equal to DBMv7.05
06: new
07: equal to DBMv7.06
08: new
09: equal to DBMv7.07
10: new
11: derived from DBMv7.08, see below
12-15: equal to DBMv7.09-12
16: derived from DBMv7.13
- switch from fifo to socket, as postcopy don't work with fifo
  for now
- change parameters: size, granularity, regions
- add time.sleep, to wait for postcopy migration phase (bad
  temporary solution.
- drop Reviewed-by
17: new

11: the core patch of the series, it is derived from
[DBMv7.08: migration: add migration_block-dirty-bitmap.c]
There are a lot of changes related to switching from precopy to
postcopy, but functions related to migration stream itself
(structs, send/load sequences) are mostly unchnaged.

So, changes, to switch from precopy to postcopy:
- removed all staff related to meta bitmaps and dirty phase!!!
- add dirty_bitmap_mig_enable_successors, and call it before
  target vm start in loadvm_postcopy_handle_run
- add enabled_bitmaps list of bitmaps for
  dirty_bitmap_mig_enable_successors

- enabled flag is send with start bitmap chunk instead of
  completion chunk
- sectors_per_chunk is calculated directly from CHUNK_SIZE, not
  using meta bitmap granularity

- dirty_bitmap_save_iterate: remove dirty_phase, move bulk_phase
  to postcopy stage
- dirty_bitmap_save_pending: remove dirty phase related pending,
  switch pending to non-postcopyable
- dirty_bitmap_load_start: get enabled flag and prepare
  successors for enabled bitmaps, also add them to
  enabled_bitmaps list
- dirty_bitmap_load_complete: for enabled bitmaps: merge them
  with successors and enable

- savevm handlers:
  * remove separate savevm_dirty_bitmap_live_iterate_handlers state
(it was bad idea, any way), and move its save_live_iterate to
savevm_dirty_bitmap_handlers
  * add is_active_iterate savevm handler, which allows iterations
only in postcopy stage (after stopping source vm)
  * add has_postcopy savevm handler. (ofcourse, just returning true)
  * use save_live_complete_postcopy instead of
save_live_complete_precopy

Other changes:
- some debug output changed
- remove MIN_LIVE_SIZE, is_live_iterative and related staff (it
  was needed to omit iterations if bitmap data is small, possibly
  this should be reimplemented)

Vladimir Sementsov-Ogievskiy (17):
   migration: add has_postcopy savevm handler
   migration: fix ram_save_pending
   migration: split common postcopy out of ram postcopy
   migration: introduce postcopy-only pending
   block: add bdrv_next_dirty_bitmap()
   block: add bdrv_dirty_bitmap_enable_successor()
   qapi: add dirty-bitmaps migration capability
   migration: include migrate_dirty_bitmaps in migrate_postcopy
   migration/qemu-file: add qemu_put_counted_string()
   migration: add is_active_iterate handler
   migration: add postcopy migration of dirty bitmaps
   iotests: maintain several vms in test
   iotests: add add_incoming_migration to VM class
   qapi: add md5 checksum of last dirty bitmap level to query-block
   iotests: add default node-name
   iotests: add dirty bitmap migration test 117
   iotests: add dirty bitmap migration test 170

  block/dirty-bitmap.c   |  16 +
  include/block/dirty-bitmap.h   |   4 +
  include/migration/block.h  |   1 +
  include/migration/migration.h  |   5 +
  include/migration/qemu-file.h  |   2 +