From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbdCAOLv (ORCPT ); Wed, 1 Mar 2017 09:11:51 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:39534 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbdCAOLs (ORCPT ); Wed, 1 Mar 2017 09:11:48 -0500 Date: Wed, 1 Mar 2017 15:11:20 +0100 (CET) From: Thomas Gleixner To: Vikas Shivappa cc: vikas.shivappa@intel.com, linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, andi.kleen@intel.com Subject: Re: [PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir In-Reply-To: <1487360328-6768-5-git-send-email-vikas.shivappa@linux.intel.com> Message-ID: References: <1487360328-6768-1-git-send-email-vikas.shivappa@linux.intel.com> <1487360328-6768-5-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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