Re: [-v2 PATCH 2/6] powernow-k8: Add core performance boost support

From: Borislav Petkov
Date: Wed Mar 31 2010 - 02:35:18 EST


From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, Mar 30, 2010 at 11:22:21PM -0400

> On Wed, 31 Mar 2010 08:13:43 +0200 Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> > > > +static void _cpb_toggle_msrs(bool t)
> > > > +{
> > > > + int cpu;
> > > > +
> > > > + rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs);
> > > > +
> > > > + for_each_cpu(cpu, cpu_online_mask) {
> > > > + struct msr *reg = per_cpu_ptr(msrs, cpu);
> > > > + if (t)
> > > > + reg->l &= ~BIT(25);
> > > > + else
> > > > + reg->l |= BIT(25);
> > > > + }
> > > > + wrmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs);
> > > > +}
> > >
> > > What prevents cpu_online_mask from changing while this is happening?
> >
> > Frankly, nothing.
>
> Sneak a get_online_cpus()/put_online_cpus() in there?

Yep, that'll make it safe wrt to accessing the mask. I'll also have to
check whether there are some cores missing before toggling the bit and
warn accordingly. Do you want a relative diff ontop of this patch or
should I redo the original one?

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/