From: Peter Zijlstra <peterz@infradead.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Stephane Eranian <eranian@google.com>,
linux-kernel@vger.kernel.org, mingo@elte.hu, ak@linux.intel.com,
edumazet@google.com, acme@redhat.com
Subject: Re: [PATCH v2] perf/core: fix RCU issues with cgroup monitoring mode
Date: Tue, 27 Oct 2015 23:34:20 +0100 [thread overview]
Message-ID: <20151027223420.GA11242@worktop.amr.corp.intel.com> (raw)
In-Reply-To: <1445977445.7476.52.camel@edumazet-glaptop2.roam.corp.google.com>
On Tue, Oct 27, 2015 at 01:24:05PM -0700, Eric Dumazet wrote:
> On Tue, 2015-10-27 at 20:25 +0100, Stephane Eranian wrote:
> > This patch eliminates all known RCU violations detected
> > by the RCU checker (PROVE_RCU). The impact code paths
> > were all related to cgroup mode monitoring and involved
> > access a task's cgrp.
> >
> > V2 is updated to include suggestions from PeterZ to eliminate
> > some of the warnings without grabbing the rcu_read lock because
> > we know we are already holding the ctx->lock which prevents
> > the cgroup from disappearing while we are accessing it.
> > The trick, as suggested by Peter, is to modify the
> > perf_cgroup_from_task() to take an extra boolean parameter
> > to allow bypassing the lockdep test in the task_subsys_cstate()
> > macros. This patch uses this approach to update all calls the
> > perf_cgroup_from_task().
> > V2 Patch relative to:
> > 8b3c8e6 Revert "rculist: Make list_entry_rcu() use lockless_dereference()"
> >
> > Signed-off-by: Stephane Eranian <eranian@google.com>
> > ---
>
>
> Instead trusting caller to provide correct 'safe' boolean,
> what about using lockdep_is_held() ?
>
> This way, you keep full lockep support.
Because its really really hard to get from a random task to the right
lock in this case :/
The connection is something like:
task <-> cgroup <-> event <-> ctx <-> lock
So for any given task, we need to find its cgroup (easy, but this
already requires knowing the lock), we need to find all events for that
cgroup and locate the one that is for the cpu the task runs on. Then we
need to find its context and see it the lock is taken.
So aside from if being rather hard, there's also the chicken-egg
problem.
Now I suppose we can pass the right ctx in, and when !NULL use
lock_is_held() on it. But we'd need to validate that the ctx passed
matches the cgroup, and that's not entirely trivial either.
A well :/
next prev parent reply other threads:[~2015-10-28 0:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 19:25 [PATCH v2] perf/core: fix RCU issues with cgroup monitoring mode Stephane Eranian
2015-10-27 20:24 ` Eric Dumazet
2015-10-27 22:34 ` Peter Zijlstra [this message]
2015-10-27 23:37 ` Stephane Eranian
2015-10-28 0:17 ` Eric Dumazet
2015-10-28 0:27 ` 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=20151027223420.GA11242@worktop.amr.corp.intel.com \
--to=peterz@infradead.org \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=edumazet@google.com \
--cc=eranian@google.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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