From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755455AbcJZPEj (ORCPT ); Wed, 26 Oct 2016 11:04:39 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40428 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753662AbcJZPEg (ORCPT ); Wed, 26 Oct 2016 11:04:36 -0400 Date: Wed, 26 Oct 2016 15:52:46 +0200 (CEST) From: Thomas Gleixner To: Fenghua Yu cc: "H. Peter Anvin" , Ingo Molnar , Tony Luck , Peter Zijlstra , Stephane Eranian , Borislav Petkov , Dave Hansen , Nilay Vaish , Shaohua Li , David Carrillo-Cisneros , Ravi V Shankar , Sai Prakhya , Vikas Shivappa , linux-kernel , x86 Subject: Re: [PATCH v5 11/18] x86/intel_rdt: Add basic resctrl filesystem support In-Reply-To: <1477142405-32078-12-git-send-email-fenghua.yu@intel.com> Message-ID: References: <1477142405-32078-1-git-send-email-fenghua.yu@intel.com> <1477142405-32078-12-git-send-email-fenghua.yu@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 Sat, 22 Oct 2016, Fenghua Yu wrote: > +static void l3_qos_cfg_update(void *arg) > +{ > + bool enable = *(bool *)arg; > + > + wrmsrl(IA32_L3_QOS_CFG, enable); Bah. What's wrong with bool *enable = arg; wrmsrl(IA32_L3_QOS_CFG, *enable); That does not have this cute type cast, right? > +static int set_l3_qos_cfg(struct rdt_resource *r, bool enable) > +{ > + struct rdt_domain *d; > + cpumask_var_t cpu_mask; > + int cpu; That's the last time I ask for consistent variable ordering politely: cpumask_var_t cpu_mask; struct rdt_domain *d; int cpu; > +static struct dentry *rdt_mount(struct file_system_type *fs_type, > + int flags, const char *unused_dev_name, > + void *data) > +{ > + struct dentry *dentry; > + int ret; > + > + mutex_lock(&rdtgroup_mutex); > + /* > + * resctrl file system can only be mounted once. > + */ > + if (static_branch_unlikely(&rdt_enable_key)) { > + dentry = ERR_PTR(-EBUSY); > + goto out; > + } > + > + ret = parse_rdtgroupfs_options(data); > + if (ret) { > + dentry = ERR_PTR(ret); > + goto out; > + } > + > + dentry = kernfs_mount(fs_type, flags, rdt_root, > + RDTGROUP_SUPER_MAGIC, NULL); > + if (IS_ERR(dentry)) > + goto out; > + > + if (rdt_resources_all[RDT_RESOURCE_L3DATA].enabled && > + rdt_resources_all[RDT_RESOURCE_L3CODE].enabled) { > + ret = set_l3_qos_cfg(&rdt_resources_all[RDT_RESOURCE_L3], true); > + if (ret) > + goto out; So you skip the key enable, but the mount persists and the return value of that function is not propagated. > + } > + static_branch_enable(&rdt_enable_key); > + > +out: > + mutex_unlock(&rdtgroup_mutex); > + > + return dentry; > +} > + > +static int reset_all_cbms(struct rdt_resource *r) > +{ > + struct rdt_domain *d; > + struct msr_param msr_param; > + cpumask_var_t cpu_mask; > + int i, cpu; See above and everywhere .... > + if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) > + return -ENOMEM; > + > + msr_param.res = r; > + msr_param.low = 0; > + msr_param.high = r->num_closid; > + > + /* > + * Reset each domain's all CBMs to max value and copy the domain's What means 'reset CBMs to max value'? I know what it means as do you and a few others. 3 month from now we all scratch our heads... > +static void rdt_kill_sb(struct super_block *sb) > +{ > + struct rdt_resource *r; > + > + mutex_lock(&rdtgroup_mutex); > + > + /*Put everything back to default values. */ > + for_each_enabled_rdt_resource(r) > + reset_all_cbms(r); > + r = &rdt_resources_all[RDT_RESOURCE_L3]; > + r->enabled = r->capable; > + if (boot_cpu_has(X86_FEATURE_CDP_L3)) { Why? if (rdt_resources_all[RDT_RESOURCE_L3DATA].enabled) { only executes that if the thing was enabled. > + rdt_resources_all[RDT_RESOURCE_L3DATA].enabled = false; > + rdt_resources_all[RDT_RESOURCE_L3CODE].enabled = false; > + set_l3_qos_cfg(r, false); > + } > + > + static_branch_disable(&rdt_enable_key); > + kernfs_kill_sb(sb); > + mutex_unlock(&rdtgroup_mutex); > +} Thanks, tglx