Hi We have foo_save_live() functions that did 4 things depending on stage parameter: * -1: cancel * 1: setup phase * 2: iterate live phase * 3: complete phase
So this series split this functions in 4 functions, one for each phase. We start just moving code, i.e. not doing any change. Once we do that, we do some optimization: - create is_active() method. We were sending _always_ in each iteration information about block migration, even when that sections were empty. This fix that (micro optimization, but makes much easier to look at traces) - for ram, we move the loops to something reasonable: * setup: no pages sent (we used to send here) * iterate: pages sent as usual * complete: instead of sending pages in 2 loops, we send in a single loop. - Optimization: the previous to last patch is an optimization that existed on qemu-kvm tree before I started handling it. For huge memory machines, it makes no sense to synchonize the bitmap each time that we enter the iterate function, we only synchronize it when we have few dirty pages. This patches apply on top of the pull request that I just sent to the list. You can get it also from my qemu repository: The following changes since commit a6b61e393908b0d7110d9fab9bfda7b12457bc80: Maintain the number of dirty pages (2012-06-28 15:34:37 +0200) are available in the git repository at: http://repo.or.cz/r/qemu/quintela.git save_live_refactorig for you to fetch changes up to ab1ca756b1cfe67df94f7c6674ea86f6d7232a2f: ram: save_live_setup() we don't need to synchronize the dirty bitmap. (2012-06-28 20:51:58 +0200) ---------------------------------------------------------------- Juan Quintela (12): savevm: Use a struct to pass all handlers savevm: Live migration handlers register the struct directly savevm: remove SaveSetParamsHandler savevm: remove SaveLiveStateHandler savevm: Refactor cancel operation in its own operation savevm: introduce is_active method savevm: split save_live_setup from save_live_state savevm: split save_live into stage2 and stage3 ram: save_live_setup() don't need to sent pages ram: save_live_complete() only do one loop ram: iterate phase ram: save_live_setup() we don't need to synchronize the dirty bitmap. arch_init.c | 118 ++++++++++++++++++++++++----------------- block-migration.c | 153 +++++++++++++++++++++++++++++++++++------------------ migration.h | 4 +- savevm.c | 77 +++++++++++++++------------ vl.c | 3 +- vmstate.h | 18 ++++--- 6 files changed, 228 insertions(+), 145 deletions(-) Please review. Juan Quintela (12): savevm: Use a struct to pass all handlers savevm: Live migration handlers register the struct directly savevm: remove SaveSetParamsHandler savevm: remove SaveLiveStateHandler savevm: Refactor cancel operation in its own operation savevm: introduce is_active method savevm: split save_live_setup from save_live_state savevm: split save_live into stage2 and stage3 ram: save_live_setup() don't need to sent pages ram: save_live_complete() only do one loop ram: iterate phase ram: save_live_setup() we don't need to synchronize the dirty bitmap. arch_init.c | 118 ++++++++++++++++++++++++----------------- block-migration.c | 153 +++++++++++++++++++++++++++++++++++------------------ migration.h | 4 +- savevm.c | 77 +++++++++++++++------------ vl.c | 3 +- vmstate.h | 18 ++++--- 6 files changed, 228 insertions(+), 145 deletions(-) -- 1.7.10.2