lkml.org 
[lkml]   [2016]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v6 03/10] x86/intel_rdt: Add basic resctrl filesystem support
    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

    \
     
     \ /
      Last update: 2016-10-31 02:20    [W:3.741 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site