Re: [PATCH] perf/x86: check ucode before disabling PEBS onSandyBridge

From: Peter Zijlstra
Date: Fri Jun 08 2012 - 10:13:14 EST


On Fri, 2012-06-08 at 16:07 +0200, Stephane Eranian wrote:

> > The very worst is that it does per-cpu micro-code updates, not machine
> > wide. This results in it being able to have different revisions on
> > different cpus. This in turn makes the below O(n^2) :/
> >
> But it's not like this is a frequent operation either...

Still Dimitri did a patch 938179b4f8cf8 ("x86: Improve Intel microcode
loader performance") to improve the performance of it, so apparently
they do care some.

> > ---

> > diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
> > index 4ebe157..1cd2dc5 100644
> > --- a/arch/x86/include/asm/microcode.h
> > +++ b/arch/x86/include/asm/microcode.h

> > @@ -63,4 +64,15 @@ static inline struct microcode_ops * __init init_amd_microcode(void)
> > static inline void __exit exit_amd_microcode(void) {}
> > #endif
> >
> > +extern struct blocking_notifier_head microcode_notifier;
> > +
> That is a problem because microcode can be compiled as a module.
> When I tried compiling your patch I got undefined for this notifier because
> I have microcode update as a module...
>
> > +#define MICROCODE_CAN_UPDATE 0x01
> > +#define MICROCODE_UPDATED 0x02
> > +
> > +#define microcode_notifier(fn) \
> > +do { \
> > + static struct notifier_block fn##_nb ={ .notifier_call = fn }; \
> > + blocking_notifier_chain_register(&microcode_notifier, &fn##_nb);\
> > +} while (0)
> > +
> > #endif /* _ASM_X86_MICROCODE_H */

But that's ourside of CONFIG_MICROCODE and...

> > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> > index f4b9b80..98b5b5c 100644
> > --- a/arch/x86/kernel/setup.c
> > +++ b/arch/x86/kernel/setup.c
> > @@ -68,6 +68,7 @@
> > #include <linux/percpu.h>
> > #include <linux/crash_dump.h>
> > #include <linux/tboot.h>
> > +#include <linux/notifier.h>
> >
> > #include <video/edid.h>
> >
> > @@ -205,6 +206,10 @@ struct cpuinfo_x86 boot_cpu_data __read_mostly = {
> > EXPORT_SYMBOL(boot_cpu_data);
> > #endif
> >
> > +/*
> > + * Lives here because the microcode stuff is modular.
> > + */
> > +struct atomic_notifier_head microcode_notifier;

s/atomic_/blocking_/ -- forgot a refresh there..

> > #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
> > unsigned long mmu_cr4_features;


So that all should build.. weird.. I'll give it a go.


--
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/