Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1210303imm; Wed, 11 Jul 2018 20:14:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfKX/jOIWwsJ+rLBgblBWb4ir7CxCdukXr+1UT7uVtt1a112WnqY1TTE7d6kbvS0C1bI6ZU X-Received: by 2002:a63:6743:: with SMTP id b64-v6mr458334pgc.91.1531365254195; Wed, 11 Jul 2018 20:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531365254; cv=none; d=google.com; s=arc-20160816; b=O5DRvPFCVf4EkdzYUanNGCsgixHVKjXkawXJuF4ziyOi6qvPw67fqh/3+7sCVtyt2r yGb7aLzFElI7JyLCLv6pCpAwSRr9AHGty9sjvH4k+UEH4tyVeuDpD6WOOmKoZglDwNBM vvfbW2aIKlQIqKCVIH0uYaa1Mp18K+Di96p+XiG4ZpluVrxy8zR0B57+AfNiAZp3iirQ uda7D+Fy0TI+RBdRPtuY8YGjBmox0UJameuzVBGmwRVVBTR8InpFUVmBFtyoFVWmH17z HHlefyzScCWth1IWt9B08BqbJT4XVatpYzFo3zEJCJKdQz0HFLjLeLk1vYjRxBpahMeR g0dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=2ys+0VIScvXFlw57RU/DTxKZ1PGYl/lavqc8LpndOYE=; b=Dma3rCe+OBwEvSwicF6zboXwUJ0wEnr2yelp472hFO8zskqMeHuUfr8gQSVhhxDGfX gTvilNitY27dg3XoPeVxrTNs/DXr8Efs9JZYsMW1XCJUG9gY9G86LqXkTwQuzcgx1dg3 Cxz2ihg9H19hi/eveXFPL4YWFLJUTH+1pq7Wq+fFVd7GFcPahtiC1CzYjx1r8WyZ99zq KkMnjDWONTPCx1vhLaPqcm0Rdfqkl9WFaYPJvRAMKY7lKlCL0lgMaUdPQGswn/VIabXd YMFb5BjVWxDO8+V1EVgIOHsbhxmwdVLZbEx5UBDc3bsVBZE83QP4lqkwBdFI1eyxgrHj /YWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Vgz6TWCY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si19119247pgl.568.2018.07.11.20.13.59; Wed, 11 Jul 2018 20:14:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Vgz6TWCY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391341AbeGLCmn (ORCPT + 99 others); Wed, 11 Jul 2018 22:42:43 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:46111 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387702AbeGLCmn (ORCPT ); Wed, 11 Jul 2018 22:42:43 -0400 Received: by mail-pf0-f196.google.com with SMTP id l123-v6so19617918pfl.13 for ; Wed, 11 Jul 2018 19:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2ys+0VIScvXFlw57RU/DTxKZ1PGYl/lavqc8LpndOYE=; b=Vgz6TWCY1V5tQ9/cug8jbbYEGhJ4ceQrCNAtWf1SNSdnltDNv0nlx2AdE2FMJ9Xk3g ylOwqoO4/JLwAmSI+7i3al/2DegbyNXsYsYD1GCtrGNkg1z4XgIRSsxt+80SqezUxon+ 0YibtVvl7d7qAgb81FoJG5DkM3a8UfRdrX+8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2ys+0VIScvXFlw57RU/DTxKZ1PGYl/lavqc8LpndOYE=; b=RbTg9D6sut3rSJbm+zPxLROZRh7FBHCznvu7PFi0SJjcpkTa3487DlwlzU9FVwWBUD q1wlz7tLgGdOqVGMSO+TGsrCGqZnXK9FJ8sRvS5Fk7i6CMW66UWW1JqSPDtzE8MdedXi anyg+7BtfOIV4sraA2WzEYXmJmvihh8mxO5fkAUtwrEiHOPSWNV4zs9GgVPZlWX5NYM3 xs0NOQjsoBoxZlc8t/P55Yi8OyeTuuxRGVGwEcmuqhwLOLRGw7+1ZWEzwfJk+iJ8q3ZQ +Sr2EGRa3GK47J+ZeVtvOi3ujQsvmCCfTRyV/05/7ziyCDbcf/BIwRI7kHWVkK9YNSf/ wO1A== X-Gm-Message-State: AOUpUlE7y3Jk7kyM/nQdnrHqDJrS8C8LlOyXgTlvVxUfEi91JPLWnwSa 6+FHn7H+CM67drb9KkgvbnMrCA== X-Received: by 2002:a62:e106:: with SMTP id q6-v6mr413446pfh.75.1531362926895; Wed, 11 Jul 2018 19:35:26 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id e82-v6sm52228441pfd.40.2018.07.11.19.35.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 19:35:26 -0700 (PDT) Date: Wed, 11 Jul 2018 19:35:25 -0700 From: Joel Fernandes To: Steven Rostedt Cc: "Paul E. McKenney" , Peter Zijlstra , linux-kernel@vger.kernel.org, Boqun Feng , Byungchul Park , Ingo Molnar , Julia Cartwright , linux-kselftest@vger.kernel.org, Masami Hiramatsu , Mathieu Desnoyers , Namhyung Kim , Thomas Glexiner , Tom Zanussi Subject: Re: [PATCH v9 4/7] tracepoint: Make rcuidle tracepoint callers use SRCU Message-ID: <20180712023525.GB122777@joelaf.mtv.corp.google.com> References: <20180628182149.226164-1-joel@joelfernandes.org> <20180628182149.226164-5-joel@joelfernandes.org> <20180711124954.GE2476@hirez.programming.kicks-ass.net> <20180711090003.42596c2b@gandalf.local.home> <20180711142744.GN3593@linux.vnet.ibm.com> <20180711104618.05dc4b46@gandalf.local.home> <20180711151559.GR3593@linux.vnet.ibm.com> <20180711205639.GB32091@joelaf.mtv.corp.google.com> <20180711212237.3eff418f@vmware.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711212237.3eff418f@vmware.local.home> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 09:22:37PM -0400, Steven Rostedt wrote: > On Wed, 11 Jul 2018 13:56:39 -0700 > Joel Fernandes wrote: > > > > > #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ > > > > extern struct tracepoint __tracepoint_##name; \ > > > > static inline void trace_##name(proto) \ > > > > { \ > > > > if (static_key_false(&__tracepoint_##name.key)) \ > > > > __DO_TRACE(&__tracepoint_##name, \ > > > > TP_PROTO(data_proto), \ > > > > TP_ARGS(data_args), \ > > > > TP_CONDITION(cond), 0); \ > > > > if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ > > > > rcu_read_lock_sched_notrace(); \ > > > > rcu_dereference_sched(__tracepoint_##name.funcs);\ > > > > rcu_read_unlock_sched_notrace(); \ > > > > } \ > > > > } > > > > > > > > Because lockdep would only trigger warnings when the tracepoint was > > > > enabled and used in a place it shouldn't be, we added the above > > > > IS_ENABLED(CONFIG_LOCKDEP) part to test regardless if the the > > > > tracepoint was enabled or not. Because we do this, we don't need to > > > > have the test in the __DO_TRACE() code itself. That means we can clean > > > > up the code as per Peter's suggestion. > > > > > > Indeed, the rcu_dereference_sched() would catch it in that case, so > > > agreed, Peter's suggestion isn't losing any debuggability. > > > > Hmm, but if we are doing the check later anyway, then why not do it in > > __DO_TRACE itself? > > Because __DO_TRACE is only called if the trace event is enabled. If we > never enable a trace event, we never know if it has a potential of > doing it wrong. The second part is to trigger the warning immediately > regardless if the trace event is enabled or not. I see, thanks for the clarification. > > > > Also I guess we are discussing about changing the rcu_dereference_sched which > > I think should go into a separate patch since my patch isn't touching how the > > rcuidle==0 paths use the RCU API. So I think this is an existing issue > > independent of this series. > > But the code you added made it much more complex to keep the checks as > is. If we remove the checks then this patch doesn't need to have all > the if statements, and we can do it the way Peter suggested. Yes, I agree Peter's suggestion is very clean. > But sure, go ahead and make a separate patch first that removes the > checks from __DO_TRACE() first if you want to. No its ok, no problem, I can just do it in the same patch now that I see the code is much simplified with what Peter is suggesting. thanks! - Joel