lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 26 Oct 2016 15:52:46 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Fenghua Yu <fenghua.yu@...el.com>
cc:     "H. Peter Anvin" <h.peter.anvin@...el.com>,
        Ingo Molnar <mingo@...e.hu>, Tony Luck <tony.luck@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Stephane Eranian <eranian@...gle.com>,
        Borislav Petkov <bp@...e.de>,
        Dave Hansen <dave.hansen@...el.com>,
        Nilay Vaish <nilayvaish@...il.com>, Shaohua Li <shli@...com>,
        David Carrillo-Cisneros <davidcc@...gle.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        Sai Prakhya <sai.praneeth.prakhya@...el.com>,
        Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v5 11/18] x86/intel_rdt: Add basic resctrl filesystem
 support

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ