Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8101605imu; Tue, 4 Dec 2018 03:02:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wi9ukv27G906S4CONL6ZG0GW5edjU4ZI+qNuQYON5vJ8WkRXNMthVBSISQUHmO0dqcfEnE X-Received: by 2002:a65:48c4:: with SMTP id o4mr15816302pgs.371.1543921352881; Tue, 04 Dec 2018 03:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921352; cv=none; d=google.com; s=arc-20160816; b=SA280Hz9AxxjJbXTIVLG4OabQRFU4bKXkkMhHT/mvvNFYTYTQCRSi8eJWKoBhhY1r4 l/bhz3WC4UeE8gkJ0pqan1QPERgR9XGZ0M6G5Q7LJrgQmS8sVXZvVtzMsii2jvZi2JVQ XiZslJ6B6f3lYSLvvC3rqCDnR1kl9y/+ViMpckDrrC1lOPD6tUjD3pKBNIAMAbcYJtJS WQMAeyDFEuYXdQzpeIneF6H2FdExk1yEI3w7MGtRifNF6X1PGVCeNGxZCOGDgJbZMEn4 kcbps7xXDELKoj941sZhwUpXV0OLkG+PXSrq+5vgJTaAtX8/U5sw4N+TLJsqhTWUQ8eD vrvA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eeVSPokdu7rmPA6p5WoQMsO00RU2tGwIzzNK+fkSZ/s=; b=eBCXfLf+2fhd6C2+UwSeCXF0HJa2lOnm6V5qKKBzYy+5Ku9qhZUL3dtrh2QYXs55H2 ajMVUuzo4jPYSSN4jGCSVwnFSxH3P/C3CkJOEnj1UpNSgTj/imSaWBih0Sy1ATrkvnge +Rr8QOOrxQP6BuDnYmhUh7JqiUZF6YgfJHfFQXVACQwSknwO+AHulJpXvVBbmxL40mv4 SwxaubfRlIpTkwj8w+EUqMkyNs2XZeVALvO4bDSzoasB6yLeUiYMX7D9tjbs70WxiP77 JvEe5g09J7uhf/5KqgFn/9SuNlWGDY6UO0IPKxKBjVv+cD2qQr81QVVak4P/FATS/ymp a0GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ytHwPkWE; 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 h16si15120347pgj.203.2018.12.04.03.02.17; Tue, 04 Dec 2018 03:02:32 -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=@kernel.org header.s=default header.b=ytHwPkWE; 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 S1726801AbeLDK7n (ORCPT + 99 others); Tue, 4 Dec 2018 05:59:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:44632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbeLDK7k (ORCPT ); Tue, 4 Dec 2018 05:59:40 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 E17542087F; Tue, 4 Dec 2018 10:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921179; bh=rvDwJBwKE4jaHTdbpyWFnbkKBHR+ghP/r6U2bHMk2kQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytHwPkWEjI90BRsTHvBzPrN2UYBaK+NvwxhCA+088cLKYtKmV3b4mKT6nKLJCPf44 yyJ5mQCV1FeON3pO4uffgJ6xCsmH+avoCCITm0BKL/pT8c4s7y2f4+nQYJvSy72Zxz OS+QlFaH7Oy5BGsoBsu3kLp4RQ27PwWfMhVwfWuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ralf Baechle , Paul Burton , James Hogan , linux-mips@linux-mips.org, stable@kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 110/139] MIPS: function_graph: Simplify with function_graph_enter() Date: Tue, 4 Dec 2018 11:49:51 +0100 Message-Id: <20181204103655.111327626@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt (VMware) commit 8712b27c5723c26400a2b350faf1d6d9fd7ffaad upstream. The function_graph_enter() 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 MIPS 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: Ralf Baechle Cc: Paul Burton Cc: James Hogan Cc: linux-mips@linux-mips.org Cc: stable@kernel.org Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback") Reviewed-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/ftrace.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c @@ -322,7 +322,6 @@ void prepare_ftrace_return(unsigned long unsigned long fp) { unsigned long old_parent_ra; - struct ftrace_graph_ent trace; unsigned long return_hooker = (unsigned long) &return_to_handler; int faulted, insns; @@ -369,12 +368,6 @@ void prepare_ftrace_return(unsigned long if (unlikely(faulted)) goto out; - if (ftrace_push_return_trace(old_parent_ra, self_ra, &trace.depth, fp, - NULL) == -EBUSY) { - *parent_ra_addr = old_parent_ra; - return; - } - /* * Get the recorded ip of the current mcount calling site in the * __mcount_loc section, which will be used to filter the function @@ -382,13 +375,10 @@ void prepare_ftrace_return(unsigned long */ insns = core_kernel_text(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; - trace.func = self_ra - (MCOUNT_INSN_SIZE * insns); + self_ra -= (MCOUNT_INSN_SIZE * insns); - /* Only trace if the calling function expects to */ - if (!ftrace_graph_entry(&trace)) { - current->curr_ret_stack--; + if (function_graph_enter(old_parent_ra, self_ra, fp, NULL)) *parent_ra_addr = old_parent_ra; - } return; out: ftrace_graph_stop();