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] [day] [month] [year] [list]
Date:	Thu, 4 Mar 2010 22:43:59 +0100
From:	Borislav Petkov <borislav.petkov@....com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	Mark Langsdorf <mark.langsdorf@....com>,
	<linux-kernel@...r.kernel.org>, <cpufreq@...r.kernel.org>,
	<bhavna.sarathy@....com>, <joachim.deguara@....com>
Subject: Re: [PATCH 2/3] [cpufreq] powernow-k8: add core performance boost
 support

From: Andrew Morton <akpm@...ux-foundation.org>
Date: Thu, Mar 04, 2010 at 01:23:28PM -0800

Hi Andrew,

[..]

> > +/* CPB 0=disable, 1=enable. */
> > +static void cpb_toggle(u32 t)
> > +{
> > +	if (cpb_capable) {
> > +		u32 lo, hi;
> > +		rdmsr(MSR_K7_HWCR, lo, hi);
> > +
> 
> The newline usually goes after end-of-locals, before start-of-code.

Done.

> > +		if (t)
> > +			lo &= ~(1 << 25);
> > +		else
> > +			lo |= (1 << 25);
> > +
> > +		wrmsr(MSR_K7_HWCR, lo, hi);
> > +
> > +		printk(KERN_ERR "CPB: %s.\n", (t ? "on" : "off"));
> 
> Why KERN_ERR?  It's not an error?
> 
> Do we want a printk here at all?  Under which circumstances will it come
> out?  Does it have sufficient context for people to be able to
> understand what it means, and which subsystem it's referring to?  If
> you phone your Aunt Tillie and tell her "CPB: on", will she understand
> what you mean?

This isn't actually supposed to be there - it was there only for
debugging.

These patches weren't supposed to go out just yet so please drop them
from your tree for now - I'll have corrected versions with proper
changelogs soon.

> > --- a/include/linux/cpufreq.h
> > +++ b/include/linux/cpufreq.h
> > @@ -104,6 +104,10 @@ struct cpufreq_policy {
> >  
> >  	struct kobject		kobj;
> >  	struct completion	kobj_unregister;
> > +
> > +	struct flags {
> > +		unsigned long cpb:1;	/* toggle CPB on this cpu */
> > +	} flags;
> >  };
> 
> Bear in mind that the compiler provides no atomicity support for
> bitfields.  So if someone later comes along and adds a new field to
> `flags', they will need to provide external synchronisation (ie: a
> lock) to protect that field during modifications to `cpb'.
> 
> IOW, this is a bit of a hand-grenade.

Ok, I'll switch to a unsigned long for the flags.

Thanks.

-- 
Regards/Gruss,
Boris.

-
Advanced Micro Devices, Inc.
Operating Systems Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ