From patchwork Fri Feb 17 02:18:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 9578627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8114D60589 for ; Fri, 17 Feb 2017 02:21:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73F8028633 for ; Fri, 17 Feb 2017 02:21:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68C5928685; Fri, 17 Feb 2017 02:21:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B5F2428679 for ; Fri, 17 Feb 2017 02:21:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceY8Y-00072Z-TO; Fri, 17 Feb 2017 02:19:06 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceY8X-00071p-AN for xen-devel@lists.xenproject.org; Fri, 17 Feb 2017 02:19:05 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 06/97-18653-89D56A85; Fri, 17 Feb 2017 02:19:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGIsWRWlGSWpSXmKPExsViPb2gRXd67LI IgwtL9Cy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozOiROYCxaKV/ycu4y9gfG3YBcjJ4eEgJ/E pZ9zWEFsIYFaifMLrjF3MXIB2SsZJZZO3ssOkdjFKHHuoAOIzSZgIDHnykTGLkYODhGBconbK 8RB6pkFPjJKfOu8ClYvDDR005QDjCA2i4CqxOHbD5hAbF4BH4ndq++yQCyWk7h5rpMZxOYU8J XoPTWPBWSmEFDNjHMiEOWCEidnPgErZxaQkDj44gUzSImEgKJE2zVeCFNXYnVDBsRATYltq8+ xQYStJKZu9YQIC0rsfH6BbQKjyCwkM2chmbmAkWkVo0ZxalFZapGuoaVeUlFmekZJbmJmjq6h galebmpxcWJ6ak5iUrFecn7uJkZgeNczMDDuYHzU73eIUZKDSUmU9yjzsgghvqT8lMqMxOKM+ KLSnNTiQ4wyHBxKEry/o4FygkWp6akVaZk5wEiDSUtw8CiJ8ObFAKV5iwsSc4sz0yFSpxgVpc R5/4P0CYAkMkrz4Npg0X2JUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjBvPsh4nsy8Erjpr4A WMwEt7oxYCrK4JBEhJdXAaPxiyRXRLoGjbbWvj3Mv7T35jeXQGrlC7TfrHrm42ojsnLnnZJ3J uaPcX/g3C6iWTq1k2Wvksv6O1keRkwVPTTtlvr5ZO8/pRtyJ3Ns/H+l42Z+9eOOdoALLmreHc 1+aTJQMTTrFspbh6JHnTDYOLj7bNi69n31khZ/AhX9yc1hkVZyP9BXd26bEUpyRaKjFXFScCA A2tJwK6QIAAA== X-Env-Sender: zhangchen.fnst@cn.fujitsu.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1487297942!49033591!1 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42671 invoked from network); 17 Feb 2017 02:19:03 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-12.tower-206.messagelabs.com with SMTP; 17 Feb 2017 02:19:03 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="15685698" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 17 Feb 2017 10:18:59 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id C634347C4E81; Fri, 17 Feb 2017 10:18:58 +0800 (CST) Received: from localhost.localdomain (10.167.226.56) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 17 Feb 2017 10:18:59 +0800 From: Zhang Chen To: Xen devel , Wei Liu , Ian Jackson Date: Fri, 17 Feb 2017 10:18:24 +0800 Message-ID: <1487297909-1885-3-git-send-email-zhangchen.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487297909-1885-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> References: <1487297909-1885-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.56] X-yoursite-MailScanner-ID: C634347C4E81.AE0D7 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhangchen.fnst@cn.fujitsu.com Cc: Zhang Chen , Li Zhijian , eddie , Yang Hongyang , Bian Naimeng Subject: [Xen-devel] [PATCH V3 2/7] COLO-Proxy: Setup userspace colo-proxy on primary side X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP In this patch we close kernel COLO-Proxy on primary side. Signed-off-by: Zhang Chen --- tools/libxl/libxl_colo_proxy.c | 27 +++++++++++++++++++++++++++ tools/libxl/libxl_colo_save.c | 9 +++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c index 0983f42..dd902fc 100644 --- a/tools/libxl/libxl_colo_proxy.c +++ b/tools/libxl/libxl_colo_proxy.c @@ -152,6 +152,10 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps) STATE_AO_GC(cps->ao); + /* If enable userspace proxy mode, we don't need setup kernel proxy */ + if (cps->is_userspace_proxy) + return 0; + skfd = socket(PF_NETLINK, SOCK_RAW, NETLINK_COLO); if (skfd < 0) { LOGD(ERROR, ao->domid, "can not create a netlink socket: %s", strerror(errno)); @@ -222,6 +226,13 @@ out: void colo_proxy_teardown(libxl__colo_proxy_state *cps) { + /* + * If enable userspace proxy mode, + * we don't need teardown kernel proxy + */ + if (cps->is_userspace_proxy) + return; + if (cps->sock_fd >= 0) { close(cps->sock_fd); cps->sock_fd = -1; @@ -232,6 +243,13 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps) void colo_proxy_preresume(libxl__colo_proxy_state *cps) { + /* + * If enable userspace proxy mode, + * we don't need preresume kernel proxy + */ + if (cps->is_userspace_proxy) + return; + colo_proxy_send(cps, NULL, 0, COLO_CHECKPOINT); /* TODO: need to handle if the call fails... */ } @@ -262,6 +280,15 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, STATE_AO_GC(cps->ao); + /* + * enable userspace proxy mode, tmp sleep. + * then we will add qemu API support this func. + */ + if (cps->is_userspace_proxy) { + sleep(timeout_us / 1000000); + return 0; + } + size = colo_proxy_recv(cps, &buff, timeout_us); /* timeout, return no checkpoint message. */ diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c index eb8336c..91e3fce 100644 --- a/tools/libxl/libxl_colo_save.c +++ b/tools/libxl/libxl_colo_save.c @@ -110,8 +110,13 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css) css->colo_proxy_script = GCSPRINTF("%s/colo-proxy-setup", libxl__xen_script_dir_path()); - cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) | - (1 << LIBXL__DEVICE_KIND_VBD); + /* If enable userspace proxy mode, we don't need VIF */ + if (css->cps.is_userspace_proxy) + cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VBD); + else + cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) | + (1 << LIBXL__DEVICE_KIND_VBD); + cds->ops = colo_ops; cds->callback = colo_save_setup_done; cds->ao = ao;