From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757456AbcJaBRC (ORCPT ); Sun, 30 Oct 2016 21:17:02 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51370 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932656AbcJaBQ6 (ORCPT ); Sun, 30 Oct 2016 21:16:58 -0400 Date: Sun, 30 Oct 2016 19:13:59 -0600 (MDT) From: Thomas Gleixner To: Fenghua Yu cc: Ingo Molnar , "H. Peter Anvin" , Tony Luck , Borislav Petkov , Stephane Eranian , Peter Zijlstra , Dave Hansen , David Carrillo-Cisneros , Ravi V Shankar , Vikas Shivappa , Sai Prakhya , Nilay Vaish , Shaohua Li , linux-kernel , x86 Subject: Re: [PATCH v6 03/10] x86/intel_rdt: Add basic resctrl filesystem support In-Reply-To: <1477692289-37412-4-git-send-email-fenghua.yu@intel.com> Message-ID: References: <1477692289-37412-1-git-send-email-fenghua.yu@intel.com> <1477692289-37412-4-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 Fri, 28 Oct 2016, Fenghua Yu wrote: > +static void l3_qos_cfg_update(void *arg) > +{ > + bool *enable = arg; > + > + wrmsrl(IA32_L3_QOS_CFG, *enable); > +} > + > +static int set_l3_qos_cfg(struct rdt_resource *r, bool enable) > +{ > + cpumask_var_t cpu_mask; > + struct rdt_domain *d; > + int cpu; > + > + if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) > + return -ENOMEM; > + > + list_for_each_entry(d, &r->domains, list) { > + /* Pick one CPU from each domain instance to update MSR */ > + cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); > + } > + cpu = get_cpu(); > + /* Update QOS_CFG MSR on this cpu if it's in cpu_mask. */ > + if (cpumask_test_cpu(cpu, cpu_mask)) > + l3_qos_cfg_update(r); I made this &enable ..... > + /* Update QOS_CFG MSR on all other cpus in cpu_mask. */ > + smp_call_function_many(cpu_mask, l3_qos_cfg_update, &enable, 1); > + put_cpu(); > + 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) { > + dentry = ERR_PTR(ret); > + goto out; > + } > + } > + > + dentry = kernfs_mount(fs_type, flags, rdt_root, > + RDTGROUP_SUPER_MAGIC, NULL); > + if (IS_ERR(dentry)) > + goto out; This leaks a potentially enabled cdp. So if you mount again later w/o cdp the machine will still be in cdp enabled mode. I fixed that up with proper error handling. Please verify the changes carefuly. Thanks, tglx