All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andi Kleen <andi@firstfloor.org>,
	x86@kernel.org, hpa@zytor.com, eranian@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] x86: Track minimum microcode revision globally v2
Date: Wed, 13 Jun 2012 07:49:07 -0700	[thread overview]
Message-ID: <20120613144907.GA32604@tassilo.jf.intel.com> (raw)
In-Reply-To: <1339577392.31548.122.camel@twins>

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@linux.intel.com -- Speaking for myself only

  reply	other threads:[~2012-06-13 14:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 21:25 [PATCH 1/2] x86: Track minimum microcode revision globally v2 Andi Kleen
2012-06-12 21:25 ` [PATCH 2/2] perf/x86: check ucode before disabling PEBS on SandyBridge v3 Andi Kleen
2012-06-12 21:39 ` [PATCH 1/2] x86: Track minimum microcode revision globally v2 Borislav Petkov
2012-06-12 22:09   ` Andi Kleen
2012-06-12 22:19     ` Borislav Petkov
2012-06-12 22:53       ` Andi Kleen
2012-06-13  6:55         ` Borislav Petkov
2012-06-13  8:49 ` Peter Zijlstra
2012-06-13 14:49   ` Andi Kleen [this message]
2012-06-13  8:57 ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120613144907.GA32604@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.