Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp299489ybv; Tue, 4 Feb 2020 21:58:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwRBZaHPwiH17AtHSLreZ/y9gcxuwH3DoM1zZBjscsZ+cmNAFTtaw0F6gPFZqA4QjqJizRi X-Received: by 2002:a9d:370:: with SMTP id 103mr19700883otv.103.1580882323402; Tue, 04 Feb 2020 21:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580882323; cv=none; d=google.com; s=arc-20160816; b=TvtdP1XCOgalq+s8j+lUl0lFmzVurQ9u6Vh1yJQC3ftny/tIdFCptdyHzVa+QG1SKI 1V8jXAdm5TfgRIo9ilfXcxpFGYwZKTOAVFINZj5VeDOgLXPtc8dayXo6PtRhMs3Lnoux D9NyeY7WKXOsP4byY97vyMVPy5SH3BrZBQaXXn4Xy5spiMJziALK7aaoGYtgvyM9GBr3 nN27KHOmGq0LGE1Ib3Rn1b4lV4kab1iCm4WTFjKGvnC9T6uA6TuKdXWgMxnACVS2JT8C AqRUIM2dhz+4IEx+ZCJ5/3/FriKQgFL0nftHB51Ak7peY72/HrIqDzP+qRwvjOCOCJxp 3Tgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Osd6lHNiwt4HuEIAx7RCd4aai13f+0kkBfeOhTavDQg=; b=Kcwrcs/xB862LJahG+eADCicnot6BVBbMm6qUxdQlBBoqWryy7wfFH4x1/hSw1EY6a Qfa7L1a3xT8IvJDPTj4hziOpp8hmMXyTRGIVfyMTtI6Qu92R9duczgEWnC/NZ3Tqidgu BcyMMnkQsLbcT2mB8vdvUy8/itLkk6le3ZrahHRNO/JDHZc4iKpgYNlf5Taz5m4SgAcI ZaTemsFBFPh1B475h5m27vPQEmz8RU+u2xtxSTXEw67pz+GydHVGdns9r0UCa/SjD0fC T7xd5kLIpQN1XNLdqXgHBlQqPchbW4Dbp85jVsC3qNHcNmQ+dPpF0Z8t9fy2tH6C/7eb CqeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="O8qKu8Z/"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si11096021oie.87.2020.02.04.21.58.25; Tue, 04 Feb 2020 21:58:43 -0800 (PST) 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=@gmail.com header.s=20161025 header.b="O8qKu8Z/"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbgBEF5b (ORCPT + 99 others); Wed, 5 Feb 2020 00:57:31 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:37112 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbgBEF5b (ORCPT ); Wed, 5 Feb 2020 00:57:31 -0500 Received: by mail-pj1-f66.google.com with SMTP id m13so502425pjb.2 for ; Tue, 04 Feb 2020 21:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Osd6lHNiwt4HuEIAx7RCd4aai13f+0kkBfeOhTavDQg=; b=O8qKu8Z/sRwu52iIKxNhqY6g2mcLWqIgG91NDx4IdpOu08VotLQ426lk72n4tdkaQm Cf+1AUtw7WoMfyhXzI2Ak4cfUXD+fJgGGDm50IS+9g7KqWnlKNz/lffL0+SXgtJ02k4I yBtYeQE+aoC2a849fgvCGU0R4Tg+WhewEG8LfwJ3jN+KLM0QDyNVc6PDlR4BDiHFhYHq +19Lypn7J0SMvWsyuJle58aNP0ZuGZ1y6QhD70pIk0vGfTRSk1QZ7MCN5QpOyl5gY74X r7/3rpsf3Wz8pMgTtjnbtBudrs4Z1/MVS2C1qFYK0V5kIjrjgT2CoLNHhf8UBw3iM8Ag o00g== 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:mime-version :content-transfer-encoding; bh=Osd6lHNiwt4HuEIAx7RCd4aai13f+0kkBfeOhTavDQg=; b=gNgh9108fc4RH5OGk/ANB/ND+tE0ru1HUEo58uIsdQl6U6OPauaPCQIwxHbFtYsROx xMLcAryaEZXhcFNa+0TEqljHShdb+g93AbrxU22U+B7GSODnRPa5tMHaDiaLrk9kLtgy Pko88yDMkrHtHikDrNeSMqHsxt9AsoW44HhwDWT98baMOHFxZ5SPPIVA/phRh5LZXSR6 mN6xIAVVtn8yFJK8py9QVsCiEpPLddJa/HGQeiA0RLuxwFqf0hoxuLJzpiWz7/xZSVtY T4MsK07cB/woZq700NDhcDBuYKdfQqGz0ePklTlA9OjqZh7KNkWQbpHaGES4W2xqJ3ag ErcA== X-Gm-Message-State: APjAAAUCjEWZA68RRmI8IFxJR9zice7/jFdI646s0b50bgwZPAN8Xn3r 8pKPXpJpfEup3ECcxBJ6rfM= X-Received: by 2002:a17:902:d688:: with SMTP id v8mr34300061ply.238.1580882250911; Tue, 04 Feb 2020 21:57:30 -0800 (PST) Received: from localhost.localdomain ([103.211.17.109]) by smtp.googlemail.com with ESMTPSA id o29sm27152613pfp.124.2020.02.04.21.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 21:57:30 -0800 (PST) From: Amol Grover To: Steven Rostedt , Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH] tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu Date: Wed, 5 Feb 2020 11:27:02 +0530 Message-Id: <20200205055701.30195-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix following instances of sparse error kernel/trace/ftrace.c:5667:29: error: incompatible types in comparison kernel/trace/ftrace.c:5813:21: error: incompatible types in comparison kernel/trace/ftrace.c:5868:36: error: incompatible types in comparison kernel/trace/ftrace.c:5870:25: error: incompatible types in comparison Use rcu_dereference_protected to dereference the newly annotated pointer. Signed-off-by: Amol Grover --- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9bf1f2cd515e..3a310c0c3ae3 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5597,7 +5597,7 @@ static const struct file_operations ftrace_notrace_fops = { static DEFINE_MUTEX(graph_lock); struct ftrace_hash *ftrace_graph_hash = EMPTY_HASH; -struct ftrace_hash *ftrace_graph_notrace_hash = EMPTY_HASH; +struct ftrace_hash __rcu *ftrace_graph_notrace_hash = EMPTY_HASH; enum graph_filter_type { GRAPH_FILTER_NOTRACE = 0, diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 63bf60f79398..8c78bd6d53ca 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -951,7 +951,7 @@ extern void __trace_graph_return(struct trace_array *tr, #ifdef CONFIG_DYNAMIC_FTRACE extern struct ftrace_hash *ftrace_graph_hash; -extern struct ftrace_hash *ftrace_graph_notrace_hash; +extern struct ftrace_hash __rcu *ftrace_graph_notrace_hash; static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) { @@ -1001,10 +1001,14 @@ static inline void ftrace_graph_addr_finish(struct ftrace_graph_ret *trace) static inline int ftrace_graph_notrace_addr(unsigned long addr) { int ret = 0; + struct ftrace_hash *notrace_hash; preempt_disable_notrace(); - if (ftrace_lookup_ip(ftrace_graph_notrace_hash, addr)) + notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash, + !preemptible()); + + if (ftrace_lookup_ip(notrace_hash, addr)) ret = 1; preempt_enable_notrace(); -- 2.24.1