Received: by 10.192.165.156 with SMTP id m28csp1395689imm; Mon, 16 Apr 2018 21:10:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pZjaJy+4f6WkWNofB4fig34T83fyRZ/e2mVG0aiZEUft1v8gKZmvxIVWPpwAxlRcxkycO X-Received: by 2002:a17:902:4464:: with SMTP id k91-v6mr515142pld.219.1523938230493; Mon, 16 Apr 2018 21:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523938230; cv=none; d=google.com; s=arc-20160816; b=hYOlXo/LoEtR87c7H3+9xecsBGhIP5eWTDuRW0bhTl6Iw5f5omW9RVZuebWB+zyak/ 6sgqkcdnVIvFN/wBOHTsvx4QxJ01+BxQ9nzpNvJlXeLURXpdiwgCkblcHZobjuF0wVZr KVR+sOpOmlkOOd1GWBFdHtd3MHTy2zFcS20kRVEk4WD/Y2mVOaUN9qCFrsPnfHHn3pUR vvL1fTFsibfiJx9j7wP7cJxOk1KP+V9CQTphmyLOerumJ6y9jryLC28MZi3kW3xEvzy6 9PZf0CYOp5mCkPWB51YuZ/2U8inN5z7B1D10+uqXSt9Gt9oszqhbk3kKpKbouOjw3qqw 6S1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=GJq1mxEUJqWm/7mn8IJ6vS+8vwFq0wsvEkSW5xXh6NI=; b=jz2BkFTeEFr4n9N0mrjQJU80gYt9eSYLda1nPUPTsbmEBJx93/hS0MysWWzjuapcBV McML1k20WiQ8UGXA7Ko6cSEmTeG4h70nmJwlFtQ8Vws2Y1VWJ1iHQQj6XddsBf7d36YA XG8jYyylip+myG7XhwywzikVNJASwHiPQr14QDuLUYSE2bmFwuxDZGLtSl1LKh5Y4qIk tkaPxzFKoTp6yLkuYyC9KABsSqEoI1orYu2i3E4sxKwfpo3Bf+08CQoTVeywh+N2v8+d 0MM+EfLdRlb60uMAPQDBjrrSu9ChE77a6pRMqC8zO2GhUAS7OKJ5zrDVdccQy4CKCvfj 5tQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DdkwU57u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si2681106pgr.340.2018.04.16.21.10.16; Mon, 16 Apr 2018 21:10:30 -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=@google.com header.s=20161025 header.b=DdkwU57u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751256AbeDQEIP (ORCPT + 99 others); Tue, 17 Apr 2018 00:08:15 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37461 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbeDQEIL (ORCPT ); Tue, 17 Apr 2018 00:08:11 -0400 Received: by mail-pg0-f65.google.com with SMTP id r14so4808165pgq.4 for ; Mon, 16 Apr 2018 21:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GJq1mxEUJqWm/7mn8IJ6vS+8vwFq0wsvEkSW5xXh6NI=; b=DdkwU57uXdNzhpl/Vma+8fmWAg3jzW4vhPS4LKLe2ZBeSRyvLftrf9PL3TcPl23BQa s93xHNVFPpCs3oBWmEemcjQajav8H5Ix2g+i2GewXqVjGIazhAustC/Wi3Ct8gm+Kpa+ ykg3+gssTGM+JKlf+JeTgyPZAhQG3YwfCpazMCSVSiZj2Yyn90fhTedfrlLVH1xQSBb4 OsCs+xMvFWioLnxyExAfmdagb0/QysibEiOlls0CFxshLwbfa2DaVaT8tmM8JlE40cF2 oA3goGuAfMdiBrkFX4VF8AnfE2Hjj93EuxahC43+/erWlfwq34pvV5NLHJId6opKTArN YYeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GJq1mxEUJqWm/7mn8IJ6vS+8vwFq0wsvEkSW5xXh6NI=; b=KfO4SAGymayyaXleUO7BSmAbO4GdsjP1hlX55Va7xLctO6s0hUe2ImjeYQxoEG+SUo ZivI0F05qhAw+FChD1acRYlufp35Y/EZSImzhFIHfu8jkociVjaEU7K7mRtaYUmo0cgG Vc4m9XbumsIz5iDTjCKMXO+32DxWXvKuCP7xZvPL33tbozSjv6Ewt8akWI7MYIroXFA1 r4ukbDaWN4YhoB6WFIfS0p0Xbhb6GXBtf5MPipthzvk0ebpvTz1EXxGr0EXJvzs5HNdW VxHl7f8hMiDWjFQC6kB72s4O/4ifLIMt/vnHrQvE+wpe4SnCBDYNYbduzkNQZ0kTMqHs 5oKA== X-Gm-Message-State: ALQs6tBIveUMJy1678SLhKB7gxhs7G0kKA6d3TkljKAC7ldGANO8TgEv 6qg1UVLCMArU8ZeSJokGFilglMeKvyE= X-Received: by 10.98.31.200 with SMTP id l69mr512514pfj.49.1523938090600; Mon, 16 Apr 2018 21:08:10 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1611:2dd1:700f:d2f3:1711]) by smtp.gmail.com with ESMTPSA id j11sm23504686pgc.91.2018.04.16.21.08.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 21:08:09 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Cc: Joel Fernandes , Steven Rostedt , Peter Zilstra , Ingo Molnar , Mathieu Desnoyers , Tom Zanussi , Namhyung Kim , Thomas Glexiner , Boqun Feng , Paul McKenney , Frederic Weisbecker , Randy Dunlap , Masami Hiramatsu , Fenguang Wu , Baohong Liu , Vedang Patel Subject: [RFC v4 1/4] tracepoint: Add API to not do lockdep checks during RCU ops Date: Mon, 16 Apr 2018 21:07:45 -0700 Message-Id: <20180417040748.212236-2-joelaf@google.com> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog In-Reply-To: <20180417040748.212236-1-joelaf@google.com> References: <20180417040748.212236-1-joelaf@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series makes lockdeps use the trace irqs on/off tracepoints. Lets introduce an API where lockdep checks are not done so that we don't get false lockdep splats. This API introduction will not affect any of the existing users of the tracepoint API and the new call will only be used by the IRQs on/off tracepoints. Cc: Steven Rostedt Cc: Peter Zilstra Cc: Ingo Molnar Cc: Mathieu Desnoyers Cc: Tom Zanussi Cc: Namhyung Kim Cc: Thomas Glexiner Cc: Boqun Feng Cc: Paul McKenney Cc: Frederic Weisbecker Cc: Randy Dunlap Cc: Masami Hiramatsu Cc: Fenguang Wu Cc: Baohong Liu Cc: Vedang Patel Signed-off-by: Joel Fernandes --- include/linux/tracepoint.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index c94f466d57ef..0b6d7d1a16e2 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -119,6 +119,14 @@ extern void syscall_unregfunc(void); #ifdef TRACEPOINTS_ENABLED +#define LOCKDEP_CHECKS_ON(lockdep) \ + if (IS_ENABLED(CONFIG_LOCKDEP) && !lockdep) \ + lockdep_on(); + +#define LOCKDEP_CHECKS_OFF(lockdep) \ + if (IS_ENABLED(CONFIG_LOCKDEP) && !lockdep) \ + lockdep_off(); + /* * it_func[0] is never NULL because there is at least one element in the array * when the array itself is non NULL. @@ -129,7 +137,7 @@ extern void syscall_unregfunc(void); * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". */ -#define __DO_TRACE(tp, proto, args, cond, rcucheck) \ +#define __DO_TRACE(tp, proto, args, cond, rcucheck, lockdep) \ do { \ struct tracepoint_func *it_func_ptr; \ void *it_func; \ @@ -137,10 +145,14 @@ extern void syscall_unregfunc(void); \ if (!(cond)) \ return; \ + \ + LOCKDEP_CHECKS_OFF(lockdep) \ if (rcucheck) \ rcu_irq_enter_irqson(); \ rcu_read_lock_sched_notrace(); \ it_func_ptr = rcu_dereference_sched((tp)->funcs); \ + LOCKDEP_CHECKS_ON(lockdep) \ + \ if (it_func_ptr) { \ do { \ it_func = (it_func_ptr)->func; \ @@ -148,9 +160,12 @@ extern void syscall_unregfunc(void); ((void(*)(proto))(it_func))(args); \ } while ((++it_func_ptr)->func); \ } \ + \ + LOCKDEP_CHECKS_OFF(lockdep) \ rcu_read_unlock_sched_notrace(); \ if (rcucheck) \ rcu_irq_exit_irqson(); \ + LOCKDEP_CHECKS_ON(lockdep) \ } while (0) #ifndef MODULE @@ -161,7 +176,16 @@ extern void syscall_unregfunc(void); __DO_TRACE(&__tracepoint_##name, \ TP_PROTO(data_proto), \ TP_ARGS(data_args), \ - TP_CONDITION(cond), 1); \ + TP_CONDITION(cond), 1, 1); \ + } \ + \ + static inline void trace_##name##_rcuidle_nolockdep(proto) \ + { \ + if (static_key_false(&__tracepoint_##name.key)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(data_proto), \ + TP_ARGS(data_args), \ + TP_CONDITION(cond), 1, 0); \ } #else #define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) @@ -187,7 +211,7 @@ extern void syscall_unregfunc(void); __DO_TRACE(&__tracepoint_##name, \ TP_PROTO(data_proto), \ TP_ARGS(data_args), \ - TP_CONDITION(cond), 0); \ + TP_CONDITION(cond), 0, 1); \ if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ rcu_read_lock_sched_notrace(); \ rcu_dereference_sched(__tracepoint_##name.funcs);\ @@ -254,6 +278,8 @@ extern void syscall_unregfunc(void); { } \ static inline void trace_##name##_rcuidle(proto) \ { } \ + static inline void trace_##name##_rcuidle_nolockdep(proto) \ + { } \ static inline int \ register_trace_##name(void (*probe)(data_proto), \ void *data) \ -- 2.17.0.484.g0c8726318c-goog