All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	Keir Fraser <keir.fraser@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 2/6]xl: Add 'xl tmem-freeze' command
Date: Wed, 19 May 2010 16:29:47 +0800	[thread overview]
Message-ID: <4BF3A17B.6020908@cn.fujitsu.com> (raw)
In-Reply-To: <4BF39FB9.3050005@cn.fujitsu.com>

Add 'xl tmem-freeze' command

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com> 

diff -r 540720cb1f64 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed May 19 23:25:41 2010 +0800
+++ b/tools/libxl/libxl.c	Wed May 19 23:28:56 2010 +0800
@@ -2840,3 +2840,18 @@
 
     return strdup(_buf);
 }
+
+int libxl_tmem_freeze(struct libxl_ctx *ctx, uint32_t domid)
+{
+    int rc;
+
+    rc = xc_tmem_control(ctx->xch, -1, TMEMC_FREEZE, domid, 0, 0,
+                         0, NULL);
+    if (rc < 0) {
+        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+            "Can not freeze tmem pools");
+        return -1;
+    }
+
+    return rc;
+}
diff -r 540720cb1f64 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed May 19 23:25:41 2010 +0800
+++ b/tools/libxl/libxl.h	Wed May 19 23:28:56 2010 +0800
@@ -514,6 +514,7 @@
 uint32_t libxl_vm_get_start_time(struct libxl_ctx *ctx, uint32_t domid);
 
 char *libxl_tmem_list(struct libxl_ctx *ctx, uint32_t domid, int use_long);
+int libxl_tmem_freeze(struct libxl_ctx *ctx, uint32_t domid);
 
 #endif /* LIBXL_H */
 
diff -r 540720cb1f64 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed May 19 23:25:41 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.c	Wed May 19 23:28:56 2010 +0800
@@ -3713,3 +3713,40 @@
     free(buf);
     exit(0);
 }
+
+int main_tmem_freeze(int argc, char **argv)
+{
+    char *dom = NULL;
+    int all = 0;
+    int opt;
+
+    while ((opt = getopt(argc, argv, "ah")) != -1) {
+        switch (opt) {
+        case 'a':
+            all = 1;
+            break;
+        case 'h':
+            help("tmem-freeze");
+            exit(0);
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+
+    dom = argv[optind];
+    if (!dom && all == 0) {
+        fprintf(stderr, "You must specify -a or a domain id.\n\n");
+        help("tmem-freeze");
+        exit(1);
+    }
+
+    if (all)
+        domid = -1;
+    else
+        find_domain(dom);
+
+    libxl_tmem_freeze(&ctx, domid);
+    exit(0);
+}
+
diff -r 540720cb1f64 tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h	Wed May 19 23:25:41 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.h	Wed May 19 23:28:56 2010 +0800
@@ -53,6 +53,7 @@
 int main_blockdetach(int argc, char **argv);
 int main_uptime(int argc, char **argv);
 int main_tmem_list(int argc, char **argv);
+int main_tmem_freeze(int argc, char **argv);
 
 void help(char *command);
 
diff -r 540720cb1f64 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Wed May 19 23:25:41 2010 +0800
+++ b/tools/libxl/xl_cmdtable.c	Wed May 19 23:28:56 2010 +0800
@@ -230,6 +230,12 @@
       "[-l] [<Domain>|-a]",
       "  -l                             List tmem stats",
     },
+    { "tmem-freeze",
+      &main_tmem_freeze,
+      "Freeze tmem pools",
+      "[<Domain>|-a]",
+      "  -a                             Freeze all tmem",
+    },
 };
 
 int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);

-- 
Regards
Yang Hongyang

  parent reply	other threads:[~2010-05-19  8:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19  8:22 [PATCH 0/6]xl: Add 'xl tmem-*' commands Yang Hongyang
2010-05-19  8:26 ` [PATCH 1/6]xl: Add 'xl tmem-list' command Yang Hongyang
2010-05-19  8:29 ` Yang Hongyang [this message]
2010-05-19  8:31 ` [PATCH 3/6]xl: Add 'xl tmem-destroy' command Yang Hongyang
2010-05-19  8:32 ` [PATCH 4/6]xl: Add 'xl tmem-thaw' command Yang Hongyang
2010-05-19  8:33 ` [PATCH 5/6]xl: Add 'xl tmem-set' command Yang Hongyang
2010-05-19  8:35 ` [PATCH 6/6]xl: Add 'xl tmem-shared-auth' command Yang Hongyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF3A17B.6020908@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.