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

From: Peter Zijlstra
Date: Sat Oct 17 2015 - 05:57:04 EST


On Sat, Oct 17, 2015 at 03:28:11AM +0200, 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.

But were they right? This patch provides no clues.

> Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
> ---

> @@ -2094,6 +2104,7 @@ static int __perf_install_in_context(void *info)
> cpuctx->task_ctx = task_ctx;
> task = task_ctx->task;
> }
> + rcu_read_lock();
>
> cpu_ctx_sched_out(cpuctx, EVENT_ALL);
>
> @@ -2112,6 +2123,8 @@ static int __perf_install_in_context(void *info)
> */
> perf_event_sched_in(cpuctx, task_ctx, task);
>
> + rcu_read_unlock();
> +
> perf_pmu_enable(cpuctx->ctx.pmu);
> perf_ctx_unlock(cpuctx, task_ctx);
>
> @@ -2398,7 +2411,9 @@ static void ctx_sched_out(struct perf_event_context *ctx,
> return;
>
> update_context_time(ctx);
> + rcu_read_lock();
> update_cgrp_time_from_cpuctx(cpuctx);
> + rcu_read_unlock();
> if (!ctx->nr_active)
> return;
>

And these impact !cgroup code, and the last looks like it should be
inside update_cgrp_time_from_cpuctx() if at all.
--
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/