Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbdDCV54 (ORCPT ); Mon, 3 Apr 2017 17:57:56 -0400 Received: from mga09.intel.com ([134.134.136.24]:2032 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbdDCV5K (ORCPT ); Mon, 3 Apr 2017 17:57:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,272,1486454400"; d="scan'208";a="84231364" From: Vikas Shivappa To: vikas.shivappa@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org Cc: 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, h.peter.anvin@intel.com Subject: [PATCH 5/8] x86/intel_rdt: Prep to add info files for MBA Date: Mon, 3 Apr 2017 14:57:29 -0700 Message-Id: <1491256652-18729-6-git-send-email-vikas.shivappa@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491256652-18729-1-git-send-email-vikas.shivappa@linux.intel.com> References: <1491256652-18729-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 Content-Length: 3718 Lines: 107 Each RDT resource has a separate directory with in the "/sys/fs/resctrl/info" which has files to display information about the resource. Currently this list of files is a static list of files specific to cache resource. As a preparatory patch to add MBA info files, extend this implementation support dynamic list of files. Signed-off-by: Vikas Shivappa --- arch/x86/include/asm/intel_rdt.h | 6 ++++++ arch/x86/kernel/cpu/intel_rdt.c | 1 + arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 18 ++++++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h index 285cdeb..e58e1d4 100644 --- a/arch/x86/include/asm/intel_rdt.h +++ b/arch/x86/include/asm/intel_rdt.h @@ -110,6 +110,8 @@ struct msr_param { * @min_cbm_bits: Minimum number of consecutive bits to be set * in a cache bit mask * @msr_update: Function pointer to update QOS MSRs + * @info_files: resctrl info files for the resource + * @nr_info_files: Number of info files * @max_delay: Max throttle delay. Delay is the hardware * understandable value for memory bandwidth. * @min_bw: Minimum memory bandwidth percentage user @@ -137,6 +139,8 @@ struct rdt_resource { int data_width; void (*msr_update) (struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r); + struct rftype *info_files; + int nr_info_files; u32 max_delay; u32 min_bw; u32 bw_gran; @@ -150,6 +154,8 @@ struct rdt_resource { int cbm_idx_offset; }; +void rdt_get_cache_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 be272b9..b50cb35 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -215,6 +215,7 @@ static void rdt_get_cache_config(int idx, struct rdt_resource *r) r->cbm_len = eax.split.cbm_len + 1; r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1; r->data_width = (r->cbm_len + 3) / 4; + rdt_get_cache_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 5ffe637..aee4a19 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -519,7 +519,7 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of, } /* rdtgroup information files for one cache resource. */ -static struct rftype res_info_files[] = { +static struct rftype res_cache_info_files[] = { { .name = "num_closids", .mode = 0444, @@ -540,11 +540,18 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of, }, }; +void rdt_get_cache_infofile(struct rdt_resource *r) +{ + r->info_files = res_cache_info_files; + r->nr_info_files = ARRAY_SIZE(res_cache_info_files); +} + static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) { struct kernfs_node *kn_subdir; + struct rftype *res_info_files; struct rdt_resource *r; - int ret; + int ret, len; /* create the directory */ kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL); @@ -563,8 +570,11 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) ret = rdtgroup_kn_set_ugid(kn_subdir); if (ret) goto out_destroy; - ret = rdtgroup_add_files(kn_subdir, res_info_files, - ARRAY_SIZE(res_info_files)); + + res_info_files = r->info_files; + len = r->nr_info_files; + + ret = rdtgroup_add_files(kn_subdir, res_info_files, len); if (ret) goto out_destroy; kernfs_activate(kn_subdir); -- 1.9.1