From patchwork Wed Sep 28 09:42:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9353675 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 2F3736077A for ; Wed, 28 Sep 2016 09:45:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F78729478 for ; Wed, 28 Sep 2016 09:45:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1464C2947F; Wed, 28 Sep 2016 09:45:11 +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, UNPARSEABLE_RELAY 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 41D8A29478 for ; Wed, 28 Sep 2016 09:45:08 +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 1bpBO8-0000EO-PV; Wed, 28 Sep 2016 09:42:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpBO6-0000BY-Rd for xen-devel@lists.xenproject.org; Wed, 28 Sep 2016 09:42:51 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 07/C0-09160-A909BE75; Wed, 28 Sep 2016 09:42:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXSO6nOVXfmhNf hBgdfS1p83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmLVj1kKmjKrfj4bjVLA+Nt3y5GLg4hgclM Ert/nmSDcP4yShxedpcJwtnIKPF19zRGCGcCo8T0I1NYuxg5ONgETCTerHLsYuTkEBEwldg+8 SQLSA2zwDRGiU+njjCBJIQFIiXeXHnLCmKzCKhK3JxwkBHE5hVwl5h57RwjyBwJAXmJZ7frQU xOoPD9w74gFUICbhLfGx6zgNgSAsYS7W8vsk1g5FvAyLCKUb04tagstUjXUi+pKDM9oyQ3MTN H19DAWC83tbg4MT01JzGpWC85P3cTIzBM6hkYGHcwvv7pdIhRkoNJSZR3c/jrcCG+pPyUyozE 4oz4otKc1OJDjDIcHEoSvAv7gXKCRanpqRVpmTnAgIVJS3DwKInwRoKkeYsLEnOLM9MhUqcYF aXEeStBEgIgiYzSPLg2WJRcYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMuxhkCk9mXgnc9F dAi5mAFi898QJkcUkiQkqqgdFNSeJHtRvDp/0Xc1k/BDbPNXGVrpkUJ+1xq73n9O17RRd+Pek X/pJ0UjwlhHuSwQytdVGTMhj1dwje+H/HybDIrdLg7Z2y95bSiR0Rb87wbzn2+MhFxhguvtUx tdPXsUqw2fTaZ/7afnbF49MFVziel5/6u/9ds4Mh53Wew5kB23VFgx4031BiKc5INNRiLipOB ABg9n+1jQIAAA== X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1475055767!63121647!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7281 invoked from network); 28 Sep 2016 09:42:48 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-2.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 28 Sep 2016 09:42:48 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8S9giLv028769 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Sep 2016 09:42:44 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8S9ghJJ002775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Sep 2016 09:42:44 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8S9gh9Y018605; Wed, 28 Sep 2016 09:42:43 GMT Received: from localhost.localdomain.com (/209.6.196.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Sep 2016 02:42:43 -0700 From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, konrad@kernel.org Date: Wed, 28 Sep 2016 05:42:25 -0400 Message-Id: <1475055746-22401-12-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1475055746-22401-1-git-send-email-konrad.wilk@oracle.com> References: <1475055746-22401-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: Wei Liu , Ian Jackson , Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v1 11/12] tmem/xc_tmem_control: Rename 'arg1' to 'len' and 'arg2' to arg. 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP That is what they are used for. Lets make it more clear. Of all the various sub-commands, the only one that needed semantic change is XEN_SYSCTL_TMEM_OP_SAVE_BEGIN. That in the past used 'arg1', and now we are moving it to use 'arg'. Since that code is only used during migration which is tied to the toolstack it is OK to change it. While at it, also fix xc_tmem_control_oid to properly handle the 'buf' and bounce it as appropiate. Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu v1: First submission. --- tools/libxc/include/xenctrl.h | 4 ++-- tools/libxc/xc_tmem.c | 37 ++++++++++++++++++------------------- tools/libxl/libxl.c | 4 ++-- tools/python/xen/lowlevel/xc/xc.c | 16 ++++++++-------- xen/common/tmem.c | 16 ++++++++-------- xen/common/tmem_control.c | 8 ++++---- xen/include/public/sysctl.h | 4 ++-- 7 files changed, 44 insertions(+), 45 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 5e685a6..da982a6 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2061,11 +2061,11 @@ int xc_disable_turbo(xc_interface *xch, int cpuid); */ int xc_tmem_control_oid(xc_interface *xch, int32_t pool_id, uint32_t subop, - uint32_t cli_id, uint32_t arg1, uint32_t arg2, + 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 arg1, uint32_t arg2, void *buf); + uint32_t len, uint32_t arg, void *buf); int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int arg1); int xc_tmem_save(xc_interface *xch, int dom, int live, int fd, int field_marker); int xc_tmem_save_extra(xc_interface *xch, int dom, int fd, int field_marker); diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c index a843210..07fa101 100644 --- a/tools/libxc/xc_tmem.c +++ b/tools/libxc/xc_tmem.c @@ -49,20 +49,20 @@ int xc_tmem_control(xc_interface *xch, int32_t pool_id, uint32_t cmd, uint32_t cli_id, - uint32_t arg1, - uint32_t arg2, + uint32_t len, + uint32_t arg, void *buf) { DECLARE_SYSCTL; - DECLARE_HYPERCALL_BOUNCE(buf, arg1, XC_HYPERCALL_BUFFER_BOUNCE_OUT); + 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.arg1 = arg1; - sysctl.u.tmem_op.arg2 = arg2; + 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; @@ -72,8 +72,7 @@ int xc_tmem_control(xc_interface *xch, { HYPERCALL_BOUNCE_SET_DIR(buf, XC_HYPERCALL_BUFFER_BOUNCE_IN); } - - if ( arg1 ) + if ( len ) { if ( buf == NULL ) { @@ -91,7 +90,7 @@ int xc_tmem_control(xc_interface *xch, rc = do_sysctl(xch, &sysctl); - if ( arg1 ) + if ( len ) xc_hypercall_bounce_post(xch, buf); return rc; @@ -101,25 +100,25 @@ int xc_tmem_control_oid(xc_interface *xch, int32_t pool_id, uint32_t cmd, uint32_t cli_id, - uint32_t arg1, - uint32_t arg2, + uint32_t len, + uint32_t arg, struct xen_tmem_oid oid, void *buf) { DECLARE_SYSCTL; - DECLARE_HYPERCALL_BOUNCE(buf, arg1, XC_HYPERCALL_BUFFER_BOUNCE_OUT); + 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.arg1 = arg1; - sysctl.u.tmem_op.arg2 = arg2; + 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 ( cmd == XEN_SYSCTL_TMEM_OP_LIST && arg1 != 0 ) + if ( len ) { if ( buf == NULL ) { @@ -137,8 +136,8 @@ int xc_tmem_control_oid(xc_interface *xch, rc = do_sysctl(xch, &sysctl); - if ( cmd == XEN_SYSCTL_TMEM_OP_LIST && arg1 != 0 ) - xc_hypercall_bounce_post(xch, buf); + if ( len ) + xc_hypercall_bounce_post(xch, buf); return rc; } @@ -224,7 +223,7 @@ int xc_tmem_save(xc_interface *xch, xen_sysctl_tmem_client_t info; rc = xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_BEGIN, - dom, live, 0, NULL); + dom, 0 /* len*/ , live, NULL); if ( rc ) { /* Nothing to save - no tmem enabled. */ @@ -239,7 +238,7 @@ int xc_tmem_save(xc_interface *xch, if ( xc_tmem_control(xch, 0 /* pool_id */, XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO, - dom /* cli_id */, sizeof(info) /* arg1 */, 0 /* arg2 */, + dom /* cli_id */, sizeof(info), 0 /* arg */, &info) < 0 ) return -1; @@ -396,7 +395,7 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd) if ( xc_tmem_control(xch, 0 /* pool_id */, XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO, - dom /* cli_id */, sizeof(info) /* arg1 */, 0 /* arg2 */, + dom /* cli_id */, sizeof(info), 0 /* arg */, &info) < 0 ) return -1; diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 2f50e61..25baca6 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -6082,7 +6082,7 @@ int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) r = xc_tmem_control(ctx->xch, -1 /* pool_id */, XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO, - domid, sizeof(info), 0 /* arg2 */, &info); + domid, sizeof(info), 0 /* arg */, &info); if (r < 0) { LOGE(ERROR, "Can not get tmem data!"); rc = ERROR_FAIL; @@ -6096,7 +6096,7 @@ int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) } r = xc_tmem_control(ctx->xch, -1 /* pool_id */, XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO, - domid, sizeof(info), 0 /* arg2 */, &info); + domid, sizeof(info), 0 /* arg */, &info); if (r < 0) { LOGE(ERROR, "Can not set tmem %s", name); rc = ERROR_FAIL; diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index a117737..39be1d5 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1612,8 +1612,8 @@ static PyObject *pyxc_tmem_control(XcObject *self, int32_t pool_id; uint32_t subop; uint32_t cli_id; - uint32_t arg1; - uint32_t arg2; + uint32_t len; + uint32_t arg; char *buf; char _buffer[32768], *buffer = _buffer; int rc; @@ -1621,13 +1621,13 @@ static PyObject *pyxc_tmem_control(XcObject *self, 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, &arg1, &arg2, &buf) ) + &pool_id, &subop, &cli_id, &len, &arg, &buf) ) return NULL; - if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (arg1 > 32768) ) - arg1 = 32768; + if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (len > 32768) ) + len = 32768; - if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, arg1, arg2, buffer)) < 0 ) + if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, len, arg, buffer)) < 0 ) return Py_BuildValue("i", rc); switch (subop) { @@ -2506,8 +2506,8 @@ static PyMethodDef pyxc_methods[] = { " pool_id [int]: Identifier of the tmem pool (-1 == all).\n" " subop [int]: Supplementary Operation.\n" " cli_id [int]: Client identifier (-1 == all).\n" - " arg1 [int]: Argument.\n" - " arg2 [int]: Argument.\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" }, diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 997f2b0..294f0cd 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -1651,7 +1651,7 @@ static int tmemc_shared_pool_auth(domid_t cli_id, uint64_t uuid_lo, } static int tmemc_save_subop(int cli_id, uint32_t pool_id, - uint32_t subop, tmem_cli_va_param_t buf, uint32_t arg1) + uint32_t subop, tmem_cli_va_param_t buf, uint32_t arg) { struct client *client = tmem_client_from_cli_id(cli_id); uint32_t p; @@ -1672,7 +1672,7 @@ static int tmemc_save_subop(int cli_id, uint32_t pool_id, client->was_frozen = client->info.flags.u.frozen; client->info.flags.u.frozen = 1; - if ( arg1 != 0 ) + if ( arg != 0 ) client->info.flags.u.migrating = 1; rc = 0; break; @@ -1844,22 +1844,22 @@ int do_tmem_control(struct xen_sysctl_tmem_op *op) case XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN: case XEN_SYSCTL_TMEM_OP_SAVE_END: ret = tmemc_save_subop(op->cli_id, pool_id, cmd, - guest_handle_cast(op->u.buf, char), op->arg1); + guest_handle_cast(op->u.buf, char), op->arg); break; case XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE: ret = tmemc_save_get_next_page(op->cli_id, pool_id, - guest_handle_cast(op->u.buf, char), op->arg1); + guest_handle_cast(op->u.buf, char), op->len); break; case XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV: ret = tmemc_save_get_next_inv(op->cli_id, - guest_handle_cast(op->u.buf, char), op->arg1); + guest_handle_cast(op->u.buf, char), op->len); break; case XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE: - ret = tmemc_restore_put_page(op->cli_id, pool_id, oidp, op->arg2, - guest_handle_cast(op->u.buf, char), op->arg1); + ret = tmemc_restore_put_page(op->cli_id, pool_id, oidp, op->arg, + guest_handle_cast(op->u.buf, char), op->len); break; case XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE: - ret = tmemc_restore_flush_page(op->cli_id, pool_id, oidp, op->arg2); + ret = tmemc_restore_flush_page(op->cli_id, pool_id, oidp, op->arg); break; default: ret = -1; diff --git a/xen/common/tmem_control.c b/xen/common/tmem_control.c index 6f1de9d..cfbc8b0 100644 --- a/xen/common/tmem_control.c +++ b/xen/common/tmem_control.c @@ -343,7 +343,7 @@ static int tmemc_get_client_info(int cli_id, } static int tmemc_save_subop(int cli_id, uint32_t pool_id, uint32_t subop, - XEN_GUEST_HANDLE_PARAM(void) buf, uint32_t arg1) + XEN_GUEST_HANDLE_PARAM(void) buf, uint32_t arg) { struct client *client = tmem_client_from_cli_id(cli_id); struct tmem_pool *pool = (client == NULL || pool_id >= MAX_POOLS_PER_DOMAIN) @@ -397,11 +397,11 @@ int tmem_control(struct xen_sysctl_tmem_op *op) ret = tmemc_freeze_pools(op->cli_id, cmd); break; case XEN_SYSCTL_TMEM_OP_FLUSH: - ret = tmemc_flush_mem(op->cli_id,op->arg1); + ret = tmemc_flush_mem(op->cli_id, op->arg); break; case XEN_SYSCTL_TMEM_OP_LIST: ret = tmemc_list(op->cli_id, - guest_handle_cast(op->u.buf, char), op->arg1, op->arg2); + guest_handle_cast(op->u.buf, char), op->len, op->arg); break; case XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO: ret = tmemc_set_client_info(op->cli_id, @@ -418,7 +418,7 @@ int tmem_control(struct xen_sysctl_tmem_op *op) case XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_NPAGES: case XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_UUID: ret = tmemc_save_subop(op->cli_id, pool_id, cmd, - guest_handle_cast(op->u.buf, void), op->arg1); + guest_handle_cast(op->u.buf, void), op->arg); break; default: ret = do_tmem_control(op); diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 36e2fd8..a9f95f8 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -809,8 +809,8 @@ struct xen_sysctl_tmem_op { uint32_t cli_id; /* IN: client id, 0 for XEN_SYSCTL_TMEM_QUERY_FREEABLE_MB for all others can be the domain id or XEN_SYSCTL_TMEM_OP_ALL_CLIENTS for all. */ - uint32_t arg1; /* IN: If not applicable to command use 0. */ - uint32_t arg2; /* IN: If not applicable to command use 0. */ + uint32_t len; /* IN: length of 'buf'. If not applicable to use 0. */ + uint32_t arg; /* IN: If not applicable to command use 0. */ uint32_t pad; /* Padding so structure is the same under 32 and 64. */ xen_tmem_oid_t oid; /* IN: If not applicable to command use 0s. */ union {