From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935037AbdBQT7n (ORCPT ); Fri, 17 Feb 2017 14:59:43 -0500 Received: from mga01.intel.com ([192.55.52.88]:17831 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934944AbdBQT6c (ORCPT ); Fri, 17 Feb 2017 14:58:32 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,173,1484035200"; d="scan'208";a="67174479" From: Vikas Shivappa To: vikas.shivappa@intel.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, andi.kleen@intel.com, vikas.shivappa@linux.intel.com Subject: [PATCH 6/8] x86/intel_rdt/mba: Add info directory files for MBA Date: Fri, 17 Feb 2017 11:58:53 -0800 Message-Id: <1487361535-9727-7-git-send-email-vikas.shivappa@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487361535-9727-1-git-send-email-vikas.shivappa@linux.intel.com> References: <1487361535-9727-1-git-send-email-vikas.shivappa@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add files in info directory for MBA. The files in the info directory are as follows : - num_closids: max number of closids for MBA which represents the max class of service user can configure. - min_bw: the minimum memory bandwidth(b/w) values in percentage. OS maps the b/w percentage values to memory b/w throttle delay values and configures them via MSR interface by writing to the QOS_MSRs. These delay values can have a linear or nonlinear scale. - bw_gran: The memory b/w granularity that can be configured. For ex: If the granularity is 10% and min_bw is 10, valid bandwidth values are 10,20,30... Signed-off-by: Vikas Shivappa --- arch/x86/include/asm/intel_rdt.h | 2 + arch/x86/kernel/cpu/intel_rdt.c | 1 + arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 64 ++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h index 36abed2..24de64c 100644 --- a/arch/x86/include/asm/intel_rdt.h +++ b/arch/x86/include/asm/intel_rdt.h @@ -149,6 +149,8 @@ struct msr_param { }; void rdt_get_cache_infofile(struct rdt_resource *r); +void rdt_get_mba_infofile(struct rdt_resource *r); + extern struct mutex rdtgroup_mutex; extern struct rdt_resource rdt_resources_all[]; diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 481ff32..353c476b4 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -176,6 +176,7 @@ static bool rdt_get_mem_config(struct rdt_resource *r) if (rdt_get_mb_table(r)) return false; } + rdt_get_mba_infofile(r); r->capable = true; r->enabled = true; diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 0a70e87..b445ee8 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -518,6 +518,36 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of, return 0; } +static int rdt_min_bw_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + seq_printf(seq, "%d\n", r->min_bw); + + return 0; +} + +static int rdt_bw_gran_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + seq_printf(seq, "%d\n", r->bw_gran); + + return 0; +} + +static int rdt_delay_linear_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + seq_printf(seq, "%d\n", r->delay_linear); + + return 0; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_cache_info_files[] = { { @@ -540,6 +570,40 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of, }, }; +/* rdtgroup information files for MBE. */ +static struct rftype res_mbe_info_files[] = { + { + .name = "num_closids", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_num_closids_show, + }, + { + .name = "min_bandwidth", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_min_bw_show, + }, + { + .name = "bandwidth_gran", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_bw_gran_show, + }, + { + .name = "delay_linear", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_delay_linear_show, + }, +}; + +void rdt_get_mba_infofile(struct rdt_resource *r) +{ + r->info_files = &res_mbe_info_files[0]; + r->infofiles_len = ARRAY_SIZE(res_mbe_info_files); +} + void rdt_get_cache_infofile(struct rdt_resource *r) { r->info_files = &res_cache_info_files[0]; -- 1.9.1