Re: [PATCH 1/2] x86: Track minimum microcode revision globally v2

From: Andi Kleen
Date: Wed Jun 13 2012 - 10:49:05 EST


On Wed, Jun 13, 2012 at 10:49:52AM +0200, Peter Zijlstra wrote:
> On Tue, 2012-06-12 at 14:25 -0700, Andi Kleen wrote:
> > +void update_min_microcode(struct cpuinfo_x86 *c)
> > +{
> > + int i;
> > +
> > + for_each_online_cpu (i)
>
> Superfluous whitespace
>
> > + if (cpu_data(i).microcode < c->microcode)
> > + return;
>
> That needs {}

You must be following a different code style guide than the Linux one.


> > c->microcode = val[1];
> >
> > + update_min_microcode(c);
> > return 0;
> > }
>
> Doing it here means doing the for_each_cpu thing with preempt/irqs
> disabled, that's not funny.

Well a ucode update is a really slow operation anyways. And the loop
gets stopped at the first mismatch. So it'll never be n^2 and in most
cases much faster. Generally the loop should be several orders
of magnitude less than the actual cost of the update, even on large
systems.

> Also this is still a O(n^2) proposition.. so how is this better than the
> notifier thing I had?

Simpler at least.

I don't know why people love notifiers, they are a "COME FROM" and make
every code who uses them a mess.

As for CPU_STARTING don't know how complicated it would be. I suppose
it could be done as a follow up.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
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/