mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	Robert Richter <robert.richter@amd.com>
Subject: Re: [BUG] perf: multiplexing and hotplug CPU problem
Date: Wed, 12 Sep 2012 16:47:12 +0200	[thread overview]
Message-ID: <1347461232.15764.45.camel@twins> (raw)
In-Reply-To: <CABPqkBSemt4hsoFfGkm3pac+R+aUJ6Kd9LBTWM-JtKMOF4VM9Q@mail.gmail.com>

On Wed, 2012-09-12 at 16:40 +0200, Stephane Eranian wrote:
> Hi,
> 
> As I was debugging my hrtimer patch, I ran a few tests
> with hotplug CPU. In others words, I offline a CPU while
> there is an active monitoring session which causes multiplexing.
> 
> When the CPU goes down, all is well. But when it comes back,
> things go wrong. No kernel crashes but wrong results and multiplexing
> does not work anymore.
> 
> I investigated this some more and found out there is an issue
> on re-activation.
> 
> During shutdown, system-wide events are scheduled out AND removed
> from the event lists. Consequently, ctx->nr_events and ctx->nr_active
> go to zero.
> 
> When the CPU is brought back online and tools do start/stop on the events
> they can be scheduled back in, and therefore increment ctx->nr_active.
> Because list_add_event() is not called again, you may end up with
> ctx->nr_events < ctx->nr_active which is wrong. Events may not
> be a lists and therefore they cannot get multiplexed again.
> 
> It is not clear to me why we need to remove the events from any
> list (list_del_event) when the CPU goes down.
> 
> Why isn't calling event_sched_out() enough?
> If events are kept on lists, why not try to schedule them back in when
> the CPU is brought back online?

This might be never, I think we should put the events in error state
instead of disabling them, that should avoid the re-activation and
provide a stronger hint to userspace that something went funny.

  reply	other threads:[~2012-09-12 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 14:40 Stephane Eranian
2012-09-12 14:47 ` Peter Zijlstra [this message]
2012-09-12 14:50   ` Stephane Eranian

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=1347461232.15764.45.camel@twins \
    --to=peterz@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=robert.richter@amd.com \
    /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®