From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413AbbJSJMa (ORCPT ); Mon, 19 Oct 2015 05:12:30 -0400 Received: from casper.infradead.org ([85.118.1.10]:50770 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbbJSJM2 (ORCPT ); Mon, 19 Oct 2015 05:12:28 -0400 Date: Mon, 19 Oct 2015 11:12:25 +0200 From: Peter Zijlstra To: Stephane Eranian Cc: LKML , "mingo@elte.hu" , "ak@linux.intel.com" , Eric Dumazet , Arnaldo Carvalho de Melo Subject: Re: [PATCH] perf/core: fix RCU issues with cgroup monitoring mode Message-ID: <20151019091225.GH3816@twins.programming.kicks-ass.net> References: <20151017012811.GA18581@thinkpad> <20151017095651.GE3816@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Oct 19, 2015 at 12:58:47AM -0700, Stephane Eranian wrote: > Peter, > > On Sat, Oct 17, 2015 at 2:56 AM, Peter Zijlstra wrote: > > > > 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. > > > I am assuming that is the checker detects something suspicious there is likely > a problem. > > Take for instance: > perf_cgroup_sched_out()->perf_cgroup_from_task() ->task_subsys_state() > > That one fires the checker. I think because we are accessing the css > state without > protection. > > The other places are similar. But perf_cgroup_attach()->perf_cgroup_switch() takes ctx->lock(). Therefore; if you hold ctx->lock, the cgroup is pinned. And the above sequence very much holds ctx->lock. Right? So it looks to me that we should teach perf_cgroup_from_task() about ctx->lock or something.