From patchwork Wed Feb 12 14:27:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 24546 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4C24203F3 for ; Wed, 12 Feb 2014 14:30:22 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf20004335pbb.5 for ; Wed, 12 Feb 2014 06:30:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=uGvQRiVQLlwoibVOOw1r2AQu9J3YwMtKMAczqPujfvU=; b=DIGa1mYTMuujM3lPW/Tj2F2NjavDGD0l1iYCesrPPVwnUNI9IxfOY1qV1yMOQQmbIh L/hTKZzTwavKudAQQXU9GcPmlsrhD9vcIZOBKHlfDJSN9HI+jKuK69oY/njIPUeTBl0G hi0q3zPWk8G0ykztlUUbWWyq+0iQbn8KTFEZCtZin1BlgLFjfmJjYSH1qmM2l7cAnm9r 0Nc+PjDWPeDy311PvXkGUD6EYyUqvbNRZaFMAu2c3ABGfVm4dcVRBwvX3JA2bFlPIOMR LknhDSMeX2iV2m1ABEKEZZiy9JmyUQy9c153XIXoJqtyJOk47SJGd+x2JljIJK0eg4kt TwOw== X-Gm-Message-State: ALoCoQmLWDrx/kH1m3GDD/kOAomAi7WBoLOZYqOJINvT4JCHdLVRI+3b2GDOAq/d5Su8M4PwlpoF X-Received: by 10.68.197.73 with SMTP id is9mr1822532pbc.0.1392215421887; Wed, 12 Feb 2014 06:30:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.33.200 with SMTP id j66ls2938248qgj.80.gmail; Wed, 12 Feb 2014 06:30:21 -0800 (PST) X-Received: by 10.220.164.80 with SMTP id d16mr32606524vcy.15.1392215421731; Wed, 12 Feb 2014 06:30:21 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id w6si7359206vcz.83.2014.02.12.06.30.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 06:30:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so7568976veb.27 for ; Wed, 12 Feb 2014 06:30:21 -0800 (PST) X-Received: by 10.52.229.133 with SMTP id sq5mr229496vdc.45.1392215421640; Wed, 12 Feb 2014 06:30:21 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp4271vcz; Wed, 12 Feb 2014 06:30:19 -0800 (PST) X-Received: by 10.140.85.35 with SMTP id m32mr63866982qgd.40.1392215419602; Wed, 12 Feb 2014 06:30:19 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id a3si15329206qam.138.2014.02.12.06.30.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Feb 2014 06:30:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WDan7-0001Ia-It; Wed, 12 Feb 2014 14:27:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WDan7-0001IV-0a for xen-devel@lists.xen.org; Wed, 12 Feb 2014 14:27:57 +0000 Received: from [85.158.137.68:46758] by server-11.bemta-3.messagelabs.com id 3B/26-04255-CE48BF25; Wed, 12 Feb 2014 14:27:56 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1392215271!1371043!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26898 invoked from network); 12 Feb 2014 14:27:53 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 12 Feb 2014 14:27:53 -0000 X-IronPort-AV: E=Sophos;i="4.95,832,1384300800"; d="scan'208";a="100129999" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 12 Feb 2014 14:27:50 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Wed, 12 Feb 2014 09:27:37 -0500 Received: from spare.cam.xci-test.com ([10.80.2.80] helo=kazak.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WDamn-0007pe-1Y; Wed, 12 Feb 2014 14:27:37 +0000 From: Ian Campbell To: Date: Wed, 12 Feb 2014 14:27:37 +0000 Message-ID: <1392215257-26993-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 X-DLP: MIA1 Cc: goerge.dunlap@citrix.com, ian.jackson@eu.citrix.com, Ian Campbell Subject: [Xen-devel] [PATCH] xl: suppress suspend/resume functions on platforms which do not support it. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: ARM does not (currently) support migration, so stop offering tasty looking treats like "xl migrate". Apart from the UI improvement my intention is to use this in osstest to detect whether to attempt the save/restore/migrate tests. Other than the additions of the #define/#ifdef there is a tiny bit of code motion ("dump-core" in the command list and core_dump_domain in the implementations) which serves to put ifdeffable bits next to each other. Signed-off-by: Ian Campbell Cc: goerge.dunlap@citrix.com --- Release: My main motivation here is to be able to get a complete osstest run on armhf prior to Xen 4.4 and the lack of migration support is currently blocking that (fine) but is also blocking subsequent useful tests. This change will allow me to make osstest skip the unsupported functionality, and in a way where it will automatically start trying to test it as soon as it is implemented. --- tools/libxl/libxl.h | 14 ++++++++++++++ tools/libxl/xl.h | 4 ++++ tools/libxl/xl_cmdimpl.c | 20 ++++++++++++-------- tools/libxl/xl_cmdtable.c | 15 +++++++++------ 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 0b992d1..06bbca6 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -431,6 +431,20 @@ */ #define LIBXL_HAVE_SIGCHLD_SHARING 1 +/* + * LIBXL_HAVE_NO_SUSPEND_RESUME + * + * Is this is defined then the platform has no support for saving, + * restoring or migrating a domain. In this case the related functions + * should be expected to return failure. That is: + * - libxl_domain_suspend + * - libxl_domain_resume + * - libxl_domain_remus_start + */ +#if defined(__arm__) || defined(__aarch64__) +#define LIBXL_HAVE_NO_SUSPEND_RESUME 1 +#endif + /* Functions annotated with LIBXL_EXTERNAL_CALLERS_ONLY may not be * called from within libxl itself. Callers outside libxl, who * do not #include libxl_internal.h, are fine. */ diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index c876a33..f188708 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -43,10 +43,12 @@ int main_pciattach(int argc, char **argv); int main_pciassignable_add(int argc, char **argv); int main_pciassignable_remove(int argc, char **argv); int main_pciassignable_list(int argc, char **argv); +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_restore(int argc, char **argv); int main_migrate_receive(int argc, char **argv); int main_save(int argc, char **argv); int main_migrate(int argc, char **argv); +#endif int main_dump_core(int argc, char **argv); int main_pause(int argc, char **argv); int main_unpause(int argc, char **argv); @@ -104,7 +106,9 @@ int main_cpupoolnumasplit(int argc, char **argv); int main_getenforce(int argc, char **argv); int main_setenforce(int argc, char **argv); int main_loadpolicy(int argc, char **argv); +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_remus(int argc, char **argv); +#endif int main_devd(int argc, char **argv); void help(const char *command); diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index aff6f90..4fc46eb 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3384,6 +3384,15 @@ static void list_vm(void) libxl_vminfo_list_free(info, nb_vm); } +static void core_dump_domain(uint32_t domid, const char *filename) +{ + int rc; + + rc=libxl_domain_core_dump(ctx, domid, filename, NULL); + if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); } +} + +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME static void save_domain_core_begin(uint32_t domid, const char *override_config_file, uint8_t **config_data_r, @@ -3775,14 +3784,6 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, exit(-ERROR_BADFAIL); } -static void core_dump_domain(uint32_t domid, const char *filename) -{ - int rc; - - rc=libxl_domain_core_dump(ctx, domid, filename, NULL); - if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); } -} - static void migrate_receive(int debug, int daemonize, int monitor, int send_fd, int recv_fd, int remus) { @@ -4102,6 +4103,7 @@ int main_migrate(int argc, char **argv) migrate_domain(domid, rune, debug, config_filename); return 0; } +#endif int main_dump_core(int argc, char **argv) { @@ -7248,6 +7250,7 @@ done: return ret; } +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_remus(int argc, char **argv) { uint32_t domid; @@ -7341,6 +7344,7 @@ int main_remus(int argc, char **argv) close(send_fd); return -ERROR_FAIL; } +#endif int main_devd(int argc, char **argv) { diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index ebe0220..e8ab93a 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -137,6 +137,7 @@ struct cmd_spec cmd_table[] = { " -autopass\n" "--vncviewer-autopass (consistency alias for --autopass)" }, +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME { "save", &main_save, 0, 1, "Save a domain state to restore later", @@ -158,11 +159,6 @@ struct cmd_spec cmd_table[] = { " of the domain.\n" "--debug Print huge (!) amount of debug during the migration process." }, - { "dump-core", - &main_dump_core, 0, 1, - "Core dump a domain", - " " - }, { "restore", &main_restore, 0, 1, "Restore a domain from a saved state", @@ -179,6 +175,12 @@ struct cmd_spec cmd_table[] = { "Restore a domain from a saved state", "- for internal use only", }, +#endif + { "dump-core", + &main_dump_core, 0, 1, + "Core dump a domain", + " " + }, { "cd-insert", &main_cd_insert, 1, 1, "Insert a cdrom into a guest's cd drive", @@ -474,6 +476,7 @@ struct cmd_spec cmd_table[] = { "Loads a new policy int the Flask Xen security module", "", }, +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME { "remus", &main_remus, 0, 1, "Enable Remus HA for domain", @@ -486,8 +489,8 @@ struct cmd_spec cmd_table[] = { " ssh xl migrate-receive -r [-e]\n" "-e Do not wait in the background (on ) for the death\n" " of the domain." - }, +#endif { "devd", &main_devd, 0, 1, "Daemon that listens for devices and launches backends",