[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 1/3] tools: remove tmem code and commands
Remove all tmem related code in libxc. Leave some stubs in libxl in case anyone has linked to those functions before the removal. Remove all tmem related commands in xl, all tmem related code in other utilities we ship. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- Rebase and fix up conflicts --- tools/libxc/Makefile | 1 - tools/libxc/include/xenctrl.h | 17 - tools/libxc/xc_tmem.c | 507 -------------------- tools/libxl/libxl_tmem.c | 119 +---- tools/misc/Makefile | 1 - tools/misc/xen-tmem-list-parse.c | 339 ------------- tools/python/xen/lowlevel/xc/xc.c | 87 ---- tools/xenstat/libxenstat/src/xenstat.c | 53 +- tools/xenstat/libxenstat/src/xenstat.h | 15 - tools/xenstat/libxenstat/src/xenstat_priv.h | 8 - tools/xenstat/xentop/xentop.c | 36 +- tools/xl/Makefile | 2 +- tools/xl/xl.h | 6 - tools/xl/xl_cmdtable.c | 40 -- tools/xl/xl_tmem.c | 251 ---------- 15 files changed, 18 insertions(+), 1464 deletions(-) delete mode 100644 tools/libxc/xc_tmem.c delete mode 100644 tools/misc/xen-tmem-list-parse.c delete mode 100644 tools/xl/xl_tmem.c diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 668cbce0f8..cbc30001f6 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -30,7 +30,6 @@ CTRL_SRCS-y += xc_tbuf.c CTRL_SRCS-y += xc_pm.c CTRL_SRCS-y += xc_cpu_hotplug.c CTRL_SRCS-y += xc_resume.c -CTRL_SRCS-y += xc_tmem.c CTRL_SRCS-y += xc_vm_event.c CTRL_SRCS-y += xc_monitor.c CTRL_SRCS-y += xc_mem_paging.c diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index a3628e56bb..f3deba8b58 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -44,7 +44,6 @@ #include <xen/hvm/dm_op.h> #include <xen/hvm/params.h> #include <xen/xsm/flask_op.h> -#include <xen/tmem.h> #include <xen/kexec.h> #include <xen/platform.h> @@ -1907,22 +1906,6 @@ int xc_set_cpuidle_max_cstate(xc_interface *xch, uint32_t value); int xc_enable_turbo(xc_interface *xch, int cpuid); int xc_disable_turbo(xc_interface *xch, int cpuid); -/** - * tmem operations - */ - -int xc_tmem_control_oid(xc_interface *xch, int32_t pool_id, uint32_t subop, - uint32_t cli_id, uint32_t len, uint32_t arg, - struct xen_tmem_oid oid, void *buf); -int xc_tmem_control(xc_interface *xch, - int32_t pool_id, uint32_t subop, uint32_t cli_id, - uint32_t len, uint32_t arg, void *buf); -int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int enable); -int xc_tmem_save(xc_interface *xch, uint32_t domid, int live, int fd, int field_marker); -int xc_tmem_save_extra(xc_interface *xch, uint32_t domid, int fd, int field_marker); -void xc_tmem_save_done(xc_interface *xch, uint32_t domid); -int xc_tmem_restore(xc_interface *xch, uint32_t domid, int fd); -int xc_tmem_restore_extra(xc_interface *xch, uint32_t domid, int fd); /** * altp2m operations diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c deleted file mode 100644 index a365c74388..0000000000 --- a/tools/libxc/xc_tmem.c +++ /dev/null @@ -1,507 +0,0 @@ -/****************************************************************************** - * xc_tmem.c - * - * Copyright (C) 2008 Oracle Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; If not, see <http://www.gnu.org/licenses/>. - */ - -#include "xc_private.h" -#include <inttypes.h> -#include <assert.h> -#include <xen/tmem.h> - -int xc_tmem_control(xc_interface *xch, - int32_t pool_id, - uint32_t cmd, - uint32_t cli_id, - uint32_t len, - uint32_t arg, - void *buf) -{ - DECLARE_SYSCTL; - DECLARE_HYPERCALL_BOUNCE(buf, len, XC_HYPERCALL_BUFFER_BOUNCE_OUT); - int rc; - - sysctl.cmd = XEN_SYSCTL_tmem_op; - sysctl.u.tmem_op.pool_id = pool_id; - sysctl.u.tmem_op.cmd = cmd; - sysctl.u.tmem_op.cli_id = cli_id; - sysctl.u.tmem_op.len = len; - sysctl.u.tmem_op.arg = arg; - sysctl.u.tmem_op.pad = 0; - sysctl.u.tmem_op.oid.oid[0] = 0; - sysctl.u.tmem_op.oid.oid[1] = 0; - sysctl.u.tmem_op.oid.oid[2] = 0; - - if ( cmd == XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO || - cmd == XEN_SYSCTL_TMEM_OP_SET_AUTH ) - HYPERCALL_BOUNCE_SET_DIR(buf, XC_HYPERCALL_BUFFER_BOUNCE_IN); - if ( len ) - { - if ( buf == NULL ) - { - errno = EINVAL; - return -1; - } - if ( xc_hypercall_bounce_pre(xch, buf) ) - { - PERROR("Could not bounce buffer for tmem control hypercall"); - return -1; - } - } - - set_xen_guest_handle(sysctl.u.tmem_op.u.buf, buf); - - rc = do_sysctl(xch, &sysctl); - - if ( len ) - xc_hypercall_bounce_post(xch, buf); - - return rc; -} - -int xc_tmem_control_oid(xc_interface *xch, - int32_t pool_id, - uint32_t cmd, - uint32_t cli_id, - uint32_t len, - uint32_t arg, - struct xen_tmem_oid oid, - void *buf) -{ - DECLARE_SYSCTL; - DECLARE_HYPERCALL_BOUNCE(buf, len, XC_HYPERCALL_BUFFER_BOUNCE_OUT); - int rc; - - sysctl.cmd = XEN_SYSCTL_tmem_op; - sysctl.u.tmem_op.pool_id = pool_id; - sysctl.u.tmem_op.cmd = cmd; - sysctl.u.tmem_op.cli_id = cli_id; - sysctl.u.tmem_op.len = len; - sysctl.u.tmem_op.arg = arg; - sysctl.u.tmem_op.pad = 0; - sysctl.u.tmem_op.oid = oid; - - if ( len ) - { - if ( buf == NULL ) - { - errno = EINVAL; - return -1; - } - if ( xc_hypercall_bounce_pre(xch, buf) ) - { - PERROR("Could not bounce buffer for tmem control (OID) hypercall"); - return -1; - } - } - - set_xen_guest_handle(sysctl.u.tmem_op.u.buf, buf); - - rc = do_sysctl(xch, &sysctl); - - if ( len ) - xc_hypercall_bounce_post(xch, buf); - - return rc; -} - -static int xc_tmem_uuid_parse(char *uuid_str, uint64_t *uuid_lo, uint64_t *uuid_hi) -{ - char *p = uuid_str; - uint64_t *x = uuid_hi; - int i = 0, digit; - - *uuid_lo = 0; *uuid_hi = 0; - for ( p = uuid_str, i = 0; i != 36 && *p != '\0'; p++, i++ ) - { - if ( (i == 8 || i == 13 || i == 18 || i == 23) ) - { - if ( *p != '-' ) - return -1; - if ( i == 18 ) - x = uuid_lo; - continue; - } - else if ( *p >= '0' && *p <= '9' ) - digit = *p - '0'; - else if ( *p >= 'A' && *p <= 'F' ) - digit = *p - 'A' + 10; - else if ( *p >= 'a' && *p <= 'f' ) - digit = *p - 'a' + 10; - else - return -1; - *x = (*x << 4) | digit; - } - if ( (i != 1 && i != 36) || *p != '\0' ) - return -1; - return 0; -} - -int xc_tmem_auth(xc_interface *xch, - int cli_id, - char *uuid_str, - int enable) -{ - xen_tmem_pool_info_t pool = { - .flags.u.auth = enable, - .id = 0, - .n_pages = 0, - .uuid[0] = 0, - .uuid[1] = 0, - }; - if ( xc_tmem_uuid_parse(uuid_str, &pool.uuid[0], - &pool.uuid[1]) < 0 ) - { - PERROR("Can't parse uuid, use xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); - return -1; - } - return xc_tmem_control(xch, 0 /* pool_id */, - XEN_SYSCTL_TMEM_OP_SET_AUTH, - cli_id, sizeof(pool), - 0 /* arg */, &pool); -} - -/* Save/restore/live migrate */ - -/* - Note that live migration complicates the save/restore format in - multiple ways: Though saving/migration can only occur when all - tmem pools belonging to the domain-being-saved are frozen and - this ensures that new pools can't be created or existing pools - grown (in number of pages), it is possible during a live migration - that pools may be destroyed and pages invalidated while the migration - is in process. As a result, (1) it is not safe to pre-specify counts - for these values precisely, but only as a "max", and (2) a "invalidation" - list (of pools, objects, pages) must be appended when the domain is truly - suspended. - */ - -/* returns 0 if nothing to save, -1 if error saving, 1 if saved successfully */ -int xc_tmem_save(xc_interface *xch, - uint32_t domid, int io_fd, int live, int field_marker) -{ - int marker = field_marker; - int i, j, rc; - uint32_t minusone = -1; - struct tmem_handle *h; - xen_tmem_client_t info; - xen_tmem_pool_info_t *pools; - char *buf = NULL; - - rc = xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_BEGIN, - domid, 0 /* len*/ , live, NULL); - if ( rc ) - { - /* Nothing to save - no tmem enabled. */ - if ( errno == ENOENT ) - return 0; - - return rc; - } - - if ( xc_tmem_control(xch, 0 /* pool_id */, - XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO, - domid /* cli_id */, sizeof(info), 0 /* arg */, - &info) < 0 ) - return -1; - - /* Nothing to do. */ - if ( !info.nr_pools ) - return 0; - - pools = calloc(info.nr_pools, sizeof(*pools)); - if ( !pools ) - return -1; - - rc = xc_tmem_control(xch, 0 /* pool_id is ignored. */, - XEN_SYSCTL_TMEM_OP_GET_POOLS, - domid /* cli_id */, sizeof(*pools) * info.nr_pools, - 0 /* arg */, pools); - - if ( rc < 0 || (uint32_t)rc > info.nr_pools ) - goto out_memory; - - /* Update it - as we have less pools between the two hypercalls. */ - info.nr_pools = (uint32_t)rc; - - if ( write_exact(io_fd, &marker, sizeof(marker)) ) - goto out_memory; - - if ( write_exact(io_fd, &info, sizeof(info)) ) - goto out_memory; - - if ( write_exact(io_fd, &minusone, sizeof(minusone)) ) - goto out_memory; - - for ( i = 0; i < info.nr_pools; i++ ) - { - uint32_t pagesize; - int bufsize = 0; - int checksum = 0; - xen_tmem_pool_info_t *pool = &pools[i]; - - if ( pool->flags.raw != -1 ) - { - if ( !pool->flags.u.persist ) - pool->n_pages = 0; - - if ( write_exact(io_fd, pool, sizeof(*pool)) ) - goto out_memory; - - if ( !pool->flags.u.persist ) - continue; - - pagesize = 1 << (pool->flags.u.pagebits + 12); - if ( pagesize > bufsize ) - { - bufsize = pagesize + sizeof(struct tmem_handle); - if ( (buf = realloc(buf,bufsize)) == NULL ) - goto out_memory; - } - for ( j = pool->n_pages; j > 0; j-- ) - { - int ret; - if ( (ret = xc_tmem_control( - xch, pool->id, XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE, - domid, bufsize, 0, buf)) > 0 ) - { - h = (struct tmem_handle *)buf; - if ( write_exact(io_fd, &h->oid, sizeof(h->oid)) ) - goto out_memory; - - if ( write_exact(io_fd, &h->index, sizeof(h->index)) ) - goto out_memory; - h++; - checksum += *(char *)h; - if ( write_exact(io_fd, h, pagesize) ) - goto out_memory; - } else if ( ret == 0 ) { - continue; - } else { - /* page list terminator */ - h = (struct tmem_handle *)buf; - h->oid.oid[0] = h->oid.oid[1] = h->oid.oid[2] = -1L; - if ( write_exact(io_fd, &h->oid, sizeof(h->oid)) ) - { - out_memory: - free(pools); - free(buf); - return -1; - } - break; - } - } - DPRINTF("saved %"PRId64" tmem pages for dom=%d pool=%d, checksum=%x\n", - pool->n_pages - j, domid, pool->id, checksum); - } - } - free(pools); - free(buf); - - /* pool list terminator */ - minusone = -1; - if ( write_exact(io_fd, &minusone, sizeof(minusone)) ) - return -1; - - return 1; -} - -/* only called for live migration */ -int xc_tmem_save_extra(xc_interface *xch, uint32_t domid, int io_fd, int field_marker) -{ - struct tmem_handle handle; - int marker = field_marker; - uint32_t minusone; - int count = 0, checksum = 0; - - if ( write_exact(io_fd, &marker, sizeof(marker)) ) - return -1; - while ( xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV, domid, - sizeof(handle),0,&handle) > 0 ) { - if ( write_exact(io_fd, &handle.pool_id, sizeof(handle.pool_id)) ) - return -1; - if ( write_exact(io_fd, &handle.oid, sizeof(handle.oid)) ) - return -1; - if ( write_exact(io_fd, &handle.index, sizeof(handle.index)) ) - return -1; - count++; - checksum += handle.pool_id + handle.oid.oid[0] + handle.oid.oid[1] + - handle.oid.oid[2] + handle.index; - } - if ( count ) - DPRINTF("needed %d tmem invalidates, check=%d\n",count,checksum); - minusone = -1; - if ( write_exact(io_fd, &minusone, sizeof(minusone)) ) - return -1; - return 0; -} - -/* only called for live migration */ -void xc_tmem_save_done(xc_interface *xch, uint32_t domid) -{ - xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_END, domid, 0, 0, NULL); -} - -/* restore routines */ - -static int xc_tmem_restore_new_pool( - xc_interface *xch, - int cli_id, - uint32_t pool_id, - uint32_t flags, - uint64_t uuid_lo, - uint64_t uuid_hi) -{ - xen_tmem_pool_info_t pool = { - .flags.raw = flags, - .id = pool_id, - .n_pages = 0, - .uuid[0] = uuid_lo, - .uuid[1] = uuid_hi, - }; - - return xc_tmem_control(xch, pool_id, - XEN_SYSCTL_TMEM_OP_SET_POOLS, - cli_id, sizeof(pool), - 0 /* arg */, &pool); -} - -int xc_tmem_restore(xc_interface *xch, uint32_t domid, int io_fd) -{ - uint32_t minusone; - xen_tmem_client_t info; - int checksum = 0; - unsigned int i; - char *buf = NULL; - - if ( read_exact(io_fd, &info, sizeof(info)) ) - return -1; - - /* We would never save if there weren't any pools! */ - if ( !info.nr_pools ) - return -1; - - if ( xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN, domid, 0, 0, NULL) < 0 ) - return -1; - - if ( xc_tmem_control(xch, 0 /* pool_id */, - XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO, - domid /* cli_id */, sizeof(info), 0 /* arg */, - &info) < 0 ) - return -1; - - if ( read_exact(io_fd, &minusone, sizeof(minusone)) ) - return -1; - - for ( i = 0; i < info.nr_pools; i++ ) - { - int bufsize = 0, pagesize; - int j; - xen_tmem_pool_info_t pool; - - if ( read_exact(io_fd, &pool, sizeof(pool)) ) - goto out_memory; - - if ( xc_tmem_restore_new_pool(xch, domid, pool.id, pool.flags.raw, - pool.uuid[0], pool.uuid[1]) < 0 ) - goto out_memory; - - if ( pool.n_pages <= 0 ) - continue; - - pagesize = 1 << (pool.flags.u.pagebits + 12); - if ( pagesize > bufsize ) - { - bufsize = pagesize; - if ( (buf = realloc(buf,bufsize)) == NULL ) - goto out_memory; - } - for ( j = pool.n_pages; j > 0; j-- ) - { - struct xen_tmem_oid oid; - uint32_t index; - int rc; - - if ( read_exact(io_fd, &oid, sizeof(oid)) ) - goto out_memory; - - if ( oid.oid[0] == -1L && oid.oid[1] == -1L && oid.oid[2] == -1L ) - break; - if ( read_exact(io_fd, &index, sizeof(index)) ) - goto out_memory; - - if ( read_exact(io_fd, buf, pagesize) ) - goto out_memory; - - checksum += *buf; - if ( (rc = xc_tmem_control_oid( - xch, pool.id, XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE, - domid, bufsize, index, oid, buf)) <= 0 ) - { - DPRINTF("xc_tmem_restore: putting page failed, rc=%d\n",rc); - out_memory: - free(buf); - return -1; - } - } - if ( pool.n_pages ) - DPRINTF("restored %"PRId64" tmem pages for dom=%d pool=%d, check=%x\n", - pool.n_pages - j, domid, pool.id, checksum); - } - free(buf); - - return 0; -} - -/* only called for live migration, must be called after suspend */ -int xc_tmem_restore_extra(xc_interface *xch, uint32_t domid, int io_fd) -{ - uint32_t pool_id; - struct xen_tmem_oid oid; - uint32_t index; - int count = 0; - int checksum = 0; - - while ( read_exact(io_fd, &pool_id, sizeof(pool_id)) == 0 && pool_id != -1 ) - { - if ( read_exact(io_fd, &oid, sizeof(oid)) ) - return -1; - if ( read_exact(io_fd, &index, sizeof(index)) ) - return -1; - if ( xc_tmem_control_oid( - xch, pool_id, XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE, - domid, 0, index, oid, NULL) <= 0 ) - return -1; - count++; - checksum += pool_id + oid.oid[0] + oid.oid[1] + oid.oid[2] + index; - } - if ( pool_id != -1 ) - return -1; - if ( count ) - DPRINTF("invalidated %d tmem pages, check=%d\n",count,checksum); - - return 0; -} - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/tools/libxl/libxl_tmem.c b/tools/libxl/libxl_tmem.c index 2bee8d1edf..a553b39738 100644 --- a/tools/libxl/libxl_tmem.c +++ b/tools/libxl/libxl_tmem.c @@ -16,146 +16,55 @@ #include "libxl_internal.h" +/* TMEM is gone. Leave some stubs here. */ + char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long) { - int r; - char _buf[32768]; GC_INIT(ctx); - - r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_LIST, domid, 32768, - use_long, _buf); - if (r < 0) { - LOGED(ERROR, domid, "Can not get tmem list"); - GC_FREE; - return NULL; - } - + LOGED(ERROR, domid, "Can not get tmem list"); GC_FREE; - return strdup(_buf); + return NULL; } int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid) { - int r, rc; GC_INIT(ctx); - - r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_FREEZE, domid, 0, 0, - NULL); - if (r < 0) { - LOGED(ERROR, domid, "Can not freeze tmem pools"); - rc = ERROR_FAIL; - goto out; - } - - rc = 0; -out: + LOGED(ERROR, domid, "Can not freeze tmem pools"); GC_FREE; - return rc; + return ERROR_FAIL; } int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid) { - int r, rc; GC_INIT(ctx); - - r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_THAW, domid, 0, 0, - NULL); - if (r < 0) { - LOGED(ERROR, domid, "Can not thaw tmem pools"); - rc = ERROR_FAIL; - goto out; - } - - rc = 0; -out: + LOGED(ERROR, domid, "Can not thaw tmem pools"); GC_FREE; - return rc; -} - -static int32_t tmem_setop_from_string(char *set_name, uint32_t val, - xen_tmem_client_t *info) -{ - if (!strcmp(set_name, "weight")) - info->weight = val; - else if (!strcmp(set_name, "compress")) - info->flags.u.compress = val; - else - return -1; - - return 0; + return ERROR_FAIL; } int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) { - int r, rc; - xen_tmem_client_t info; GC_INIT(ctx); - - r = xc_tmem_control(ctx->xch, -1 /* pool_id */, - XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO, - domid, sizeof(info), 0 /* arg */, &info); - if (r < 0) { - LOGED(ERROR, domid, "Can not get tmem data!"); - rc = ERROR_FAIL; - goto out; - } - rc = tmem_setop_from_string(name, set, &info); - if (rc == -1) { - LOGEVD(ERROR, -1, domid, "Invalid set, valid sets are <weight|compress>"); - rc = ERROR_INVAL; - goto out; - } - r = xc_tmem_control(ctx->xch, -1 /* pool_id */, - XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO, - domid, sizeof(info), 0 /* arg */, &info); - if (r < 0) { - LOGED(ERROR, domid, "Can not set tmem %s", name); - rc = ERROR_FAIL; - goto out; - } - - rc = 0; -out: + LOGED(ERROR, domid, "Can not set tmem %s", name); GC_FREE; - return rc; + return ERROR_FAIL; } int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid, int auth) { - int r, rc; GC_INIT(ctx); - - r = xc_tmem_auth(ctx->xch, domid, uuid, auth); - if (r < 0) { - LOGED(ERROR, domid, "Can not set tmem shared auth"); - rc = ERROR_FAIL; - goto out; - } - - rc = 0; -out: + LOGED(ERROR, domid, "Can not set tmem shared auth"); GC_FREE; - return rc; + return ERROR_FAIL; } int libxl_tmem_freeable(libxl_ctx *ctx) { - int r, rc; GC_INIT(ctx); - - r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB, - -1, 0, 0, 0); - if (r < 0) { - LOGE(ERROR, "Can not get tmem freeable memory"); - rc = ERROR_FAIL; - goto out; - } - - rc = 0; -out: + LOGE(ERROR, "Can not get tmem freeable memory"); GC_FREE; - return rc; + return ERROR_FAIL; } /* diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 51adb6f1a6..d4320dce81 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -22,7 +22,6 @@ INSTALL_SBIN-$(CONFIG_X86) += xen-hvmcrash INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx INSTALL_SBIN-$(CONFIG_X86) += xen-lowmemd INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump -INSTALL_SBIN += xen-tmem-list-parse INSTALL_SBIN += xencov INSTALL_SBIN += xenlockprof INSTALL_SBIN += xenperf diff --git a/tools/misc/xen-tmem-list-parse.c b/tools/misc/xen-tmem-list-parse.c deleted file mode 100644 index f32b107dce..0000000000 --- a/tools/misc/xen-tmem-list-parse.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Parse output from tmem-list and reformat to human-readable - * - * NOTE: NEVER delete a parse call as this file documents backwards - * compatibility for older versions of tmem-list and we don't want to - * accidentally reuse an old tag - * - * Copyright (c) 2009, Dan Magenheimer, Oracle Corp. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> - -#define BUFSIZE 4096 -#define PAGE_SIZE 4096 - -unsigned long long parse(char *s,char *match) -{ - char *s1 = strstr(s,match); - unsigned long long ret; - - if ( s1 == NULL ) - return 0LL; - s1 += 2; - if ( *s1++ != ':' ) - return 0LL; - sscanf(s1,"%llu",&ret); - return ret; -} - -unsigned long long parse_hex(char *s,char *match) -{ - char *s1 = strstr(s,match); - unsigned long long ret; - - if ( s1 == NULL ) - return 0LL; - s1 += 2; - if ( *s1++ != ':' ) - return 0LL; - sscanf(s1,"%llx",&ret); - return ret; -} - -unsigned long long parse2(char *s,char *match1, char *match2) -{ - char match[3]; - match[0] = *match1; - match[1] = *match2; - match[2] = '\0'; - return parse(s,match); -} - -void parse_string(char *s,char *match, char *buf, int len) -{ - char *s1 = strstr(s,match); - int i; - - if ( s1 == NULL ) - return; - s1 += 2; - if ( *s1++ != ':' ) - return; - for ( i = 0; i < len; i++ ) - *buf++ = *s1++; -} - -void parse_sharers(char *s, char *match, char *buf, int len) -{ - char *s1 = strstr(s,match); - char *b = buf; - - if ( s1 == NULL ) - return; - while ( s1 ) - { - s1 += 2; - if (*s1++ != ':') - return; - while (*s1 >= '0' && *s1 <= '9') - *b++ = *s1++; - *b++ = ','; - s1 = strstr(s1,match); - } - if ( b != buf ) - *--b = '\0'; -} - -void parse_global(char *s) -{ - unsigned long long total_ops = parse(s,"Tt"); - unsigned long long errored_ops = parse(s,"Te"); - unsigned long long failed_copies = parse(s,"Cf"); - unsigned long long alloc_failed = parse(s,"Af"); - unsigned long long alloc_page_failed = parse(s,"Pf"); - unsigned long long avail_pages = parse(s,"Ta"); - unsigned long long low_on_memory = parse(s,"Lm"); - unsigned long long evicted_pgs = parse(s,"Et"); - unsigned long long evict_attempts = parse(s,"Ea"); - unsigned long long relinq_pgs = parse(s,"Rt"); - unsigned long long relinq_attempts = parse(s,"Ra"); - unsigned long long max_evicts_per_relinq = parse(s,"Rx"); - unsigned long long total_flush_pool = parse(s,"Fp"); - unsigned long long global_eph_count = parse(s,"Ec"); - unsigned long long global_eph_max = parse(s,"Em"); - unsigned long long obj_count = parse(s,"Oc"); - unsigned long long obj_max = parse(s,"Om"); - unsigned long long rtree_node_count = parse(s,"Nc"); - unsigned long long rtree_node_max = parse(s,"Nm"); - unsigned long long pgp_count = parse(s,"Pc"); - unsigned long long pgp_max = parse(s,"Pm"); - unsigned long long page_count = parse(s,"Fc"); - unsigned long long max_page_count = parse(s,"Fm"); - unsigned long long pcd_count = parse(s,"Sc"); - unsigned long long max_pcd_count = parse(s,"Sm"); - unsigned long long pcd_tot_tze_size = parse(s,"Zt"); - unsigned long long pcd_tot_csize = parse(s,"Gz"); - unsigned long long deduped_puts = parse(s,"Gd"); - unsigned long long tot_good_eph_puts = parse(s,"Ep"); - - printf("total tmem ops=%llu (errors=%llu) -- tmem pages avail=%llu\n", - total_ops, errored_ops, avail_pages); - printf("datastructs: objs=%llu (max=%llu) pgps=%llu (max=%llu) " - "nodes=%llu (max=%llu) pages=%llu (max=%llu) ", - obj_count, obj_max, pgp_count, pgp_max, - rtree_node_count, rtree_node_max, - page_count,max_page_count); - if (max_pcd_count != 0 && global_eph_count != 0 && tot_good_eph_puts != 0) { - printf("pcds=%llu (max=%llu) ", - pcd_count,max_pcd_count); - printf("deduped: avg=%4.2f%% (curr=%4.2f%%) ", - ((deduped_puts*1.0)/tot_good_eph_puts)*100, - (1.0-(pcd_count*1.0)/global_eph_count)*100); - } - if (pcd_count != 0) - { - if (pcd_tot_tze_size && (pcd_tot_tze_size < pcd_count*PAGE_SIZE)) - printf("tze savings=%4.2f%% ", - (1.0-(pcd_tot_tze_size*1.0)/(pcd_count*PAGE_SIZE))*100); - if (pcd_tot_csize && (pcd_tot_csize < pcd_count*PAGE_SIZE)) - printf("compression savings=%4.2f%% ", - (1.0-(pcd_tot_csize*1.0)/(pcd_count*PAGE_SIZE))*100); - } - printf("\n"); - printf("misc: failed_copies=%llu alloc_failed=%llu alloc_page_failed=%llu " - "low_mem=%llu evicted=%llu/%llu relinq=%llu/%llu, " - "max_evicts_per_relinq=%llu, flush_pools=%llu, " - "eph_count=%llu, eph_max=%llu\n", - failed_copies, alloc_failed, alloc_page_failed, low_on_memory, - evicted_pgs, evict_attempts, relinq_pgs, relinq_attempts, - max_evicts_per_relinq, total_flush_pool, - global_eph_count, global_eph_max); -} - -#define PARSE_CYC_COUNTER(s,x,prefix) unsigned long long \ - x##_count = parse2(s,prefix,"n"), \ - x##_sum_cycles = parse2(s,prefix,"t"), \ - x##_max_cycles = parse2(s,prefix,"x"), \ - x##_min_cycles = parse2(s,prefix,"m") -#define PRINTF_CYC_COUNTER(x,text) \ - if (x##_count) printf(text" avg=%llu, max=%llu, " \ - "min=%llu, samples=%llu\n", \ - x##_sum_cycles ? (x##_sum_cycles/x##_count) : 0, \ - x##_max_cycles, x##_min_cycles, x##_count) - -void parse_time_stats(char *s) -{ - PARSE_CYC_COUNTER(s,succ_get,"G"); - PARSE_CYC_COUNTER(s,succ_put,"P"); - PARSE_CYC_COUNTER(s,non_succ_get,"g"); - PARSE_CYC_COUNTER(s,non_succ_put,"p"); - PARSE_CYC_COUNTER(s,flush,"F"); - PARSE_CYC_COUNTER(s,flush_obj,"O"); - PARSE_CYC_COUNTER(s,pg_copy,"C"); - PARSE_CYC_COUNTER(s,compress,"c"); - PARSE_CYC_COUNTER(s,decompress,"d"); - - PRINTF_CYC_COUNTER(succ_get,"succ get cycles:"); - PRINTF_CYC_COUNTER(succ_put,"succ put cycles:"); - PRINTF_CYC_COUNTER(non_succ_get,"failed get cycles:"); - PRINTF_CYC_COUNTER(non_succ_put,"failed put cycles:"); - PRINTF_CYC_COUNTER(flush,"flush cycles:"); - PRINTF_CYC_COUNTER(flush_obj,"flush_obj cycles:"); - PRINTF_CYC_COUNTER(pg_copy,"page copy cycles:"); - PRINTF_CYC_COUNTER(compress,"compression cycles:"); - PRINTF_CYC_COUNTER(decompress,"decompression cycles:"); -} - -void parse_client(char *s) -{ - unsigned long cli_id = parse(s,"CI"); - unsigned long weight = parse(s,"ww"); - unsigned long cap = parse(s,"ca"); - unsigned long compress = parse(s,"co"); - unsigned long frozen = parse(s,"fr"); - unsigned long long eph_count = parse(s,"Ec"); - unsigned long long max_eph_count = parse(s,"Em"); - unsigned long long compressed_pages = parse(s,"cp"); - unsigned long long compressed_sum_size = parse(s,"cb"); - unsigned long long compress_poor = parse(s,"cn"); - unsigned long long compress_nomem = parse(s,"cm"); - unsigned long long total_cycles = parse(s,"Tc"); - unsigned long long succ_eph_gets = parse(s,"Ge"); - unsigned long long succ_pers_puts = parse(s,"Pp"); - unsigned long long succ_pers_gets = parse(s,"Gp"); - - printf("domid%lu: weight=%lu,cap=%lu,compress=%d,frozen=%d," - "total_cycles=%llu,succ_eph_gets=%llu," - "succ_pers_puts=%llu,succ_pers_gets=%llu," - "eph_count=%llu,max_eph=%llu," - "compression ratio=%lu%% (samples=%llu,poor=%llu,nomem=%llu)\n", - cli_id, weight, cap, compress?1:0, frozen?1:0, - total_cycles, succ_eph_gets, succ_pers_puts, succ_pers_gets, - eph_count, max_eph_count, - compressed_pages ? (long)((compressed_sum_size*100LL) / - (compressed_pages*PAGE_SIZE)) : 0, - compressed_pages, compress_poor, compress_nomem); - -} - -void parse_pool(char *s) -{ - char pool_type[3]; - unsigned long cli_id = parse(s,"CI"); - unsigned long pool_id = parse(s,"PI"); - unsigned long long pgp_count = parse(s,"Pc"); - unsigned long long max_pgp_count = parse(s,"Pm"); - unsigned long long obj_count = parse(s,"Oc"); - unsigned long long max_obj_count = parse(s,"Om"); - unsigned long long objnode_count = parse(s,"Nc"); - unsigned long long max_objnode_count = parse(s,"Nm"); - unsigned long long good_puts = parse(s,"ps"); - unsigned long long puts = parse(s,"pt"); - unsigned long long no_mem_puts = parse(s,"px"); - unsigned long long dup_puts_flushed = parse(s,"pd"); - unsigned long long dup_puts_replaced = parse(s,"pr"); - unsigned long long found_gets = parse(s,"gs"); - unsigned long long gets = parse(s,"gt"); - unsigned long long flushs_found = parse(s,"fs"); - unsigned long long flushs = parse(s,"ft"); - unsigned long long flush_objs_found = parse(s,"os"); - unsigned long long flush_objs = parse(s,"ot"); - - parse_string(s,"PT",pool_type,2); - pool_type[2] = '\0'; - if (pool_type[1] == 'S') - return; /* no need to repeat print data for shared pools */ - printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) " - "objnode=%llu(%llu) puts=%llu/%llu/%llu(dup=%llu/%llu) " - "gets=%llu/%llu(%llu%%) " - "flush=%llu/%llu flobj=%llu/%llu\n", - cli_id, pool_id, pool_type, - pgp_count, max_pgp_count, obj_count, max_obj_count, - objnode_count, max_objnode_count, - good_puts, puts, no_mem_puts, - dup_puts_flushed, dup_puts_replaced, - found_gets, gets, - gets ? (found_gets*100LL)/gets : 0, - flushs_found, flushs, flush_objs_found, flush_objs); - -} - -void parse_shared_pool(char *s) -{ - char pool_type[3]; - char buf[BUFSIZE]; - unsigned long pool_id = parse(s,"PI"); - unsigned long long uid0 = parse_hex(s,"U0"); - unsigned long long uid1 = parse_hex(s,"U1"); - unsigned long long pgp_count = parse(s,"Pc"); - unsigned long long max_pgp_count = parse(s,"Pm"); - unsigned long long obj_count = parse(s,"Oc"); - unsigned long long max_obj_count = parse(s,"Om"); - unsigned long long objnode_count = parse(s,"Nc"); - unsigned long long max_objnode_count = parse(s,"Nm"); - unsigned long long good_puts = parse(s,"ps"); - unsigned long long puts = parse(s,"pt"); - unsigned long long no_mem_puts = parse(s,"px"); - unsigned long long dup_puts_flushed = parse(s,"pd"); - unsigned long long dup_puts_replaced = parse(s,"pr"); - unsigned long long found_gets = parse(s,"gs"); - unsigned long long gets = parse(s,"gt"); - unsigned long long flushs_found = parse(s,"fs"); - unsigned long long flushs = parse(s,"ft"); - unsigned long long flush_objs_found = parse(s,"os"); - unsigned long long flush_objs = parse(s,"ot"); - - parse_string(s,"PT",pool_type,2); - pool_type[2] = '\0'; - parse_sharers(s,"SC",buf,BUFSIZE); - printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: " - "pgp=%llu(max=%llu) obj=%llu(%llu) " - "objnode=%llu(%llu) puts=%llu/%llu/%llu(dup=%llu/%llu) " - "gets=%llu/%llu(%llu%%) " - "flush=%llu/%llu flobj=%llu/%llu\n", - pool_id, pool_type, uid0, uid1, buf, - pgp_count, max_pgp_count, obj_count, max_obj_count, - objnode_count, max_objnode_count, - good_puts, puts, no_mem_puts, - dup_puts_flushed, dup_puts_replaced, - found_gets, gets, - gets ? (found_gets*100LL)/gets : 0, - flushs_found, flushs, flush_objs_found, flush_objs); -} - -int main(int ac, char **av) -{ - char *p, c; - char buf[BUFSIZE]; - - while ( (p = fgets(buf,BUFSIZE,stdin)) != NULL ) - { - c = *p++; - if ( *p++ != '=' ) - continue; - switch ( c ) - { - case 'G': - parse_global(p); - break; - case 'T': - parse_time_stats(p); - break; - case 'C': - parse_client(p); - break; - case 'P': - parse_pool(p); - break; - case 'S': - parse_shared_pool(p); - break; - default: - continue; - } - } - return 0; -} diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index cc8175a11e..2d97dc5ecd 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -17,7 +17,6 @@ #include <arpa/inet.h> #include <xen/elfnote.h> -#include <xen/tmem.h> #include "xc_dom.h" #include <xen/hvm/hvm_info_table.h> #include <xen/hvm/params.h> @@ -1614,71 +1613,6 @@ static PyObject *dom_op(XcObject *self, PyObject *args, return zero; } -static PyObject *pyxc_tmem_control(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - int32_t pool_id; - uint32_t subop; - uint32_t cli_id; - uint32_t len; - uint32_t arg; - char *buf; - char _buffer[32768], *buffer = _buffer; - int rc; - - static char *kwd_list[] = { "pool_id", "subop", "cli_id", "arg1", "arg2", "buf", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiis", kwd_list, - &pool_id, &subop, &cli_id, &len, &arg, &buf) ) - return NULL; - - if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (len > 32768) ) - len = 32768; - - if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, len, arg, buffer)) < 0 ) - return Py_BuildValue("i", rc); - - switch (subop) { - case XEN_SYSCTL_TMEM_OP_LIST: - return Py_BuildValue("s", buffer); - case XEN_SYSCTL_TMEM_OP_FLUSH: - return Py_BuildValue("i", rc); - case XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB: - return Py_BuildValue("i", rc); - case XEN_SYSCTL_TMEM_OP_THAW: - case XEN_SYSCTL_TMEM_OP_FREEZE: - case XEN_SYSCTL_TMEM_OP_DESTROY: - default: - break; - } - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_tmem_shared_auth(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t cli_id; - uint32_t arg1; - char *uuid_str; - int rc; - - static char *kwd_list[] = { "cli_id", "uuid_str", "arg1", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "isi", kwd_list, - &cli_id, &uuid_str, &arg1) ) - return NULL; - - if ( (rc = xc_tmem_auth(self->xc_handle, cli_id, uuid_str, arg1)) < 0 ) - return Py_BuildValue("i", rc); - - Py_INCREF(zero); - return zero; -} - static PyObject *pyxc_dom_set_memshr(XcObject *self, PyObject *args) { uint32_t dom; @@ -2497,27 +2431,6 @@ static PyMethodDef pyxc_methods[] = { " dom [int]: Identifier of domain.\n" }, #endif - { "tmem_control", - (PyCFunction)pyxc_tmem_control, - METH_VARARGS | METH_KEYWORDS, "\n" - "Do various control on a tmem pool.\n" - " pool_id [int]: Identifier of the tmem pool (-1 == all).\n" - " subop [int]: Supplementary Operation.\n" - " cli_id [int]: Client identifier (-1 == all).\n" - " len [int]: Length of 'buf'.\n" - " arg [int]: Argument.\n" - " buf [str]: Buffer.\n\n" - "Returns: [int] 0 or [str] tmem info on success; exception on error.\n" }, - - { "tmem_shared_auth", - (PyCFunction)pyxc_tmem_shared_auth, - METH_VARARGS | METH_KEYWORDS, "\n" - "De/authenticate a shared tmem pool.\n" - " cli_id [int]: Client identifier (-1 == all).\n" - " uuid_str [str]: uuid.\n" - " auth [int]: 0|1 .\n" - "Returns: [int] 0 on success; exception on error.\n" }, - { "dom_set_memshr", (PyCFunction)pyxc_dom_set_memshr, METH_VARARGS, "\n" diff --git a/tools/xenstat/libxenstat/src/xenstat.c b/tools/xenstat/libxenstat/src/xenstat.c index 8b856b32a3..bba143eb53 100644 --- a/tools/xenstat/libxenstat/src/xenstat.c +++ b/tools/xenstat/libxenstat/src/xenstat.c @@ -145,19 +145,6 @@ static inline unsigned long long parse(char *s, char *match) return ret; } -void domain_get_tmem_stats(xenstat_handle * handle, xenstat_domain * domain) -{ - char buffer[4096]; - - if (xc_tmem_control(handle->xc_handle,-1,XEN_SYSCTL_TMEM_OP_LIST,domain->id, - sizeof(buffer),-1,buffer) < 0) - return; - domain->tmem_stats.curr_eph_pages = parse(buffer,"Ec"); - domain->tmem_stats.succ_eph_gets = parse(buffer,"Ge"); - domain->tmem_stats.succ_pers_puts = parse(buffer,"Pp"); - domain->tmem_stats.succ_pers_gets = parse(buffer,"Gp"); -} - xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags) { #define DOMAIN_CHUNK_SIZE 256 @@ -166,7 +153,6 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags) xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE]; int new_domains; unsigned int i; - int rc; /* Create the node */ node = (xenstat_node *) calloc(1, sizeof(xenstat_node)); @@ -190,9 +176,7 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags) node->free_mem = ((unsigned long long)physinfo.free_pages) * handle->page_size; - rc = xc_tmem_control(handle->xc_handle, -1, - XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB, -1, 0, 0, NULL); - node->freeable_mb = (rc < 0) ? 0 : rc; + node->freeable_mb = 0; /* malloc(0) is not portable, so allocate a single domain. This will * be resized below. */ node->domains = malloc(sizeof(xenstat_domain)); @@ -260,7 +244,6 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags) domain->networks = NULL; domain->num_vbds = 0; domain->vbds = NULL; - domain_get_tmem_stats(handle,domain); domain++; node->num_domains++; @@ -735,40 +718,6 @@ bool xenstat_vbd_error(xenstat_vbd * vbd) return vbd->error; } -/* - * Tmem functions - */ - -xenstat_tmem *xenstat_domain_tmem(xenstat_domain * domain) -{ - return &domain->tmem_stats; -} - -/* Get the current number of ephemeral pages */ -unsigned long long xenstat_tmem_curr_eph_pages(xenstat_tmem *tmem) -{ - return tmem->curr_eph_pages; -} - -/* Get the number of successful ephemeral gets */ -unsigned long long xenstat_tmem_succ_eph_gets(xenstat_tmem *tmem) -{ - return tmem->succ_eph_gets; -} - -/* Get the number of successful persistent puts */ -unsigned long long xenstat_tmem_succ_pers_puts(xenstat_tmem *tmem) -{ - return tmem->succ_pers_puts; -} - -/* Get the number of successful persistent gets */ -unsigned long long xenstat_tmem_succ_pers_gets(xenstat_tmem *tmem) -{ - return tmem->succ_pers_gets; -} - - static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain_id) { char path[80]; diff --git a/tools/xenstat/libxenstat/src/xenstat.h b/tools/xenstat/libxenstat/src/xenstat.h index 9f5053dd92..76a660f321 100644 --- a/tools/xenstat/libxenstat/src/xenstat.h +++ b/tools/xenstat/libxenstat/src/xenstat.h @@ -29,7 +29,6 @@ typedef struct xenstat_node xenstat_node; typedef struct xenstat_vcpu xenstat_vcpu; typedef struct xenstat_network xenstat_network; typedef struct xenstat_vbd xenstat_vbd; -typedef struct xenstat_tmem xenstat_tmem; /* Initialize the xenstat library. Returns a handle to be used with * subsequent calls to the xenstat library, or NULL if an error occurs. */ @@ -72,9 +71,6 @@ unsigned long long xenstat_node_tot_mem(xenstat_node * node); /* Get amount of free memory on a node */ unsigned long long xenstat_node_free_mem(xenstat_node * node); -/* Get amount of tmem freeable memory (in MiB) on a node */ -long xenstat_node_freeable_mb(xenstat_node * node); - /* Find the number of domains existing on a node */ unsigned int xenstat_node_num_domains(xenstat_node * node); @@ -135,9 +131,6 @@ unsigned int xenstat_domain_num_vbds(xenstat_domain *); xenstat_vbd *xenstat_domain_vbd(xenstat_domain * domain, unsigned int vbd); -/* Get the tmem information for a given domain */ -xenstat_tmem *xenstat_domain_tmem(xenstat_domain * domain); - /* * VCPU functions - extract information from a xenstat_vcpu */ @@ -198,12 +191,4 @@ unsigned long long xenstat_vbd_wr_sects(xenstat_vbd * vbd); /* Returns error while getting stats (1 if error happened, 0 otherwise) */ bool xenstat_vbd_error(xenstat_vbd * vbd); -/* - * Tmem functions - extract tmem information - */ -unsigned long long xenstat_tmem_curr_eph_pages(xenstat_tmem *tmem); -unsigned long long xenstat_tmem_succ_eph_gets(xenstat_tmem *tmem); -unsigned long long xenstat_tmem_succ_pers_puts(xenstat_tmem *tmem); -unsigned long long xenstat_tmem_succ_pers_gets(xenstat_tmem *tmem); - #endif /* XENSTAT_H */ diff --git a/tools/xenstat/libxenstat/src/xenstat_priv.h b/tools/xenstat/libxenstat/src/xenstat_priv.h index ebfcd0fff6..4eb44a8ebb 100644 --- a/tools/xenstat/libxenstat/src/xenstat_priv.h +++ b/tools/xenstat/libxenstat/src/xenstat_priv.h @@ -52,13 +52,6 @@ struct xenstat_node { long freeable_mb; }; -struct xenstat_tmem { - unsigned long long curr_eph_pages; - unsigned long long succ_eph_gets; - unsigned long long succ_pers_puts; - unsigned long long succ_pers_gets; -}; - struct xenstat_domain { unsigned int id; char *name; @@ -73,7 +66,6 @@ struct xenstat_domain { xenstat_network *networks; /* Array of length num_networks */ unsigned int num_vbds; xenstat_vbd *vbds; - xenstat_tmem tmem_stats; }; struct xenstat_vcpu { diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c index 31ea0e65a6..af11ebfbf7 100644 --- a/tools/xenstat/xentop/xentop.c +++ b/tools/xenstat/xentop/xentop.c @@ -209,7 +209,6 @@ unsigned int iterations = 0; int show_vcpus = 0; int show_networks = 0; int show_vbds = 0; -int show_tmem = 0; int repeat_header = 0; int show_full_name = 0; #define PROMPT_VAL_LEN 80 @@ -362,9 +361,6 @@ static int handle_key(int ch) case 'b': case 'B': show_vbds ^= 1; break; - case 't': case 'T': - show_tmem ^= 1; - break; case 'r': case 'R': repeat_header ^= 1; break; @@ -973,8 +969,8 @@ void do_summary(void) "%u crashed, %u dying, %u shutdown \n", num_domains, run, block, pause, crash, dying, shutdown); - used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node); - freeable_mb = xenstat_node_freeable_mb(cur_node); + used = xenstat_node_tot_mem(cur_node); + freeable_mb = 0; /* Dump node memory and cpu information */ if ( freeable_mb <= 0 ) @@ -1032,12 +1028,6 @@ void do_bottom_line(void) attr_addstr(show_vbds ? COLOR_PAIR(1) : 0, "ds"); addstr(" "); - /* tmem */ - addch(A_REVERSE | 'T'); - attr_addstr(show_tmem ? COLOR_PAIR(1) : 0, "mem"); - addstr(" "); - - /* vcpus */ addch(A_REVERSE | 'V'); attr_addstr(show_vcpus ? COLOR_PAIR(1) : 0, "CPUs"); @@ -1175,23 +1165,6 @@ void do_vbd(xenstat_domain *domain) } } -/* Output all tmem information */ -void do_tmem(xenstat_domain *domain) -{ - xenstat_tmem *tmem = xenstat_domain_tmem(domain); - unsigned long long curr_eph_pages = xenstat_tmem_curr_eph_pages(tmem); - unsigned long long succ_eph_gets = xenstat_tmem_succ_eph_gets(tmem); - unsigned long long succ_pers_puts = xenstat_tmem_succ_pers_puts(tmem); - unsigned long long succ_pers_gets = xenstat_tmem_succ_pers_gets(tmem); - - if (curr_eph_pages | succ_eph_gets | succ_pers_puts | succ_pers_gets) - print("Tmem: Curr eph pages: %8llu Succ eph gets: %8llu " - "Succ pers puts: %8llu Succ pers gets: %8llu\n", - curr_eph_pages, succ_eph_gets, - succ_pers_puts, succ_pers_gets); - -} - static void top(void) { xenstat_domain **domains; @@ -1244,8 +1217,6 @@ static void top(void) do_network(domains[i]); if (show_vbds) do_vbd(domains[i]); - if (show_tmem) - do_tmem(domains[i]); } if (!batch) @@ -1321,9 +1292,6 @@ int main(int argc, char **argv) case 'f': show_full_name = 1; break; - case 't': - show_tmem = 1; - break; } } diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 2769295515..af4912e67a 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow XL_OBJS-$(CONFIG_X86) = xl_psr.o XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o $(XL_OBJS-y) -XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o +XL_OBJS += xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o XL_OBJS += xl_info.o xl_console.o xl_misc.o diff --git a/tools/xl/xl.h b/tools/xl/xl.h index cf4202bc89..60bdad8ffb 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -184,12 +184,6 @@ int main_usbdev_detach(int argc, char **argv); int main_usblist(int argc, char **argv); int main_uptime(int argc, char **argv); int main_claims(int argc, char **argv); -int main_tmem_list(int argc, char **argv); -int main_tmem_freeze(int argc, char **argv); -int main_tmem_thaw(int argc, char **argv); -int main_tmem_set(int argc, char **argv); -int main_tmem_shared_auth(int argc, char **argv); -int main_tmem_freeable(int argc, char **argv); int main_network2attach(int argc, char **argv); int main_network2list(int argc, char **argv); int main_network2detach(int argc, char **argv); diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 89716badcb..5baa6023aa 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -443,46 +443,6 @@ struct cmd_spec cmd_table[] = { "", "", }, - { "tmem-list", - &main_tmem_list, 0, 0, - "List tmem pools", - "[-l] [<Domain>|-a]", - " -l List tmem stats", - }, - { "tmem-freeze", - &main_tmem_freeze, 0, 1, - "Freeze tmem pools", - "[<Domain>|-a]", - " -a Freeze all tmem", - }, - { "tmem-thaw", - &main_tmem_thaw, 0, 1, - "Thaw tmem pools", - "[<Domain>|-a]", - " -a Thaw all tmem", - }, - { "tmem-set", - &main_tmem_set, 0, 1, - "Change tmem settings", - "[<Domain>|-a] [-w[=WEIGHT]|-c[=CAP]|-p[=COMPRESS]]", - " -a Operate on all tmem\n" - " -w WEIGHT Weight (int)\n" - " -p COMPRESS Compress (int)", - }, - { "tmem-shared-auth", - &main_tmem_shared_auth, 0, 1, - "De/authenticate shared tmem pool", - "[<Domain>|-a] [-u[=UUID] [-A[=AUTH]", - " -a Authenticate for all tmem pools\n" - " -u UUID Specify uuid\n" - " (abcdef01-2345-6789-1234-567890abcdef)\n" - " -A AUTH 0=deauth,1=auth", - }, - { "tmem-freeable", - &main_tmem_freeable, 0, 0, - "Get information about how much freeable memory (MB) is in-use by tmem", - "", - }, { "cpupool-create", &main_cpupoolcreate, 1, 1, "Create a new CPU pool", diff --git a/tools/xl/xl_tmem.c b/tools/xl/xl_tmem.c deleted file mode 100644 index 36214321e6..0000000000 --- a/tools/xl/xl_tmem.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2009-2017 Citrix Ltd and other contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - */ - -#include <stdlib.h> -#include <unistd.h> - -#include <libxl.h> - -#include "xl.h" -#include "xl_utils.h" - -int main_tmem_list(int argc, char **argv) -{ - uint32_t domid; - const char *dom = NULL; - char *buf = NULL; - int use_long = 0; - int all = 0; - int opt; - - SWITCH_FOREACH_OPT(opt, "al", NULL, "tmem-list", 0) { - case 'l': - use_long = 1; - break; - case 'a': - all = 1; - break; - } - - dom = argv[optind]; - if (!dom && all == 0) { - fprintf(stderr, "You must specify -a or a domain id.\n\n"); - help("tmem-list"); - return 1; - } - - if (all) - domid = INVALID_DOMID; - else - domid = find_domain(dom); - - buf = libxl_tmem_list(ctx, domid, use_long); - if (buf == NULL) - return EXIT_FAILURE; - - printf("%s\n", buf); - free(buf); - return EXIT_SUCCESS; -} - -int main_tmem_freeze(int argc, char **argv) -{ - uint32_t domid; - const char *dom = NULL; - int all = 0; - int opt; - - SWITCH_FOREACH_OPT(opt, "a", NULL, "tmem-freeze", 0) { - case 'a': - all = 1; - break; - } - - dom = argv[optind]; - if (!dom && all == 0) { - fprintf(stderr, "You must specify -a or a domain id.\n\n"); - help("tmem-freeze"); - return EXIT_FAILURE; - } - - if (all) - domid = INVALID_DOMID; - else - domid = find_domain(dom); - - if (libxl_tmem_freeze(ctx, domid) < 0) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -int main_tmem_thaw(int argc, char **argv) -{ - uint32_t domid; - const char *dom = NULL; - int all = 0; - int opt; - - SWITCH_FOREACH_OPT(opt, "a", NULL, "tmem-thaw", 0) { - case 'a': - all = 1; - break; - } - - dom = argv[optind]; - if (!dom && all == 0) { - fprintf(stderr, "You must specify -a or a domain id.\n\n"); - help("tmem-thaw"); - return EXIT_FAILURE; - } - - if (all) - domid = INVALID_DOMID; - else - domid = find_domain(dom); - - if (libxl_tmem_thaw(ctx, domid) < 0) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -int main_tmem_set(int argc, char **argv) -{ - uint32_t domid; - const char *dom = NULL; - uint32_t weight = 0, cap = 0, compress = 0; - int opt_w = 0, opt_c = 0, opt_p = 0; - int all = 0; - int opt; - int rc = 0; - - SWITCH_FOREACH_OPT(opt, "aw:c:p:", NULL, "tmem-set", 0) { - case 'a': - all = 1; - break; - case 'w': - weight = strtol(optarg, NULL, 10); - opt_w = 1; - break; - case 'c': - cap = strtol(optarg, NULL, 10); - opt_c = 1; - break; - case 'p': - compress = strtol(optarg, NULL, 10); - opt_p = 1; - break; - } - - dom = argv[optind]; - if (!dom && all == 0) { - fprintf(stderr, "You must specify -a or a domain id.\n\n"); - help("tmem-set"); - return EXIT_FAILURE; - } - - if (all) - domid = INVALID_DOMID; - else - domid = find_domain(dom); - - if (!opt_w && !opt_c && !opt_p) { - fprintf(stderr, "No set value specified.\n\n"); - help("tmem-set"); - return EXIT_FAILURE; - } - - if (opt_w) - rc = libxl_tmem_set(ctx, domid, "weight", weight); - if (opt_c) - rc = libxl_tmem_set(ctx, domid, "cap", cap); - if (opt_p) - rc = libxl_tmem_set(ctx, domid, "compress", compress); - - if (rc < 0) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -int main_tmem_shared_auth(int argc, char **argv) -{ - uint32_t domid; - const char *autharg = NULL; - char *endptr = NULL; - const char *dom = NULL; - char *uuid = NULL; - int auth = -1; - int all = 0; - int opt; - - SWITCH_FOREACH_OPT(opt, "au:A:", NULL, "tmem-shared-auth", 0) { - case 'a': - all = 1; - break; - case 'u': - uuid = optarg; - break; - case 'A': - autharg = optarg; - break; - } - - dom = argv[optind]; - if (!dom && all == 0) { - fprintf(stderr, "You must specify -a or a domain id.\n\n"); - help("tmem-shared-auth"); - return EXIT_FAILURE; - } - - if (all) - domid = INVALID_DOMID; - else - domid = find_domain(dom); - - if (uuid == NULL || autharg == NULL) { - fprintf(stderr, "No uuid or auth specified.\n\n"); - help("tmem-shared-auth"); - return EXIT_FAILURE; - } - - auth = strtol(autharg, &endptr, 10); - if (*endptr != '\0') { - fprintf(stderr, "Invalid auth, valid auth are <0|1>.\n\n"); - return EXIT_FAILURE; - } - - if (libxl_tmem_shared_auth(ctx, domid, uuid, auth) < 0) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -int main_tmem_freeable(int argc, char **argv) -{ - int opt; - int mb; - - SWITCH_FOREACH_OPT(opt, "", NULL, "tmem-freeable", 0) { - /* No options */ - } - - mb = libxl_tmem_freeable(ctx); - if (mb == -1) - return EXIT_FAILURE; - - printf("%d\n", mb); - return EXIT_SUCCESS; -} -- 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |