From patchwork Fri Sep 1 12:15:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9934043 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 3D03F6016C for ; Fri, 1 Sep 2017 12:35:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C61F2864A for ; Fri, 1 Sep 2017 12:35:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2132128658; Fri, 1 Sep 2017 12:35:15 +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 65C9D2864A for ; Fri, 1 Sep 2017 12:35:14 +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 1dnl8C-00063g-My; Fri, 01 Sep 2017 12:33:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnl8B-00063Y-UB for xen-devel@lists.xenproject.org; Fri, 01 Sep 2017 12:33:04 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 87/D7-02042-F7359A95; Fri, 01 Sep 2017 12:33:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRWlGSWpSXmKPExsVywNykQrcueGW kwZQHYhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bn0tKCO2IVO/uvMDcw7hPsYuTiEBKYzijx 6uFTxi5GTg4JAV6JI8tmsELYARJHJqxlhihqYJR4e/siC0iCTUBd4vHXHiYQW0RASeLeqslgN rNAnsSitk9gNcIC/hIbWy6wdzFycLAIqEpsmmILEuYV8JC4MPU4G8R8OYmTxyazgpRwAsU3rg oCCQsJuEv8W/2bHaJcUOLkzCcsICXMQFvXzxOCWCQv0bx1NvMERoFZSKpmIVTNQlK1gJF5FaN GcWpRWWqRrpGpXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYFjWMzAw7mDc1e53 iFGSg0lJlLfaf0WkEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQlepaCVkUKCRanpqRVpmTnACIFJS 3DwKInw+oKkeYsLEnOLM9MhUqcYdTk2rF7/hUmIJS8/L1VKnLcLpEgApCijNA9uBCxaLzHKSg nzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5o0HmcKTmVcCt+kV0BFMQEf8+7wC5IiSRISUVANja99 +OfuiFcWPnFdHFq91Z5fry590rW5z8jfOTb7Hrz9ZXZOvwbulXtFHvuzbYuV3Z1j8fz5hvdt5 7ug149t6q+rTD90/MCG+48qKg58nsvxQT4nN61Wa84qx2X93kN/CKVOqlthN8TC5Gv/8wdvGy 35Skx1vMM/wesVro3jqlU8Es4hliq6aEktxRqKhFnNRcSIAy1aHdtECAAA= X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1504269180!73647989!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 56298 invoked from network); 1 Sep 2017 12:33:02 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-12.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2017 12:33:02 -0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Sep 2017 05:32:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.41,458,1498546800"; d="scan'208"; a="1190556264" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by fmsmga001.fm.intel.com with ESMTP; 01 Sep 2017 05:32:56 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Fri, 1 Sep 2017 20:15:05 +0800 Message-Id: <1504268105-38654-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504166886-3912-1-git-send-email-yi.y.sun@linux.intel.com> References: <1504166886-3912-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 v2] 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 Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- - This patch depends on patch 'tools: remove unnecessary PSR macros'. 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 a0185b9..0c90c41 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -2210,7 +2210,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);