Re: [PATCH v3] perf: fix RCU issues with cgroup monitoring mode

From: Peter Zijlstra
Date: Wed Nov 04 2015 - 10:53:42 EST


On Wed, Nov 04, 2015 at 05:12:19AM +0100, Stephane Eranian wrote:
>
> This patch eliminates 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 comments from PeterZ to eliminate
> some of the warnings without grabbing the rcu_read lock because
> we know we are already holding th 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().
>
> In V3, we change the boolean parameter for a pointer to a
> perf_event_context so we can check the ctx->lock explicitely.
> This is more robust, than passing the boolean to express that
> we know the lock is held. The code can change, and thus the
> locking assumption, checking lockdep_is_held() ensures,
> the proper locking is in place. Patch relative to tip.git
> at commit 57ef9fc.

So aside from the reported build fails; this is not suitable Changelog.

Also, please split it at least two patches; as there are at least the
two distinct issues here.

One is the perf_cgroup_sched_{in,out} thing, which requires moving the
rcu_read_lock bits around, the other is the timestamp bits which require
the ctx argument.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/