Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp130833imu; Mon, 26 Nov 2018 08:50:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/8sWpCNeGY5DcBqMIKR6/jS3PWRBTFnJyXHUbSiXbqDGSw/xzWANSQkK9pPPI42Iyrxa2 X-Received: by 2002:a62:9913:: with SMTP id d19mr23618758pfe.107.1543251008667; Mon, 26 Nov 2018 08:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543251008; cv=none; d=google.com; s=arc-20160816; b=hbtHGjQyLhSGLb+XgkQsreQSZ+l2pBWVoPvx07Li5YqswdnvO77tDG/zBqb86ItD3C p7GnuruJ04uKd06uU/snZlpYScxAOwseZSU1+n/MX5dt8JmgU5NOre6UVe+3MLEzdYfx s3prwlhat2wg8rvx/34mnIftInjqOsTnl54PXbpGlSgiBGeOxm5VHUfG/tVNolakIjHr ZmZlAyRFPHt1SnC0Bmbd1UZr1UQeMgnfDpc0Yb2l66kZSrNTsuwVufIs4aCiekpNPQpR bZnHxfl1IU/QZJ1fCVsYlIGsKedRkj/4Y9LabK3ZU9OTiV6hERkYo0qov0tFUB8zm4Qw 2NIQ== 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:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=voQZBGSCPwDuHbNWjRsaXWRQKOMCpB1zqAx9MYJffnY=; b=vlqCcp62mCDg1DAkXf1QGNutY/ccIwA6wNhd98c4IpFyON8TP/goDUMEv6GICJGwso ZwSR9PbL/peGYNH6jBIuBNL+s7WVBx18iNP/3Vtgbygd8FsvUGvUt1MslwIX9wH6XL3V Hutgzl0YNyZA2jL5gNuJgm1JNDkM3loOwq6HJM5nbEF/jeIjoKwND37lJ6EM+PLfaeeE lW/20g6s/06+h9ZVzSto7lIe3xeiYwiSpJ7ObUbM6+6WN0RA1ZBcJANCy0eYy7QBuQSb haGMFbJNTjVJ9bhGWNIfLtrYwsLkqc2lZ/DWV5IqFbmJifd3QibNwYQsBq4MGMS8fIrJ nbgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Paex8Nks; 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 p187-v6si803323pfb.127.2018.11.26.08.49.39; Mon, 26 Nov 2018 08:50:08 -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=@sifive.com header.s=google header.b=Paex8Nks; 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 S1726548AbeK0Dm2 (ORCPT + 99 others); Mon, 26 Nov 2018 22:42:28 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46925 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbeK0Dm2 (ORCPT ); Mon, 26 Nov 2018 22:42:28 -0500 Received: by mail-pg1-f196.google.com with SMTP id w7so6406368pgp.13 for ; Mon, 26 Nov 2018 08:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=voQZBGSCPwDuHbNWjRsaXWRQKOMCpB1zqAx9MYJffnY=; b=Paex8NkstvwA6QTMcr+LG7SaixSZzZFE1I0a94fM/xlOL42hBira7rtyHSTD1XJtS8 lfgPqKZHCRfdpmBunQzVfwfTP5qdifhYHgkV/7G3M3LqqH/Gh5maBlLyuCxrUTDvneud MOsR3vdIfWXU39Q1nVx1POyS/lz5fNCfj6JXZSsmOAycAb6MMCMHfwQ6CdzAISG13ddI 43fIipXpmBMtu1fOv5UrC5yZFXYirRsVtiPaa60OcAo30Osc/aDklqc7nAK8vQaSRw3A uzua3wH8xgJn95ONa1/8Y4gl6EQD+6dimnvkdjpuik145xhgD5xHlobZZkxSsm22VjlB xyHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=voQZBGSCPwDuHbNWjRsaXWRQKOMCpB1zqAx9MYJffnY=; b=U42KHoe5I3alcdeeznqzlrhfmtioEyqAX3BeNoDRLH21o+2KX6BXbZlsRjhnXTCeXJ io8Ofbyez6AeZUY7MIQVDoKOTUcXAtdhPpE91JHwosfoEWJTH2hsPDMNQ07yvAZOD8s2 F6cUqU7eq1SQRLahGy4WQNq1zJ2T3SUcBCeQJtFm8I+OkFl4wueniUzLOpWEtuqtYY5Z /jroSx9d+ZVjBzH5MDuEawR8QpG6ghClMIz2uRxvPITdqkwF5gL8TU8NzBr48+zu9Od6 ubN1R8VDuiqcnGEtYSVnTN+OFfTqW6QJi64mjIh45SVBnvxNYz9oW1QuN3xtktsqtKfr P6eg== X-Gm-Message-State: AA+aEWZ6abgLrwa6MbM2+0HMTVWOAFiz1o0PU7VEesdD335AJHqQxPhr VDYoMsFBZ5Z7OR/TG0zGQjk2vXPr5J0= X-Received: by 2002:a63:24c2:: with SMTP id k185mr24942674pgk.406.1543250868232; Mon, 26 Nov 2018 08:47:48 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id l184sm1399081pfc.112.2018.11.26.08.47.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 08:47:47 -0800 (PST) Date: Mon, 26 Nov 2018 08:47:47 -0800 (PST) X-Google-Original-Date: Mon, 26 Nov 2018 08:47:42 PST (-0800) Subject: Re: [for-next][PATCH 10/18] riscv/function_graph: Simplify with function_graph_entry() In-Reply-To: <20181122003332.793493004@goodmis.org> CC: linux-kernel@vger.kernel.org, Linus Torvalds , mingo@kernel.org, akpm@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, linux-arch@vger.kernel.org, joel@joelfernandes.org, mhiramat@kernel.org, jpoimboe@redhat.com, luto@kernel.org, frederic@kernel.org, greentime@andestech.com, alankao@andestech.com, stable@kernel.org From: Palmer Dabbelt To: rostedt@goodmis.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Nov 2018 16:28:11 PST (-0800), rostedt@goodmis.org wrote: > From: "Steven Rostedt (VMware)" > > The function_graph_entry() function does the work of calling the function > graph hook function and the management of the shadow stack, simplifying the > work done in the architecture dependent prepare_ftrace_return(). > > Have riscv use the new code, and remove the shadow stack management as well as > having to set up the trace structure. > > This is needed to prepare for a fix of a design bug on how the curr_ret_stack > is used. > > Cc: Greentime Hu > Cc: Alan Kao > Cc: Palmer Dabbelt > Cc: stable@kernel.org > Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback") > Signed-off-by: Steven Rostedt (VMware) > --- > arch/riscv/kernel/ftrace.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > index 1157b6b52d25..c433f6d3dd64 100644 > --- a/arch/riscv/kernel/ftrace.c > +++ b/arch/riscv/kernel/ftrace.c > @@ -132,7 +132,6 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, > { > unsigned long return_hooker = (unsigned long)&return_to_handler; > unsigned long old; > - struct ftrace_graph_ent trace; > int err; > > if (unlikely(atomic_read(¤t->tracing_graph_pause))) > @@ -144,17 +143,8 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, > */ > old = *parent; > > - trace.func = self_addr; > - trace.depth = current->curr_ret_stack + 1; > - > - if (!ftrace_graph_entry(&trace)) > - return; > - > - err = ftrace_push_return_trace(old, self_addr, &trace.depth, > - frame_pointer, parent); > - if (err == -EBUSY) > - return; > - *parent = return_hooker; > + if (function_graph_enter(old, self_addr, frame_pointer, parent)) > + *parent = return_hooker; > } > > #ifdef CONFIG_DYNAMIC_FTRACE Reviewed-by: Palmer Dabbelt