mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	John Levon <levon@movementarian.org>, Ingo Molnar <mingo@elte.hu>,
	x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Robert Richter <robert.richter@amd.com>
Subject: Re: [PATCH] x86: fix BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/3319
Date: Sun, 5 Apr 2009 23:02:58 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0904052301481.747@localhost.localdomain> (raw)
In-Reply-To: <1238962495.3301.0.camel@ht.satnam>

On Mon, 6 Apr 2009, Jaswinder Singh Rajput wrote:
> On Sun, 2009-04-05 at 12:51 -0700, Linus Torvalds wrote:
> > 
> > On Mon, 6 Apr 2009, Jaswinder Singh Rajput wrote:
> > >
> > > Fixed this bug on P4 HT machine:
> > 
> > I don't think this really is correct.
> > 
> > Anything that does that "get_stagger()" thing should already either be 
> > tied to a specific CPU (because it's going to actually touch the variables 
> > for "that CPU"), or it should likely set up the data structures for _all_ 
> > cases.

Most of the functions are called preempt off anyway. The only one
which needs care AFAICT is p4_fill_in_addresses, but the problem space
is outside of the p4 specific code. It's the call site which is
nmi_setup():

       model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
       ...
       on_each_cpu(nmi_cpu_setup, NULL, 1);

Need to have a closer look which parts of that section need to be
preempt off.

> > Just as an example, look at something like "p4_setup_ctrs()": it will use 
> > that stagger to determine what MSR to read. But if we are preemptable, the 
> > CPU we actually do the MSR read on may be a _different_ CPU than the CPU 
> > that we did the "get_stagger()" on!

And that code has nested calls to get_stagger() via pmc_setup_one_p4_counter().

That is odd as well. Why evaluate that twice ? So there are more
things to look at before we just fix^Whide some debug warning.

> > Of course, this is all ancient code, so whatever. But I really think this 
> > patch is actively bad - it just hides the issue rather than fixing 
> > anything.

And the proposed follow up patch is even worse as it just adds
mechanical band aids all over the place without analysing where the
root cause of the problem is.

Thanks,

	tglx



  reply	other threads:[~2009-04-05 21:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-05 19:12 Jaswinder Singh Rajput
2009-04-05 19:51 ` Linus Torvalds
2009-04-05 20:14   ` Jaswinder Singh Rajput
2009-04-05 21:02     ` Thomas Gleixner [this message]
2009-04-05 21:38     ` [RFC PATCH] x86, oprofile: fix P4 oprofile CPU setup bug Ingo Molnar
2009-04-05 21:59       ` Ingo Molnar
2009-04-06  4:11         ` Jaswinder Singh Rajput
2009-04-06  4:10       ` Jaswinder Singh Rajput

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=alpine.LFD.2.00.0904052301481.747@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=jaswinder@kernel.org \
    --cc=levon@movementarian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=robert.richter@amd.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®