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


Groups > linux.kernel > #1583670 > unrolled thread

[PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir

Started byVikas Shivappa <vikas.shivappa@linux.intel.com>
First post2017-02-17 20:50 +0100
Last post2017-03-10 02:50 +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 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-02-17 20:50 +0100
    Re: [PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir Thomas Gleixner <tglx@linutronix.de> - 2017-03-01 15:20 +0100
      Re: [PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir Shivappa Vikas <vikas.shivappa@linux.intel.com> - 2017-03-10 02:50 +0100

#1583670 — [PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir

FromVikas Shivappa <vikas.shivappa@linux.intel.com>
Date2017-02-17 20:50 +0100
Subject[PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir
Message-ID<tbWHv-8v1-3@gated-at.bofh.it>
During rmdir reset the ctrl values to all 1s in the QOS_MSR for the
directory's closid. This is done so that that next time when the closid
is reused they dont reflect old values.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 8af04af..9b9565f 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -780,7 +780,7 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
 	return dentry;
 }
 
-static int reset_all_cbms(struct rdt_resource *r)
+static int reset_all_ctrls(struct rdt_resource *r, u32 sclosid, u32 eclosid)
 {
 	struct msr_param msr_param;
 	cpumask_var_t cpu_mask;
@@ -791,8 +791,8 @@ static int reset_all_cbms(struct rdt_resource *r)
 		return -ENOMEM;
 
 	msr_param.res = r;
-	msr_param.low = 0;
-	msr_param.high = r->num_closid;
+	msr_param.low = sclosid;
+	msr_param.high = eclosid;
 
 	/*
 	 * Disable resource control for this resource by setting all
@@ -802,7 +802,7 @@ static int reset_all_cbms(struct rdt_resource *r)
 	list_for_each_entry(d, &r->domains, list) {
 		cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
 
-		for (i = 0; i < r->num_closid; i++)
+		for (i = sclosid; i < eclosid; i++)
 			d->cbm[i] = r->max_cbm;
 	}
 	cpu = get_cpu();
@@ -896,7 +896,7 @@ static void rdt_kill_sb(struct super_block *sb)
 
 	/*Put everything back to default values. */
 	for_each_enabled_rdt_resource(r)
-		reset_all_cbms(r);
+		reset_all_ctrls(r, 0, r->num_closid);
 	cdp_disable();
 	rmdir_all_sub();
 	static_branch_disable(&rdt_enable_key);
@@ -991,6 +991,7 @@ static int rdtgroup_rmdir(struct kernfs_node *kn)
 {
 	int ret, cpu, closid = rdtgroup_default.closid;
 	struct rdtgroup *rdtgrp;
+	struct rdt_resource *r;
 	cpumask_var_t tmpmask;
 
 	if (!zalloc_cpumask_var(&tmpmask, GFP_KERNEL))
@@ -1019,6 +1020,13 @@ static int rdtgroup_rmdir(struct kernfs_node *kn)
 	cpumask_or(tmpmask, tmpmask, &rdtgrp->cpu_mask);
 	rdt_update_closid(tmpmask, NULL);
 
+	/*
+	 * Put domain control values back to default for the
+	 * rdtgrp thats being removed.
+	 */
+	for_each_enabled_rdt_resource(r)
+		reset_all_ctrls(r, rdtgrp->closid, rdtgrp->closid + 1);
+
 	rdtgrp->flags = RDT_DELETED;
 	closid_free(rdtgrp->closid);
 	list_del(&rdtgrp->rdtgroup_list);
-- 
1.9.1

[toc] | [next] | [standalone]


#1590349

FromThomas Gleixner <tglx@linutronix.de>
Date2017-03-01 15:20 +0100
Message-ID<tgdgK-4b6-23@gated-at.bofh.it>
In reply to#1583670
On Fri, 17 Feb 2017, Vikas Shivappa wrote:

> During rmdir reset the ctrl values to all 1s in the QOS_MSR for the
> directory's closid. This is done so that that next time when the closid
> is reused they dont reflect old values.

Sigh.

> +static int reset_all_ctrls(struct rdt_resource *r, u32 sclosid, u32 eclosid)

What's so wrong with using 'start' and 'end' instead of these cryptic names? 

>  {
>  	struct msr_param msr_param;
>  	cpumask_var_t cpu_mask;
> @@ -791,8 +791,8 @@ static int reset_all_cbms(struct rdt_resource *r)
>  		return -ENOMEM;
>  
>  	msr_param.res = r;
> -	msr_param.low = 0;
> -	msr_param.high = r->num_closid;
> +	msr_param.low = sclosid;
> +	msr_param.high = eclosid;
>  
>  	/*
>  	 * Disable resource control for this resource by setting all
> @@ -802,7 +802,7 @@ static int reset_all_cbms(struct rdt_resource *r)
>  	list_for_each_entry(d, &r->domains, list) {
>  		cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
>  
> -		for (i = 0; i < r->num_closid; i++)
> +		for (i = sclosid; i < eclosid; i++)

'eclosid' or even when named 'end' is an outright bogus argument to this
function. What you really want is:

static int reset_all_ctrls(struct rdt_resource *r, u32 closid, u32 count)

which works here:

>  	for_each_enabled_rdt_resource(r)
> -		reset_all_cbms(r);
> +		reset_all_ctrls(r, 0, r->num_closid);

and makes this part understandable:

> +	/*
> +	 * Put domain control values back to default for the
> +	 * rdtgrp thats being removed.
> +	 */
> +	for_each_enabled_rdt_resource(r)
> +		reset_all_ctrls(r, rdtgrp->closid, rdtgrp->closid + 1);

		reset_all_ctrls(r, rdtgrp->closid, 1);

What you have done: 

> +		reset_all_ctrls(r, rdtgrp->closid, rdtgrp->closid + 1);

made me really look twice to figure out what the heck this is about.

Thanks,

	tglx

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


#1596548

FromShivappa Vikas <vikas.shivappa@linux.intel.com>
Date2017-03-10 02:50 +0100
Message-ID<tjhQS-4Yq-13@gated-at.bofh.it>
In reply to#1590349

On Wed, 1 Mar 2017, Thomas Gleixner wrote:

> On Fri, 17 Feb 2017, Vikas Shivappa wrote:
>
>> During rmdir reset the ctrl values to all 1s in the QOS_MSR for the
>> directory's closid. This is done so that that next time when the closid
>> is reused they dont reflect old values.
>
> Sigh.
>
>> +static int reset_all_ctrls(struct rdt_resource *r, u32 sclosid, u32 eclosid)
>
> What's so wrong with using 'start' and 'end' instead of these cryptic names?
>
>>  {
>>  	struct msr_param msr_param;
>>  	cpumask_var_t cpu_mask;
>> @@ -791,8 +791,8 @@ static int reset_all_cbms(struct rdt_resource *r)
>>  		return -ENOMEM;
>>
>>  	msr_param.res = r;
>> -	msr_param.low = 0;
>> -	msr_param.high = r->num_closid;
>> +	msr_param.low = sclosid;
>> +	msr_param.high = eclosid;
>>
>>  	/*
>>  	 * Disable resource control for this resource by setting all
>> @@ -802,7 +802,7 @@ static int reset_all_cbms(struct rdt_resource *r)
>>  	list_for_each_entry(d, &r->domains, list) {
>>  		cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
>>
>> -		for (i = 0; i < r->num_closid; i++)
>> +		for (i = sclosid; i < eclosid; i++)
>
> 'eclosid' or even when named 'end' is an outright bogus argument to this
> function. What you really want is:
>
> static int reset_all_ctrls(struct rdt_resource *r, u32 closid, u32 count)
>
> which works here:
>
>>  	for_each_enabled_rdt_resource(r)
>> -		reset_all_cbms(r);
>> +		reset_all_ctrls(r, 0, r->num_closid);
>
> and makes this part understandable:
>
>> +	/*
>> +	 * Put domain control values back to default for the
>> +	 * rdtgrp thats being removed.
>> +	 */
>> +	for_each_enabled_rdt_resource(r)
>> +		reset_all_ctrls(r, rdtgrp->closid, rdtgrp->closid + 1);
>
> 		reset_all_ctrls(r, rdtgrp->closid, 1);

Will fix the parameters to start and count..

>
> What you have done:
>
>> +		reset_all_ctrls(r, rdtgrp->closid, rdtgrp->closid + 1);
>
> made me really look twice to figure out what the heck this is about.
>
> Thanks,
>
> 	tglx
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web