From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752251AbbJQJ5C (ORCPT ); Sat, 17 Oct 2015 05:57:02 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:55467 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbbJQJ5A (ORCPT ); Sat, 17 Oct 2015 05:57:00 -0400 Date: Sat, 17 Oct 2015 11:56:51 +0200 From: Peter Zijlstra To: Stephane Eranian Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, ak@linux.intel.com, edumazet@google.com, acme@redhat.com Subject: Re: [PATCH] perf/core: fix RCU issues with cgroup monitoring mode Message-ID: <20151017095651.GE3816@twins.programming.kicks-ass.net> References: <20151017012811.GA18581@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151017012811.GA18581@thinkpad> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > @@ -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.