-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migration: add capability to bypass the shared memory #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -772,6 +772,11 @@ unsigned long migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, | |
unsigned long *bitmap = rb->bmap; | ||
unsigned long next; | ||
|
||
/* when this ramblock is requested bypassing */ | ||
if (!bitmap) { | ||
return size; | ||
} | ||
|
||
if (rs->ram_bulk_stage && start > 0) { | ||
next = start + 1; | ||
} else { | ||
|
@@ -842,7 +847,9 @@ static void migration_bitmap_sync(RAMState *rs) | |
qemu_mutex_lock(&rs->bitmap_mutex); | ||
rcu_read_lock(); | ||
RAMBLOCK_FOREACH(block) { | ||
migration_bitmap_sync_range(rs, block, 0, block->used_length); | ||
if (!migrate_bypass_shared_memory() || !qemu_ram_is_shared(block)) { | ||
migration_bitmap_sync_range(rs, block, 0, block->used_length); | ||
} | ||
} | ||
rcu_read_unlock(); | ||
qemu_mutex_unlock(&rs->bitmap_mutex); | ||
|
@@ -2123,28 +2130,30 @@ static int ram_state_init(RAMState **rsp) | |
qemu_mutex_init(&(*rsp)->src_page_req_mutex); | ||
QSIMPLEQ_INIT(&(*rsp)->src_page_requests); | ||
|
||
/* | ||
* Count the total number of pages used by ram blocks not including any | ||
* gaps due to alignment or unplugs. | ||
*/ | ||
(*rsp)->migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS; | ||
|
||
ram_state_reset(*rsp); | ||
|
||
return 0; | ||
} | ||
|
||
static void ram_list_init_bitmaps(void) | ||
static void ram_list_init_bitmaps(RAMState *rs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that is possible, the original code would panic at https://github.com/kata-containers/qemu/pull/2/files#diff-7a5fd992f4559f6907ed9fd0a89cd159R839 |
||
{ | ||
RAMBlock *block; | ||
unsigned long pages; | ||
|
||
/* Skip setting bitmap if there is no RAM */ | ||
if (ram_bytes_total()) { | ||
QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { | ||
if (migrate_bypass_shared_memory() && qemu_ram_is_shared(block)) { | ||
continue; | ||
} | ||
pages = block->max_length >> TARGET_PAGE_BITS; | ||
block->bmap = bitmap_new(pages); | ||
bitmap_set(block->bmap, 0, pages); | ||
/* | ||
* Count the total number of pages used by ram blocks not | ||
* including any gaps due to alignment or unplugs. | ||
*/ | ||
rs->migration_dirty_pages += pages; | ||
if (migrate_postcopy_ram()) { | ||
block->unsentmap = bitmap_new(pages); | ||
bitmap_set(block->unsentmap, 0, pages); | ||
|
@@ -2160,7 +2169,7 @@ static void ram_init_bitmaps(RAMState *rs) | |
qemu_mutex_lock_ramlist(); | ||
rcu_read_lock(); | ||
|
||
ram_list_init_bitmaps(); | ||
ram_list_init_bitmaps(rs); | ||
memory_global_dirty_log_start(); | ||
migration_bitmap_sync(rs); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though
migrate_bypass_shared_memory
was enoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when
migrate_bypass_shared_memory
is set, ram can be set private instead of being shared. The only case we can skip syncing ismigrate_bypass_shared_memory && ram_is_shared
.