Migration v2 fix
PATCH v2 2/5 libxc: migration v2 prefix Memory -> Frames
In reply to Wei LiuThe prefix "Memory" is confusing because the numbers shown after that are referring to frames. They have no bearing on how many pages a domain actually owns or how many actual pages are processed.
--- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_sr_save.c +1 -1
@@ -659,7 +659,7 @@ static int send_domain_memory_nonlive(struct xc_sr_context *ctx)if ( rc ) goto err; -xc_set_progress_prefix (xch,"Memory" ); +xc_set_progress_prefix (xch,"Frames" ); rc =send_all_pages (ctx);if ( rc )
Signature · 1 line
2.1.4
PATCH v2 4/5 libxc: don't populate same pfn more than once in populate_pfns
In reply to Wei LiuThe original implementation of populate_pfns didn't consider the same pfn can be present multiple times in the array. The mechanism to prevent populating the same pfn multiple times only worked if the recurring pfn appeared in different batches.
This bug is discovered by Linux 4.1 32 bit kernel save / restore test, which has several ptes pointing to same pfn, which results in an array containing recurring pfn. When libxc called x86_pv_localise_page, the original implementation would populate the same pfn more than once.
The fix is to set bit in populated bitmap as we generate list of pfns to be populated.
--- tools/libxc/xc_sr_restore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/libxc/xc_sr_restore.c +3 -3
@@ -214,6 +214,9 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned count, types[i] != XEN_DOMCTL_PFINFO_BROKEN))) && !pfn_is_populated(ctx, original_pfns[i]) ) { + rc =pfn_set_populated (ctx, original_pfns[i]); +if ( rc ) + goto err; pfns[nr_pfns] = mfns[nr_pfns] = original_pfns[i]; ++nr_pfns; }
@@ -238,9 +241,6 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned count, goto err; } - rc =pfn_set_populated (ctx, pfns[i]); -if ( rc ) - goto err; ctx->restore.ops.set_gfn (ctx, pfns[i], mfns[i]); } }
Signature · 1 line
2.1.4
PATCH v2 5/5 libxc: add assertion to avoid setting same bit more than once
In reply to Wei Liu--- tools/libxc/xc_sr_restore.c | 1 + 1 file changed, 1 insertion(+)
tools/libxc/xc_sr_restore.c +1 -0
@@ -181,6 +181,7 @@ static int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t pfn) ctx->restore.max_populated_pfn = new_max; } +assert (!test_bit (pfn, ctx->restore.populated_pfns));set_bit (pfn, ctx->restore.populated_pfns);return 0 ;
Signature · 1 line
2.1.4
v2 cover Migration v2 fix
Wei Liu (5):
libxc: clearer migration v2 debug message
libxc: migration v2 prefix Memory -> Frames
libxc: fix indentation
libxc: don't populate same pfn more than once in populate_pfns
libxc: add assertion to avoid setting same bit more than once
tools/libxc/xc_sr_restore.c | 7 ++++--- tools/libxc/xc_sr_restore_x86_pv.c | 4 ++-- tools/libxc/xc_sr_save.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/5 libxc: clearer migration v2 debug message
Previous the message was like:
SAVE:
xc: detail: 32 bits, 3 levels
xc: detail: max_pfn 0xfffff, p2m_frames 1024
xc: detail: max_mfn 0x130000
RESTORE:
xc: detail: max_mfn 0x130000
xc: detail: 32 bits, 3 levels
xc: detail: Expanded p2m from 0 to 0xfffff
It's not immediately clear that the last line in restore messages was referring to max_pfn. Change the debug message a bit to make that clearer.
--- tools/libxc/xc_sr_restore_x86_pv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_sr_restore_x86_pv.c +1 -1
@@ -66,7 +66,7 @@ static int expand_p2m(struct xc_sr_context *ctx, unsigned long max_pfn)for ( i = (old_end_frame ? old_end_frame +1 :0 ); i <= end_frame; ++i ) ctx->x86_pv.p2m_pfns[i] =INVALID_MFN ; -DPRINTF ("Expanded p2m from %#lx to %#lx" , old_max, max_pfn); +DPRINTF ("Changed max_pfn from %#lx to %#lx" , old_max, max_pfn);return 0 ; }
Signature · 1 line
2.1.4
PATCH v2 3/5 libxc: fix indentation
In reply to Wei Liu--- tools/libxc/xc_sr_restore_x86_pv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_sr_restore_x86_pv.c +1 -1
@@ -970,7 +970,7 @@ static int x86_pv_localise_page(struct xc_sr_context *ctx, }if ( to_populate &&populate_pfns (ctx, to_populate, pfns,NULL ) ) -return -1 ; +return -1 ;for ( i =0 ; i < (PAGE_SIZE /sizeof (uint64_t )); ++i ) {
Signature · 1 line
2.1.4
Re: [PATCH for 4.6 v2 2/5] libxc: migration v2 prefix Memory -> Frames
In reply to Wei LiuQuoted 3 lines · Wei Liu
The prefix "Memory" is confusing because the numbers shown after that are referring to frames. They have no bearing on how many pages a domain actually owns or how many actual pages are processed.
There is a direct bearing on how many pages are processed, by virtue of the "$X of $Y" later in the line. I think your final phrase is misleading and should just be dropped.
Also, there are two further places which need "Memory" changing in a similar way; send_memory_verify() (which itself should probably be renamed to verify_frames()), and update_progress_string() which is the companion to the hunk below, but for live migration.
~Andrew
Quoted 19 lines
Signed-off-by Wei Liu <[email protected]>--- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxc/xc_sr_save.c +1
-1@@ -659,7 +659,7 @@ static int send_domain_memory_nonlive(struct xc_sr_context *ctx)if ( rc ) goto err; -xc_set_progress_prefix (xch,"Memory" ); +xc_set_progress_prefix (xch,"Frames" ); rc =send_all_pages (ctx);if ( rc )
Re: [PATCH for 4.6 v2 4/5] libxc: don't populate same pfn more than once in populate_pfns
In reply to Wei LiuQuoted 10 lines · Wei Liu
The original implementation of
populate_pfnsdidn't consider the same pfn can be present multiple times in the array. The mechanism to prevent populating the same pfn multiple times only worked if the recurring pfn appeared in different batches.This bug is discovered by Linux 4.1 32 bit kernel save / restore test, which has several ptes pointing to same pfn, which results in an array containing recurring pfn. When libxc called
x86_pv_localise_page, the original implementation would populate the same pfn more than once.
Quoted 4 lines
The fix is to set bit in populated bitmap as we generate list of pfns to be populated.
Signed-off-by Wei Liu <[email protected]>
Re: [PATCH for 4.6 v2 2/5] libxc: migration v2 prefix Memory -> Frames
In reply to Andrew CooperQuoted 9 lines · Andrew Cooper
Quoted 3 lines · Wei Liu
The prefix "Memory" is confusing because the numbers shown after that are referring to frames. They have no bearing on how many pages a domain actually owns or how many actual pages are processed.
There is a direct bearing on how many pages are processed, by virtue of the "$X of $Y" later in the line. I think your final phrase is misleading and should just be dropped.
OK.
Quoted 5 lines
Also, there are two further places which need "Memory" changing in a similar way;
send_memory_verify()(which itself should probably be renamed toverify_frames()), andupdate_progress_string()which is the companion to the hunk below, but for live migration.
I will fix those, too.
Wei.
Quoted 19 lines
~Andrew
Quoted 17 lines
Signed-off-by Wei Liu <[email protected]>--- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxc/xc_sr_save.c +1
-1@@ -659,7 +659,7 @@ static int send_domain_memory_nonlive(struct xc_sr_context *ctx)if ( rc ) goto err; -xc_set_progress_prefix (xch,"Memory" ); +xc_set_progress_prefix (xch,"Frames" ); rc =send_all_pages (ctx);if ( rc )