From patchwork Fri Oct 13 08:41:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 10003817 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 C2EC86037E for ; Fri, 13 Oct 2017 09:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8604287B9 for ; Fri, 13 Oct 2017 09:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD51428FA1; Fri, 13 Oct 2017 09:04:27 +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 510F3287B9 for ; Fri, 13 Oct 2017 09:04:27 +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 1e2vrI-00022B-CR; Fri, 13 Oct 2017 09:02:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2vrG-00020E-Vp for xen-devel@lists.xenproject.org; Fri, 13 Oct 2017 09:02:19 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id E9/E4-31244-A1180E95; Fri, 13 Oct 2017 09:02:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRWlGSWpSXmKPExsVywNwkVley8UG kwbUWNYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNaOpbSNjwUyZijXTZzE3ME4Q7WLk5BASmMYo 8ekaB4gtIcArcWTZDFYIO0Dif+dN5i5GLqCaBkaJSXcnMYIk2ATUJR5/7WECsUUElCTurZoMZ jMLXGeU6JkbC2ILC3hLrP70lhnEZhFQldj5fi+YzSvgKfF+ay8LxAI5iZPHJoMt4wSKdzVtZI Y4yENi85fJbBD1ghInZz4BqucAmq8usX6eEMQqeYnmrbOZJzAKzEJSNQuhahaSqgWMzKsYNYp Ti8pSi3SNjfWSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQJDkwEIdjDuXB94iFGS g0lJlFct8kGkEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQlenwagnGBRanpqRVpmDjBKYNISHDxKI ryaIGne4oLE3OLMdIjUKUZjjmObLv9h4ui4efcPkxBLXn5eqpQ4rwVIqQBIaUZpHtwgWPReYp SVEuZlBDpNiKcgtSg3swRV/hWjOAejkjDvn3qgKTyZeSVw+14BncIEdMq7CLBTShIRUlINjJr HfgaF6yzcLbb1TLzjiTeJu1o0jJS623dqLfVmMG1RSr99oUbbnCvPYGnBvHSNIucC455Xj0UO VDncfPxgS+qk3B/bVjZ87F8TeGNKYPD53kXhhYozQttUA2vezLi1y5ehe/rpbzGs8wu3bWnYL yCsxWfrPb1t2teHVkuKD2xMvDhv8R2GR0osxRmJhlrMRcWJAAwzN9XZAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1507885322!111673941!9 X-Originating-IP: [192.55.52.93] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjkzID0+IDMyNDY2NQ==\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10925 invoked from network); 13 Oct 2017 09:02:17 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-6.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Oct 2017 09:02:17 -0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 02:02:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,370,1503385200"; d="scan'208"; a="1024784960" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.75]) by orsmga003.jf.intel.com with ESMTP; 13 Oct 2017 02:02:15 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Fri, 13 Oct 2017 16:41:04 +0800 Message-Id: <1507884068-18757-13-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507884068-18757-1-git-send-email-yi.y.sun@linux.intel.com> References: <1507884068-18757-1-git-send-email-yi.y.sun@linux.intel.com> MIME-Version: 1.0 Cc: Wei Liu , Chao Peng , Yi Sun , Ian Jackson , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH v7 12/16] tools: implement the new xl get hw info interface 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 This patch implements a new xl get HW info interface. A new argument is added for psr-hwinfo command to get and show MBA HW info. Signed-off-by: Yi Sun Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- CC: Wei Liu CC: Ian Jackson CC: Roger Pau Monné CC: Chao Peng v3: - change the format string of printf in 'psr_mba_hwinfo'. (suggested by Roger Pau Monné) - add 'const' for 'opts[]' in 'main_psr_hwinfo'. (suggested by Roger Pau Monné) v2: - split out this patch from a big patch in v1. (suggested by Wei Liu) - change 'MBA_INFO' to 'MBA'. Also, change 'mba_info' to 'mba'. (suggested by Chao Peng) --- tools/xl/xl_cmdtable.c | 1 + tools/xl/xl_psr.c | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index c304a85..dbbfc02 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -549,6 +549,7 @@ struct cmd_spec cmd_table[] = { "[options]", "-m, --cmt Show Cache Monitoring Technology (CMT) hardware info\n" "-a, --cat Show Cache Allocation Technology (CAT) hardware info\n" + "-b, --mba Show Memory Bandwidth Allocation (MBA) hardware info\n" }, { "psr-cmt-attach", &main_psr_cmt_attach, 0, 1, diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c index ef00048..ab47d96 100644 --- a/tools/xl/xl_psr.c +++ b/tools/xl/xl_psr.c @@ -475,6 +475,31 @@ static int psr_l2_cat_hwinfo(void) return rc; } +static int psr_mba_hwinfo(void) +{ + int rc; + unsigned int i, nr; + libxl_psr_hw_info *info; + + rc = libxl_psr_get_hw_info(ctx, LIBXL_PSR_FEAT_TYPE_MBA, 0, &nr, &info); + if (rc) + return rc; + + printf("Memory Bandwidth Allocation (MBA):\n"); + + for (i = 0; i < nr; i++) { + printf("Socket ID : %u\n", info[i].id); + printf("Linear Mode : %s\n", + info[i].u.mba.linear ? "Enabled" : "Disabled"); + printf("Maximum COS : %u\n", info[i].u.mba.cos_max); + printf("Maximum Throttling Value: %u\n", info[i].u.mba.thrtl_max); + printf("Default Throttling Value: %u\n", 0); + } + + libxl_psr_hw_info_list_free(info, nr); + return rc; +} + int main_psr_cat_cbm_set(int argc, char **argv) { uint32_t domid; @@ -593,20 +618,24 @@ int main_psr_cat_show(int argc, char **argv) int main_psr_hwinfo(int argc, char **argv) { int opt, ret = 0; - bool all = true, cmt = false, cat = false; - static struct option opts[] = { + bool all = true, cmt = false, cat = false, mba = false; + static const struct option opts[] = { {"cmt", 0, 0, 'm'}, {"cat", 0, 0, 'a'}, + {"mba", 0, 0, 'b'}, COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "ma", opts, "psr-hwinfo", 0) { + SWITCH_FOREACH_OPT(opt, "mab", opts, "psr-hwinfo", 0) { case 'm': all = false; cmt = true; break; case 'a': all = false; cat = true; break; + case 'b': + all = false; mba = true; + break; } if (!ret && (all || cmt)) @@ -619,6 +648,10 @@ int main_psr_hwinfo(int argc, char **argv) if (all || cat) ret = psr_l2_cat_hwinfo(); + /* MBA is independent of CMT and CAT */ + if (all || mba) + ret = psr_mba_hwinfo(); + return ret; }