[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 5/5] X86/vMCE: guest broken page handling when migration
George Dunlap wrote: > On Fri, Oct 19, 2012 at 4:14 PM, Ian Jackson > <Ian.Jackson@xxxxxxxxxxxxx> wrote: >> Liu, Jinsong writes ("[Xen-devel] [PATCH 5/5] X86/vMCE: guest broken >> page handling when migration"): >>> X86/vMCE: guest broken page handling when migration >>> >>> This patch is used to handle guest broken page when migration. >> >> This looks plausible to me, as far as the tools go. Can you explain >> how you have tested this ? Did you manage to do any tests of the >> remus codepaths ? > > I'm pretty sure that this shouldn't cause any problems with Remus. If > it's difficult for Jinsong to test Remus, I think probably OK to > commit it, and then revert it if the Remus guys have any problems. > > -George Attached are 2 test program, my test steps are, 1. at sender, inject a vmce to guest, scan & record the broken page (pfn1) 2. do live migration, success; 3. at target, scan the broken page (pfn2) and compare 4. pfn1 = pfn2 I tested live migration, but not remus. Thanks, Jinsong =============== test program 1: diff -r ad02805c77b8 xen/arch/x86/cpu/mcheck/vmce.c --- a/xen/arch/x86/cpu/mcheck/vmce.c Sat Jul 28 06:35:47 2012 +0800 +++ b/xen/arch/x86/cpu/mcheck/vmce.c Sat Aug 25 04:01:19 2012 +0800 @@ -28,6 +28,7 @@ #include <xen/smp.h> #include <xen/mm.h> #include <xen/hvm/save.h> +#include <xen/keyhandler.h> #include <asm/processor.h> #include <public/sysctl.h> #include <asm/system.h> @@ -449,3 +450,93 @@ return rc; } + +/***************************************************/ + +unsigned long broken_pfn = 0; + +static void sender_broken_page(unsigned char key) +{ + domid_t sender_domid = 1; + struct domain *d; + struct p2m_domain *p2m; + unsigned long pfn; + p2m_type_t pt; + + d = rcu_lock_domain_by_id(sender_domid); + p2m = p2m_get_hostp2m(d); + + for ( pfn = 0; pfn < p2m->max_mapped_pfn; pfn++ ) + { + get_gfn_query(d, pfn, &pt); + if ( unlikely(p2m_is_broken(pt)) ) + { + printk("!!!!!! before migration, find broken page, " + "dom = %d, pfn = %lx, pt = %d\n", + (unsigned int)d->domain_id, pfn, (unsigned int)pt); + broken_pfn = pfn; + } + put_gfn(d, pfn); + } + + rcu_unlock_domain(d); +} + +static struct keyhandler sender_broken_page_keyhandler = { + .diagnostic = 1, + .u.fn = sender_broken_page, +}; + +static __init int sender_broken_page_init(void) +{ + register_keyhandler('6', &sender_broken_page_keyhandler); + return 0; +} +__initcall(sender_broken_page_init); + +/****************************************************/ + + +static void target_broken_page(unsigned char key) +{ + domid_t target_domid = 2; + struct domain *d; + struct p2m_domain *p2m; + unsigned long pfn; + p2m_type_t pt; + + d = rcu_lock_domain_by_id(target_domid); + p2m = p2m_get_hostp2m(d); + + for ( pfn = 0; pfn < p2m->max_mapped_pfn; pfn++ ) + { + get_gfn_query(d, pfn, &pt); + if ( unlikely(p2m_is_broken(pt)) ) + printk("@@@@@@ after migration, find broken page, " + "dom = %d, pfn = %lx, pt = %d\n", + (unsigned int)d->domain_id, pfn, (unsigned int)pt); + put_gfn(d, pfn); + } + + get_gfn_query(d, broken_pfn, &pt); + printk("@@@@@@ after migration, broken_pfn type is, " + "dom = %d, broken_pfn = %lx, pt = %d\n", + (unsigned int)d->domain_id, broken_pfn, (unsigned int)pt); + put_gfn(d, broken_pfn); + + rcu_unlock_domain(d); +} + +static struct keyhandler target_broken_page_keyhandler = { + .diagnostic = 1, + .u.fn = target_broken_page, +}; + +static __init int target_broken_page_init(void) +{ + register_keyhandler('7', &target_broken_page_keyhandler); + return 0; +} +__initcall(target_broken_page_init); + +/*****************************************************/ =============== test program 2: diff -r de462f2f1db8 tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c Mon Aug 27 21:38:11 2012 +0800 +++ b/tools/libxc/xc_domain_restore.c Mon Aug 27 21:56:53 2012 +0800 @@ -1207,8 +1207,11 @@ if ( pagetype == XEN_DOMCTL_PFINFO_BROKEN ) { + fprintf(stderr, "@target, find broken page, " + "dom=%d, pfn=0x%lx, pagetype=0x%lx\n", dom, pfn, pagetype); if ( xc_set_broken_page_p2m(xch, dom, pfn) ) { + fprintf(stderr, "... ERROR WHEN SET P2M FOR BROKEN PAGE\n"); ERROR("Set p2m for broken page fail, " "dom=%d, pfn=%lx\n", dom, pfn); goto err_mapped; diff -r de462f2f1db8 tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c Mon Aug 27 21:38:11 2012 +0800 +++ b/tools/libxc/xc_domain_save.c Mon Aug 27 21:56:53 2012 +0800 @@ -1289,6 +1289,9 @@ { pfn_type[j] |= pfn_batch[j]; ++run; + fprintf(stderr, "@sender, find broken page, " + "pfn_err[0x%x]=%d, pfn_type[0x%x] =%lx\n", + (int)j, (int)pfn_err[j], (int)j, (unsigned long)pfn_type[j]); continue; } diff -r de462f2f1db8 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Mon Aug 27 21:38:11 2012 +0800 +++ b/xen/arch/x86/domctl.c Mon Aug 27 21:56:53 2012 +0800 @@ -1566,13 +1566,19 @@ struct domain *d; p2m_type_t pt; unsigned long pfn; + mfn_t r_mfn; d = rcu_lock_domain_by_id(domctl->domain); if ( d != NULL ) { pfn = domctl->u.set_broken_page_p2m.pfn; - get_gfn_query(d, pfn, &pt); + r_mfn = get_gfn_query(d, pfn, &pt); + printk("@XEN_DOMCTL_set_broken_page_p2m, before set p2m, " + "pfn=%lx, pt=%d\n", pfn, (int)pt); + if (!mfn_valid(mfn_x(r_mfn))) + printk("r_mfn IS INVALID!!!\n"); + p2m_change_type(d, pfn, pt, p2m_ram_broken); put_gfn(d, pfn); ============= Attachment:
test1.patch Attachment:
test2.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |