From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965412AbbJ0UYJ (ORCPT ); Tue, 27 Oct 2015 16:24:09 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35578 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965383AbbJ0UYH (ORCPT ); Tue, 27 Oct 2015 16:24:07 -0400 Message-ID: <1445977445.7476.52.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH v2] perf/core: fix RCU issues with cgroup monitoring mode From: Eric Dumazet To: Stephane Eranian Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com, edumazet@google.com, acme@redhat.com Date: Tue, 27 Oct 2015 13:24:05 -0700 In-Reply-To: <20151027192526.GA32018@thinkpad> References: <20151027192526.GA32018@thinkpad> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- Instead trusting caller to provide correct 'safe' boolean, what about using lockdep_is_held() ? This way, you keep full lockep support. A random example is #define rcu_dereference_rtnl(p) rcu_dereference_check(p, lockdep_rtnl_is_held())