lkml.org 
[lkml]   [2010]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [-v2 PATCH 2/6] powernow-k8: Add core performance boost support
From: Andrew Morton <akpm@linux-foundation.org>
Date: Tue, Mar 30, 2010 at 11:22:21PM -0400

> On Wed, 31 Mar 2010 08:13:43 +0200 Borislav Petkov <bp@amd64.org> 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


\
 
 \ /
  Last update: 2010-03-31 08:37    [from the cache]
©2003-2011 Jasper Spaans