From patchwork Tue Sep 5 09:32:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9938345 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 D030B601EB for ; Tue, 5 Sep 2017 09:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C089628902 for ; Tue, 5 Sep 2017 09:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4ADB28911; Tue, 5 Sep 2017 09:53:56 +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 52A9D28902 for ; Tue, 5 Sep 2017 09:53:56 +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 1dpAWK-0007PB-6F; Tue, 05 Sep 2017 09:51:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpAWJ-0007OA-Gv for xen-devel@lists.xenproject.org; Tue, 05 Sep 2017 09:51:47 +0000 Received: from [193.109.254.147] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id E7/56-09760-2B37EA95; Tue, 05 Sep 2017 09:51:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRWlGSWpSXmKPExsXS1taRorupeF2 kweZWVovvWyYzOTB6HP5whSWAMYo1My8pvyKBNeNafydrwTapiv1fLjE3MK4U7mLk5BASqJR4 cn8jG4gtIcArcWTZDFYI21+i/9hkxi5GLqCaBkaJ9Uu2MIEk2ATUJR5/7QGzRQSUJO6tmswEU sQscI5JYs/HHWAJYQFviZNLJ7KA2CwCqhIz9xwDs3kFPCQeNW9lgdggJ3Hy2GSgbRwcnEDxpd fqIA5yl/iz7S4rRLmgxMmZT1hASpiB9q6fJwQSZhaQl2jeOpt5AqPALCRVsxCqZiGpWsDIvIp Rozi1qCy1SNfQUC+pKDM9oyQ3MTNH19DATC83tbg4MT01JzGpWC85P3cTIzA0GYBgB+OnZQGH GCU5mJREeUMT10UK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuC9VQSUEyxKTU+tSMvMAUYJTFqCg 0dJhPccSJq3uCAxtzgzHSJ1ilGXY8Pq9V+YhFjy8vNSpcR5j4MUCYAUZZTmwY2ARewlRlkpYV 5GoKOEeApSi3IzS1DlXzGKczAqCfMuAZnCk5lXArfpFdARTEBHVL1cA3JESSJCSqqBUabe51a I8Y2wfxUiR+6Ux/JEXa29ecZQfS535NPH+/XrczQe5oY7COzrqTqW+GSr09GS+MdzHmgF56za zNLk6yA3odl4wh4vuaRCZctzk8/eEk6WfzZx8+rlP8w5+a8uuyn706rmy9fSXrm1085U/TOYd Ttb97yAWatG5eMeYUV++Uz1uTtMlViKMxINtZiLihMBPQTYt9MCAAA= X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1504605073!62289035!8 X-Originating-IP: [134.134.136.100] 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 49138 invoked from network); 5 Sep 2017 09:51:45 -0000 Received: from mga07.intel.com (HELO mga07.intel.com) (134.134.136.100) by server-15.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Sep 2017 09:51:45 -0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 05 Sep 2017 02:51:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,479,1498546800"; d="scan'208";a="897185426" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by FMSMGA003.fm.intel.com with ESMTP; 05 Sep 2017 02:51:40 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Tue, 5 Sep 2017 17:32:33 +0800 Message-Id: <1504603957-5389-12-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504603957-5389-1-git-send-email-yi.y.sun@linux.intel.com> References: <1504603957-5389-1-git-send-email-yi.y.sun@linux.intel.com> MIME-Version: 1.0 Cc: kevin.tian@intel.com, wei.liu2@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, Yi Sun , julien.grall@arm.com, mengxu@cis.upenn.edu, jbeulich@suse.com, chao.p.peng@linux.intel.com, dgdegra@tycho.nsa.gov, roger.pau@citrix.com Subject: [Xen-devel] [PATCH v3 11/15] 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 --- 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 | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 6baaed2..a01245d 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -524,6 +524,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..40269b4 100644 --- a/tools/xl/xl_psr.c +++ b/tools/xl/xl_psr.c @@ -475,6 +475,32 @@ 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, &info, &nr, + LIBXL_PSR_FEAT_TYPE_MBA, 0); + 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 +619,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 +649,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; }