From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] perf_counter: Don't swap contexts containing locked mutex
Date: Fri, 29 May 2009 11:16:08 +0200 [thread overview]
Message-ID: <20090529091608.GA15278@elte.hu> (raw)
In-Reply-To: <20090529085916.GA21461@elte.hu>
* Ingo Molnar <mingo@elte.hu> wrote:
>
> * Peter Zijlstra <peterz@infradead.org> wrote:
>
> > On Fri, 2009-05-29 at 10:13 +0200, Peter Zijlstra wrote:
> > > On Fri, 2009-05-29 at 10:06 +0200, Peter Zijlstra wrote:
> > >
> > > > static struct perf_counter_ctx *pin_ctx(struct perf_counter *counter, u64 *old_gen)
> > > > {
> > > > struct perf_counter_context *ctx;
> > > > unsigned long flags;
> > > >
> > > > rcu_read_lock();
> > > > retry:
> > > > ctx = rcu_dereference(counter->ctx);
> > > > spin_lock_irqsave(&ctx->lock, flags);
> > > > if (ctx != rcu_dereference(counter->ctx))
> > > > goto retry;
> > > >
> > > > *old_gen = ctx->generation;
> > > > ctx->generation = ~0ULL;
> > > > spin_unlock_irqrestore(&ctx->lock, flags);
> > > > rcu_read_unlock();
> > > >
> > > > return ctx;
> > > > }
> > > >
> > > > static void unpin_ctx(struct perf_counter_ctx *ctx, u64 old_gen)
> > > > {
> > > > unsigned long flags;
> > > >
> > > > spin_lock_irqsave(&ctx->lock, flags);
> > > > ctx->generation = old_gen;
> > > > spin_unlock_irqrestore(&ctx->lock, flags);
> > > > }
> > >
> > > OK, I think I got this wrong, counter->ctx isn't the problem.
> > > task->perf_counter_ctx is.
> > >
> > > Still would be nice to write it in the above form. I'll go over the code
> > > again to see who else might want it.
> >
> > OK, I went over the code, and your patch does indeed cover the few
> > spots we need. It was just my brain going haywire and auditing the
> > wrong pattern.
>
> ok - i'll try this with my 'perf stat make -j' workload that
> quickly locks up on a Nehalem. (bug introduced by the context
> switch optimizations)
nope, that still hangs the box.
try the latest Git repo (i tried 95110d7) and do this:
make clean
perf stat -- make -j
that locks up for me, very quickly, with permanently stuck tasks:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME COMMAND
10748 mingo 20 0 0 0 0 R 100.4 0.0 0:06.44 chmod
10756 mingo 20 0 0 0 0 R 100.4 0.0 0:06.43 touch
looping in the remove-context retry loop.
Ingo
next prev parent reply other threads:[~2009-05-29 9:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 6:06 [PATCH RFC] perf_counter: Don't swap contexts containing locked mutex Paul Mackerras
2009-05-29 8:06 ` Peter Zijlstra
2009-05-29 8:10 ` Peter Zijlstra
2009-05-29 8:13 ` Peter Zijlstra
2009-05-29 8:28 ` Peter Zijlstra
2009-05-29 8:59 ` Ingo Molnar
2009-05-29 9:16 ` Ingo Molnar [this message]
2009-05-29 11:13 ` Paul Mackerras
2009-05-29 11:17 ` Peter Zijlstra
2009-05-29 11:23 ` Paul Mackerras
2009-05-29 12:35 ` Ingo Molnar
2009-05-29 13:49 ` Pekka Enberg
2009-05-29 8:25 ` Paul Mackerras
2009-05-29 12:03 ` [tip:perfcounters/core] " tip-bot for Paul Mackerras
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=20090529091608.GA15278@elte.hu \
--to=mingo@elte.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.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.