Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp708349imu; Thu, 22 Nov 2018 04:15:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/WfFAge6JVPvxRL7RRpqQkpgX+lyatxycGsa+Hf9+9bBYZegIFiGv6/dy/RkbZjzzkeagY7 X-Received: by 2002:a17:902:50e:: with SMTP id 14mr2996983plf.141.1542888957744; Thu, 22 Nov 2018 04:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542888957; cv=none; d=google.com; s=arc-20160816; b=h9MJiIPQZGgayr9xh96l4BgQcMTx1TTiMEg0YXglRO8CR0JRkawgcz9cFgOB/Rpqgo 6T5kMSRZ6o60EIypIPwpsr4GyS4I/LT0uPXZ/HRe31H4mwKJ2sk5JI9FBjgb6f5vG9m8 4z9HyyLu9szxgAEMFEUHnQB0AQhmdBZtSXrmzn4rQ3agfEXqxulr+hDlmjS4yiwHLOKJ UPJ7UhRXbrJ1qcvHRfq3EYwkm5x5DcVH/1CjrorRdwVIwKNEKtsu87m1rwJvyIjHUKSO 1DTfood86545kmwVcw8t8fzyGKZi069t7jFJQQ3eb574NvpwJWPzzj6AqKVXVZClAvgr q+Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=FKMogjYbPuPbgjUbXdpZYqapr0JnqvhaxzKVUEEzX+A=; b=sXz3S/RlvyMbbKavHSgLVraEDUy0iZXLqV6z/inPeUC5lE4CHlV2KEg9+tWCEDhQ3H h6JFVvrOg99mPYJ4UBsnD27g6mxOWrHwBR47eY7DJdam2w4JMbxc7rVcOYMD0ohVgUzH jngiC8NRblIweqiQz6oG7RpJ8b0D6Ayo+RAIACe3nO33zFmCyvGTy8DgP420qmYrxupK 4dhWyFplHVIBg0ZFtmWx9LCSN25624Yt59pw98DQT5bkFi+dwPj5o0HX4+CZYUXXlos6 5u9vn2V8PBC2MFZ1zTYZE7Zi2kgtKFd+xAKSoKMTXlPhKQn5mr7eJuEJp3nrMGGWP8Uo DJBg== ARC-Authentication-Results: i=1; mx.google.com; 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 b4-v6si53994836pla.189.2018.11.22.04.15.24; Thu, 22 Nov 2018 04:15:57 -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; 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 S2390987AbeKVLKX (ORCPT + 99 others); Thu, 22 Nov 2018 06:10:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:47712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390877AbeKVLKT (ORCPT ); Thu, 22 Nov 2018 06:10:19 -0500 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5793214E0; Thu, 22 Nov 2018 00:33:33 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.91) (envelope-from ) id 1gPcw0-0004UM-Sq; Wed, 21 Nov 2018 19:33:32 -0500 Message-Id: <20181122003332.793493004@goodmis.org> User-Agent: quilt/0.65 Date: Wed, 21 Nov 2018 19:28:11 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , linux-arch@vger.kernel.org, Joel Fernandes , Masami Hiramatsu , Josh Poimboeuf , Andy Lutomirski , Frederic Weisbecker , Greentime Hu , Alan Kao , Palmer Dabbelt , stable@kernel.org Subject: [for-next][PATCH 10/18] riscv/function_graph: Simplify with function_graph_entry() References: <20181122002801.501220343@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.19.1