Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583692 > unrolled thread

[PATCH 5/8] x86/intel_rdt: info file support for MBA prepare

Started byVikas Shivappa <vikas.shivappa@linux.intel.com>
First post2017-02-17 21:00 +0100
Last post2017-03-10 23:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/8] x86/intel_rdt: info file support for MBA prepare Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-02-17 21:00 +0100
    Re: [PATCH 5/8] x86/intel_rdt: info file support for MBA prepare Thomas Gleixner <tglx@linutronix.de> - 2017-03-01 16:40 +0100
      Re: [PATCH 5/8] x86/intel_rdt: info file support for MBA prepare Shivappa Vikas <vikas.shivappa@linux.intel.com> - 2017-03-10 23:10 +0100

#1583692 — [PATCH 5/8] x86/intel_rdt: info file support for MBA prepare

FromVikas Shivappa <vikas.shivappa@linux.intel.com>
Date2017-02-17 21:00 +0100
Subject[PATCH 5/8] x86/intel_rdt: info file support for MBA prepare
Message-ID<tbWRc-72-27@gated-at.bofh.it>
As a preparatory patch to MBA info file setup, generalize the info file
setup to have the option to choose between different set of files.
Although multiple cache resources have same info files, Memory resources
have different set of info files. That way we have the option to choose
between memory resource and cache resource info files.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
 arch/x86/include/asm/intel_rdt.h         |  5 +++++
 arch/x86/kernel/cpu/intel_rdt.c          |  1 +
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 18 ++++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h
index af65b2a..36abed2 100644
--- a/arch/x86/include/asm/intel_rdt.h
+++ b/arch/x86/include/asm/intel_rdt.h
@@ -77,6 +77,8 @@ struct rftype {
  * @default_ctrl:		Specifies default cache cbm or mem b/w percent.
  * @min_cbm_bits:		Minimum number of consecutive bits to be set
  *				in a cache bit mask
+ * @info_files:		resctrl info files for the resource
+ * @infofiles_len:		Number of info files
  * @max_delay:			Max throttle delay. Delay is the hardware
  *				understandable value for memory b/w.
  * @min_bw:			Minimum memory bandwidth in percentage
@@ -103,6 +105,8 @@ struct rdt_resource {
 	int			cbm_len;
 	int			min_cbm_bits;
 	u32			default_ctrl;
+	struct rftype		*info_files;
+	int			infofiles_len;
 	u32			max_delay;
 	u32			min_bw;
 	u32			bw_gran;
@@ -144,6 +148,7 @@ struct msr_param {
 	int			high;
 };
 
+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 130ce98..481ff32 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -193,6 +193,7 @@ static void rdt_get_cache_config(int idx, struct rdt_resource *r)
 	r->num_closid = edx.split.cos_max + 1;
 	r->cbm_len = eax.split.cbm_len + 1;
 	r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
+	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 0d8fa61..0a70e87 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[0];
+	r->infofiles_len = 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->infofiles_len;
+
+		ret = rdtgroup_add_files(kn_subdir, res_info_files, len);
 		if (ret)
 			goto out_destroy;
 		kernfs_activate(kn_subdir);
-- 
1.9.1

[toc] | [next] | [standalone]


#1590414

FromThomas Gleixner <tglx@linutronix.de>
Date2017-03-01 16:40 +0100
Message-ID<tgew9-4ZE-17@gated-at.bofh.it>
In reply to#1583692
On Fri, 17 Feb 2017, Vikas Shivappa wrote:

> As a preparatory patch to MBA info file setup, generalize the info file
> setup to have the option to choose between different set of files.
> Although multiple cache resources have same info files, Memory resources
> have different set of info files. That way we have the option to choose
> between memory resource and cache resource info files.

Sigh.

> @@ -77,6 +77,8 @@ struct rftype {
>   * @default_ctrl:		Specifies default cache cbm or mem b/w percent.
>   * @min_cbm_bits:		Minimum number of consecutive bits to be set
>   *				in a cache bit mask
> + * @info_files:		resctrl info files for the resource
> + * @infofiles_len:		Number of info files

len == length, nr == number. No? Too intuitive, right?

And no, not infofiles_nr. It wants to be nr_infofiles. And while at it
please either use infofiles or info_files, but not a mixture of
both. Random underscores are not enhancing readability at all.

> +void rdt_get_cache_infofile(struct rdt_resource *r)
> +{
> +	r->info_files = &res_cache_info_files[0];

What's wrong with

        r->info_files = res_cache_info_files;

Nothing, but it would be too easy to read. This is not the obfuscated
c-code contest.

> +	r->infofiles_len = ARRAY_SIZE(res_cache_info_files);

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1598134

FromShivappa Vikas <vikas.shivappa@linux.intel.com>
Date2017-03-10 23:10 +0100
Message-ID<tjATw-1Jy-5@gated-at.bofh.it>
In reply to#1590414

On Wed, 1 Mar 2017, Thomas Gleixner wrote:

> On Fri, 17 Feb 2017, Vikas Shivappa wrote:
>
>> As a preparatory patch to MBA info file setup, generalize the info file
>> setup to have the option to choose between different set of files.
>> Although multiple cache resources have same info files, Memory resources
>> have different set of info files. That way we have the option to choose
>> between memory resource and cache resource info files.
>
> Sigh.
>
>> @@ -77,6 +77,8 @@ struct rftype {
>>   * @default_ctrl:		Specifies default cache cbm or mem b/w percent.
>>   * @min_cbm_bits:		Minimum number of consecutive bits to be set
>>   *				in a cache bit mask
>> + * @info_files:		resctrl info files for the resource
>> + * @infofiles_len:		Number of info files
>
> len == length, nr == number. No? Too intuitive, right?

Took it as len as the rdtgroup_add_files calls its parameter as len.. Will fix 
to nr_infofiles as that seems better.

>
> And no, not infofiles_nr. It wants to be nr_infofiles. And while at it
> please either use infofiles or info_files, but not a mixture of
> both. Random underscores are not enhancing readability at all.
>
>> +void rdt_get_cache_infofile(struct rdt_resource *r)
>> +{
>> +	r->info_files = &res_cache_info_files[0];
>
> What's wrong with
>
>        r->info_files = res_cache_info_files;
>
> Nothing, but it would be too easy to read. This is not the obfuscated
> c-code contest.

Will fix..

Thanks,
Vikas

>
>> +	r->infofiles_len = ARRAY_SIZE(res_cache_info_files);
>
> Thanks,
>
> 	tglx
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web