Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3798762ybv; Mon, 10 Feb 2020 06:37:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxnXbe5gdQ9a1TshQ5eRlhltd91N17YmzETFz+R8utIZkr5PmCTxWSTtZs0sgrOnV0KKY+F X-Received: by 2002:a05:6808:ab1:: with SMTP id r17mr960708oij.141.1581345435785; Mon, 10 Feb 2020 06:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581345435; cv=none; d=google.com; s=arc-20160816; b=E2RaGoIqmoqXoR+AtLGvSk+n1HRtzuxARFS5RueFNOnXAKV79jQ6uVigqS6PT5YkG6 kpYWJ8Sh8n4mijmfNmH1XnfUKM0Dk8UR8Xz9spLwHvxsXWHiHlpCNryalnnJmPLN0CcA 0RlaOFwWcxjhoi7rxbVJIpZFItPp+8lCSJhy/rDqOPhUhYw03mI6Na9TZCKgMVzzsz76 wknXh0lPBfdImX8QJzohlpi0DDyamR2tsltAi5WcNGq6cubkON8apQrriOa8C7DKVGet guLezkQBqZzVM+8ORbz2LCHmJNxBYFTJt7K6aSByn8GWeX+5fnJroX4R2/zm6yQL+/dd K2Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=sw8aLoMN7edQi9tCuvhNl/iVTODc75PkGH73eAqI96U=; b=ZGHTiF9COs9KCZtcnz7ANyS6/IDSYS4l91umIP/fw7iaCozh4LgfLPAwxpNhGZYBu+ vEI+o0Lg+vDRio9pGWC19ll5uDB/UXqDk1l5gpDPRC73VBdKaCuna5pzQTuEgLpOXgSL 6AvJC0M24vZRlCf6L5Kes2l6QiXfrtMt763LGQODZ/bD9kJULZE5N7iSBHKoM49CrkX+ DOak+/Hmpl/fD0ybzSWX3n42mX656Q2hgmPq97qS3mvOz1EZ317mxIdGATaBTzwbTLeb Mkdyvuiq65qoIWziXIqZFJJQQi1LKLCTw6ut01/5JkdR24HseJVuaH17IYdrpkLuJyhq QZXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=jkUs4hzN; 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 k15si250713oij.134.2020.02.10.06.37.03; Mon, 10 Feb 2020 06:37:15 -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=@joelfernandes.org header.s=google header.b=jkUs4hzN; 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 S1727830AbgBJOgc (ORCPT + 99 others); Mon, 10 Feb 2020 09:36:32 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:44880 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727598AbgBJOgc (ORCPT ); Mon, 10 Feb 2020 09:36:32 -0500 Received: by mail-qv1-f68.google.com with SMTP id n8so3234900qvg.11 for ; Mon, 10 Feb 2020 06:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sw8aLoMN7edQi9tCuvhNl/iVTODc75PkGH73eAqI96U=; b=jkUs4hzNPVCxprNaYv/MX6zJKcph8mNHMTtg4GPspg617lRSe8FqvFZb+o6DjOVQrr 37PLeSeLutY7XJ9bF9R8p8fkpRVR1+dbJ/xoFkZpdtBhUjgQ8XP3/erYccm80CSIsQOt HdrE0hqNGzxMN1RMnvutju/NJGpV26qWRmjJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sw8aLoMN7edQi9tCuvhNl/iVTODc75PkGH73eAqI96U=; b=GZXvwHtcbScpDKEf0BVO1E2gSTu3952LhQx7OktedyQ5gqoH0Vh7ZScruIUzKsfAiO k2pKFBrblGOXYPFjA8cfBnKAsSRCigZHGAx+qdtl0vrZFhwyxSlF3FPYiH52Y6arjJiu gMvBzaaItBk67WRaWTc8s5GbbQ2wTYgCpm2pILfwC97C+NXujhG/YGZ/LkJa5AvO2Fy3 ABLRk700kVVCx4E+kuzI9cknSRzjmBsvyS3Owvy2xRlSaCK+G8XebL1j6zWd0a9MAOj1 XJa5NAJJ2q8qSLpXBKb+JDPcHPvxUX1wtKwvo++tWOcUOfwnru6cfVzMrBtIMEQXjoMP 4ijQ== X-Gm-Message-State: APjAAAXuSXFHrGqaWV0TK5hK16NpRoYK+J4ECF+vFENN0sLiPA1qDDwl zMekwtkdZCs4ptySVUacTVSKmptefsGNQBQMz7IQpw== X-Received: by 2002:a0c:f685:: with SMTP id p5mr10354179qvn.44.1581345391131; Mon, 10 Feb 2020 06:36:31 -0800 (PST) MIME-Version: 1.0 References: <20200210122423.695146547@linuxfoundation.org> <20200210122438.674498788@linuxfoundation.org> In-Reply-To: <20200210122438.674498788@linuxfoundation.org> From: Joel Fernandes Date: Mon, 10 Feb 2020 06:36:20 -0800 Message-ID: Subject: Re: [PATCH 5.5 150/367] tracing: Annotate ftrace_graph_hash pointer with __rcu To: Amol Grover Cc: LKML , Greg Kroah-Hartman , stable , "Steven Rostedt (VMware)" , Sasha Levin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 4:40 AM Greg Kroah-Hartman wrote: > > From: Amol Grover > > [ Upstream commit 24a9729f831462b1d9d61dc85ecc91c59037243f ] Amol, can you send a follow-up patch to annotate ftrace_graph_notrace_hash as well? - Joel > > Fix following instances of sparse error > kernel/trace/ftrace.c:5664:29: error: incompatible types in comparison > kernel/trace/ftrace.c:5785:21: error: incompatible types in comparison > kernel/trace/ftrace.c:5864:36: error: incompatible types in comparison > kernel/trace/ftrace.c:5866:25: error: incompatible types in comparison > > Use rcu_dereference_protected to access the __rcu annotated pointer. > > Link: http://lkml.kernel.org/r/20200201072703.17330-1-frextrite@gmail.com > > Reviewed-by: Joel Fernandes (Google) > Signed-off-by: Amol Grover > Signed-off-by: Steven Rostedt (VMware) > Signed-off-by: Sasha Levin > --- > kernel/trace/ftrace.c | 2 +- > kernel/trace/trace.h | 9 ++++++--- > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 9bf1f2cd515ef..959ded08dc13f 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -5596,7 +5596,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 __rcu *ftrace_graph_hash = EMPTY_HASH; > struct ftrace_hash *ftrace_graph_notrace_hash = EMPTY_HASH; > > enum graph_filter_type { > diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h > index 63bf60f793987..97dad33260208 100644 > --- a/kernel/trace/trace.h > +++ b/kernel/trace/trace.h > @@ -950,22 +950,25 @@ extern void __trace_graph_return(struct trace_array *tr, > unsigned long flags, int pc); > > #ifdef CONFIG_DYNAMIC_FTRACE > -extern struct ftrace_hash *ftrace_graph_hash; > +extern struct ftrace_hash __rcu *ftrace_graph_hash; > extern struct ftrace_hash *ftrace_graph_notrace_hash; > > static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) > { > unsigned long addr = trace->func; > int ret = 0; > + struct ftrace_hash *hash; > > preempt_disable_notrace(); > > - if (ftrace_hash_empty(ftrace_graph_hash)) { > + hash = rcu_dereference_protected(ftrace_graph_hash, !preemptible()); > + > + if (ftrace_hash_empty(hash)) { > ret = 1; > goto out; > } > > - if (ftrace_lookup_ip(ftrace_graph_hash, addr)) { > + if (ftrace_lookup_ip(hash, addr)) { > > /* > * This needs to be cleared on the return functions > -- > 2.20.1 > > >