From patchwork Mon Sep 4 11:01:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9937025 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 AF5686038C for ; Mon, 4 Sep 2017 11:22:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1AFF2877D for ; Mon, 4 Sep 2017 11:22:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963AD2879D; Mon, 4 Sep 2017 11:22:34 +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 18A7F2877D for ; Mon, 4 Sep 2017 11:22:34 +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 1dopQL-0008MT-Tn; Mon, 04 Sep 2017 11:20:13 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dopQL-0008M5-1F for xen-devel@lists.xenproject.org; Mon, 04 Sep 2017 11:20:13 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 0D/EF-03422-CE63DA95; Mon, 04 Sep 2017 11:20:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRWlGSWpSXmKPExsVywNykQve12dp IgwOv5S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ow5tx+yF3wWq7h0rIu9gfGMYBcjF4eQwHRG iSO777J3MXJySAjwShxZNoMVwvaX6Gl/wwxR1MAosf/1O2aQBJuAusTjrz1MILaIgJLEvVWTw WxmgTyJRW2fWEBsYYFgiT8nv7GB2CwCqhJduw8ygti8Ah4S518sZYJYICdx8thksGWcAp4Sbz e3g80XAqpZsucVVL2gxMmZT4BmcgDNV5dYP08IYpW8RPPW2cwTGAVmIamahVA1C0nVAkbmVYw axalFZalFukbmeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgcHJAAQ7GBevDTzE KMnBpCTKe//xmkghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzRpmsjhQSLUtNTK9Iyc4BxApOW4 OBREuFNAUnzFhck5hZnpkOkTjHqcmxYvf4LkxBLXn5eqpQ4byFIkQBIUUZpHtwIWMxeYpSVEu ZlBDpKiKcgtSg3swRV/hWjOAejkjCvPTABCPFk5pXAbXoFdAQT0BFVL9eAHFGSiJCSamAUk9E 9EiJstfXs6jW5L21yJd7weP99bnmyqi2vW4fxW4CNtKRWz2sD9smRFjdvHvcKe1cY25arJhJb vV/L8aDYRsbuj2pfor1j677pr6r4xtK+bP3GGR9TfxRccHQSSO8WTFBIfTXjp+KU/ZtT4y0Yd rl8UZS/7bQzrc/7br3yw5dddiUG5kosxRmJhlrMRcWJALa+t+XUAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1504524009!81073064!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57270 invoked from network); 4 Sep 2017 11:20:11 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-7.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Sep 2017 11:20:11 -0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 04:20:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,474,1498546800"; d="scan'208";a="896905595" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by FMSMGA003.fm.intel.com with ESMTP; 04 Sep 2017 04:19:51 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Mon, 4 Sep 2017 19:01:44 +0800 Message-Id: <1504522904-41135-2-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504522904-41135-1-git-send-email-yi.y.sun@linux.intel.com> References: <1504522904-41135-1-git-send-email-yi.y.sun@linux.intel.com> MIME-Version: 1.0 Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, Yi Sun , roger.pau@citrix.com Subject: [Xen-devel] [PATCH v3 2/2] tools: change the type of '*nr' in 'libxl_psr_cat_get_info' 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 Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info' is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes this and does related changes. Suggested-by: Roger Pau Monné Signed-off-by: Yi Sun --- - This patch depends on patch "tools: use '__i386__' and '__x86_64__' to replace PSR". v2: - assign 'num' to '*nr' if return value is success. (suggested by Roger Pau Monné) --- tools/libxl/libxl.h | 2 +- tools/libxl/libxl_psr.c | 7 +++++-- tools/xl/xl_psr.c | 9 ++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 6c087dd..484b5b7 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -2211,7 +2211,7 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid, * and the length in 'nr'. */ int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info, - int *nr, unsigned int lvl); + unsigned int *nr, unsigned int lvl); int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info, int *nr); void libxl_psr_cat_info_list_free(libxl_psr_cat_info *list, int nr); diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c index f55ba1e..197505a 100644 --- a/tools/libxl/libxl_psr.c +++ b/tools/libxl/libxl_psr.c @@ -362,7 +362,7 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid, } int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info, - int *nr, unsigned int lvl) + unsigned int *nr, unsigned int lvl) { GC_INIT(ctx); int rc; @@ -410,8 +410,11 @@ int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info, int *nr) { int rc; + unsigned int num; - rc = libxl_psr_cat_get_info(ctx, info, nr, 3); + rc = libxl_psr_cat_get_info(ctx, info, &num, 3); + if (!rc) + *nr = num; return rc; } diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c index 544f6f0..ef00048 100644 --- a/tools/xl/xl_psr.c +++ b/tools/xl/xl_psr.c @@ -294,8 +294,8 @@ int main_psr_cmt_show(int argc, char **argv) static int psr_l3_cat_hwinfo(void) { - int rc, nr; - unsigned int i; + int rc; + unsigned int i, nr; uint32_t l3_cache_size; libxl_psr_cat_info *info; @@ -424,7 +424,7 @@ static int psr_cat_print_socket(uint32_t domid, libxl_psr_cat_info *info, static int psr_cat_show(uint32_t domid, unsigned int lvl) { - int i, nr; + unsigned int i, nr; int rc; libxl_psr_cat_info *info; @@ -453,8 +453,7 @@ out: static int psr_l2_cat_hwinfo(void) { int rc; - unsigned int i; - int nr; + unsigned int i, nr; libxl_psr_cat_info *info; rc = libxl_psr_cat_get_info(ctx, &info, &nr, 2);