From patchwork Thu Aug 24 01:14:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9918817 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 5336D60349 for ; Thu, 24 Aug 2017 01:34:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B0528AB8 for ; Thu, 24 Aug 2017 01:34:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B7CB28AD7; Thu, 24 Aug 2017 01:34:46 +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 D34DA28AB8 for ; Thu, 24 Aug 2017 01:34:45 +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 1dkh0j-000138-Pw; Thu, 24 Aug 2017 01:32:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dkh0i-00011X-Iu for xen-devel@lists.xenproject.org; Thu, 24 Aug 2017 01:32:40 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 80/87-02181-7BC2E995; Thu, 24 Aug 2017 01:32:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRWlGSWpSXmKPExsXS1tbhqLtdZ16 kwSMli+9bJjM5MHoc/nCFJYAxijUzLym/IoE1Y/Olz4wFtyUq3p69zd7AOEeoi5GLQ0hgOqPE hvMTWbsYOTkkBHgljiybAWX7S7Te28ACUdTAKHFw1yRGkASbgLrE4689TCC2iICSxL1Vk5lAi pgFtjFJvL/8gh0kISzgLTHr1HqwSSwCqhJTJ58Gi/MKeEr0zelih9ggJ3Hy2GSgGg4OTqD42n W+IGEhAQ+Ju+/usk5g5F3AyLCKUb04tagstUjXRC+pKDM9oyQ3MTNH19DAWC83tbg4MT01JzG pWC85P3cTIzAYGIBgB2PjF6dDjJIcTEqivE+k50UK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuDd oA2UEyxKTU+tSMvMAYYlTFqCg0dJhLcAJM1bXJCYW5yZDpE6xajLsWH1+i9MQix5+XmpUuK8L 0CKBECKMkrz4EbAYuQSo6yUMC8j0FFCPAWpRbmZJajyrxjFORiVhHkXgEzhycwrgdv0CugIJq AjJp2YA3JESSJCSqqB0fbl1qxLH5Xfb33t7nd5lUNhBbuwRG/inRbmGBOPYydrp9deNudfVe/ 6Nkfu6u3MZJ6DPxns3efXvPmm9kste8ucJTqa8ybN77vD8KVq3VfGTU7HuewPPNjVs37x1/ec mqe//XJtiNw+bd8UCbWgfe8+fiq++HuZR8IMMaN2Pw0h4a/TPC/lmSuxFGckGmoxFxUnAgD1A OupjAIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1503538328!80460649!12 X-Originating-IP: [134.134.136.65] 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 8919 invoked from network); 24 Aug 2017 01:32:38 -0000 Received: from mga03.intel.com (HELO mga03.intel.com) (134.134.136.65) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 24 Aug 2017 01:32:38 -0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2017 18:32:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,419,1498546800"; d="scan'208";a="303775187" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by fmsmga004.fm.intel.com with ESMTP; 23 Aug 2017 18:32:33 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 24 Aug 2017 09:14:45 +0800 Message-Id: <1503537289-56036-12-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503537289-56036-1-git-send-email-yi.y.sun@linux.intel.com> References: <1503537289-56036-1-git-send-email-yi.y.sun@linux.intel.com> 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, roger.pau@citrix.com Subject: [Xen-devel] [PATCH v2 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: , MIME-Version: 1.0 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 --- 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, 38 insertions(+), 2 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 2c71a9f..5ac8a7e 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 7309d4f..ea37967 100644 --- a/tools/xl/xl_psr.c +++ b/tools/xl/xl_psr.c @@ -479,6 +479,33 @@ 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("%-16s: %u\n", "Socket ID", info[i].id); + printf("%-16s: %s\n", "Linear Mode", + info[i].u.mba.linear ? "Enabled" : "Disabled"); + printf("%-16s: %u\n", "Maximum COS", info[i].u.mba.cos_max); + printf("%-16s: %u\n", "Maximum Throttling Value", + info[i].u.mba.thrtl_max); + printf("%-16s: %u\n", "Default Throttling Value", 0); + } + + libxl_psr_hw_info_list_free(info, nr); + return rc; +} + int main_psr_cat_cbm_set(int argc, char **argv) { uint32_t domid; @@ -597,20 +624,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; + bool all = true, cmt = false, cat = false, mba = false; static 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)) @@ -623,6 +654,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; }