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

From: Borislav Petkov
Date: Wed Mar 31 2010 - 02:13:15 EST


From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, Mar 30, 2010 at 03:42:29PM -0700

Hi Andrew,

> On Fri, 26 Mar 2010 14:39:56 +0100
> Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> > From: Borislav Petkov <borislav.petkov@xxxxxxx>
> >
> > Starting with F10h, revE, AMD processors add support for a dynamic
> > core boosting feature called Core Performance Boost. When a specific
> > condition is present, a subset of the cores on a system are boosted
> > beyond their P0 operating frequency to speed up the performance of
> > single-threaded applications.
> >
> > In the normal case, the system comes out of reset with core boosting
> > enabled. This patch adds a sysfs knob with which core boosting can be
> > switched on or off for benchmarking purposes.
> >
> > While at it, cleanup the driver init codepath and update copyrights.
> >
> > ...
> >
> > +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. And yes, we talked a lot about this internally, since,
you need this bit cleared on _all_ cores for the processor to boost.
Now, if you've offlined some of the cores, you won't be able to execute
any code on them and thus clear this bit.

However, this interface is there only for benchmarking purposes and
stuff, i.e. normally, you shouldn't need to touch it _at_ _all_ and
boosting will work out of the box and without user interaction.

So, IMHO, hotplug notifiers won't work since you need all cores online
at that particular moment to enable boosting. It sounds more reasonable
to me to WARN when a core is missing from the mask that boosting cannot
be enabled. I'll cook up something later today.

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/