Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754997AbdCJBoo (ORCPT ); Thu, 9 Mar 2017 20:44:44 -0500 Received: from mga03.intel.com ([134.134.136.65]:5712 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753768AbdCJBom (ORCPT ); Thu, 9 Mar 2017 20:44:42 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,137,1486454400"; d="scan'208";a="1140296641" Date: Thu, 9 Mar 2017 17:45:13 -0800 (PST) From: Shivappa Vikas X-X-Sender: vikas@vshiva-Udesk To: Thomas Gleixner cc: Vikas Shivappa , 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: 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.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1969 Lines: 72 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 >