From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Subject: [RFC Patch v2 11/16] xc_restore: implement for colo Date: Thu, 11 Jul 2013 16:35:43 +0800 Message-ID: <1373531748-12547-12-git-send-email-wency@cn.fujitsu.com> References: <1373531748-12547-1-git-send-email-wency@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1373531748-12547-1-git-send-email-wency@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dong Eddie , Lai Jiangshan , xen-devl , Shriram Rajagopalan Cc: Jiang Yunhong , Wen Congyang , Ye Wei , Xu Yao , Hong Tao List-Id: xen-devel@lists.xenproject.org All restore callbacks have been implemented. Use this callback for colo in xc_restore. Add a new arguement to tell xc_restore if it should use colo mode or not. Signed-off-by: Ye Wei Signed-off-by: Jiang Yunhong Signed-off-by: Wen Congyang --- tools/xcutils/xc_restore.c | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/tools/xcutils/xc_restore.c b/tools/xcutils/xc_restore.c index 35d725c..659c159 100644 --- a/tools/xcutils/xc_restore.c +++ b/tools/xcutils/xc_restore.c @@ -14,6 +14,7 @@ #include #include +#include int main(int argc, char **argv) @@ -26,10 +27,12 @@ main(int argc, char **argv) unsigned long store_mfn, console_mfn; xentoollog_level lvl; xentoollog_logger *l; + struct restore_callbacks callback, *callback_p; + int colo = 0; - if ( (argc != 8) && (argc != 9) ) + if ( (argc != 8) && (argc != 9) && (argc != 10) ) errx(1, "usage: %s iofd domid store_evtchn " - "console_evtchn hvm pae apic [superpages]", argv[0]); + "console_evtchn hvm pae apic [superpages [colo]]", argv[0]); lvl = XTL_DETAIL; lflags = XTL_STDIOSTREAM_SHOW_PID | XTL_STDIOSTREAM_HIDE_PROGRESS; @@ -46,20 +49,39 @@ main(int argc, char **argv) pae = atoi(argv[6]); apic = atoi(argv[7]); if ( argc == 9 ) - superpages = atoi(argv[8]); + superpages = atoi(argv[8]); else - superpages = !!hvm; + superpages = !!hvm; + + if ( argc == 10 ) + colo = atoi(argv[9]); + + if ( colo ) + { + callback.init = colo_init; + callback.free = colo_free; + callback.get_page = colo_get_page; + callback.flush_memory = colo_flush_memory; + callback.update_p2m = colo_update_p2m_table; + callback.finish_restotre = colo_finish_restore; + callback.data = NULL; + callback_p = &callback; + } + else + { + callback_p = NULL; + } ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn, 0, console_evtchn, &console_mfn, 0, hvm, pae, superpages, - 0, NULL, NULL); + 0, NULL, callback_p); if ( ret == 0 ) { - printf("store-mfn %li\n", store_mfn); + printf("store-mfn %li\n", store_mfn); if ( !hvm ) printf("console-mfn %li\n", console_mfn); - fflush(stdout); + fflush(stdout); } xc_interface_close(xch); -- 1.7.4