Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8099728imu; Tue, 4 Dec 2018 03:00:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/X80w6QNEeVbO0vZUOC7dpB8BJOp/9PCxcCX4SdWmeYX+pRJBBg4jMb+jM1Psyku9+m/ckJ X-Received: by 2002:a63:d5e:: with SMTP id 30mr16344027pgn.54.1543921255401; Tue, 04 Dec 2018 03:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921255; cv=none; d=google.com; s=arc-20160816; b=ZOhEdWVb9RIXtsTEMapyJeYvYGkc40siBXOCiF+egj/ZeQHiB1IxWi2ZVf8D8mkO6m CzoaqGVcsRniveVjnrjBiqrM1/HEyAO2a7L2vqI7aPdOfso6+wg9Bb7A40H5gqyG1SR+ vtKVYfvf0yhotsFfg1/MEuoU3YpumhvyzWzMMsAYiWCGE59FTVm+EjCEW5HbYQEquABE PvFrutWabAnz7wNJLwfZHP6Dw+BxaRJ0ZhB73V0cSILyn3OwP3Sl+HJHXm1j10mjxWTl 2YLzB9sZbJ9Qs8/wR3a7dA69GinPiAvdfQVTc2lzqwqK/t7PGT1TdyN+JDx5Qb9B95J2 TSqg== 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=JBNBh5ILjFQxCZ02A5cfWh6YLQSXF6I6BlMAoDM5530=; b=xKSJbnqAFCcUCNgyAmPqrCh+/4TVFWxGT0G9Aow1TngttkpAdo0w8aYG8YMFlppOUo tv24Vz8zLKDT84meQJVarBL4LEIw0IYMVqIBk3Ymc786EASxvCqcIUYkBrjX16jVyeyo +tpU5lB7fy3AJrnp9hMne5oYAsa1bWDtWekV/iM9kA1wt88xj6JF2fXpjvkwNE/2C7ra bdJMZFJDluWPgwVeTwMXlEldM31VsD5D/TOxoHhT2gO8BiL8NiW8mqi9hc9auFtKNII6 WvoTlmKczDMmJoX5cQFIh7kM7zCJSv1bBDhr3ZxG7aCBlPaOihkqjK6vWmqC+hhoZSPb 1WRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bFTYX58u; 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 o7si15966230pgl.42.2018.12.04.03.00.39; Tue, 04 Dec 2018 03:00:55 -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=bFTYX58u; 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 S1726749AbeLDK71 (ORCPT + 99 others); Tue, 4 Dec 2018 05:59:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:44178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbeLDK7Y (ORCPT ); Tue, 4 Dec 2018 05:59:24 -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 4A047214D9; Tue, 4 Dec 2018 10:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921163; bh=B55AneUSizKrJCwCvgHkiy9Gqc6msEBH4nFyDauL0cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFTYX58uMD/DWfHoyNA23D0KDVWpga/tKGRrWc+Y4bgKWL3I7ouxApq4IUzgp/ifT KYaj0TERdBcwZlhDsVpQ34Wpp4e/7/9BFT+ygsjkyIC2O/OkqTGZ9a/S2D80cr153W vuidXR/tzqHWREHHIsKApXCyQoGYRkYM9OuEk1Dk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org, stable@kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 104/139] sh/function_graph: Simplify with function_graph_enter() Date: Tue, 4 Dec 2018 11:49:45 +0100 Message-Id: <20181204103654.805556008@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 bc715ee4dbc5db462c59b9cfba92d31b3274fe3a 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 superh 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: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.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/sh/kernel/ftrace.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) --- a/arch/sh/kernel/ftrace.c +++ b/arch/sh/kernel/ftrace.c @@ -321,8 +321,7 @@ int ftrace_disable_ftrace_graph_caller(v void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) { unsigned long old; - int faulted, err; - struct ftrace_graph_ent trace; + int faulted; unsigned long return_hooker = (unsigned long)&return_to_handler; if (unlikely(ftrace_graph_is_dead())) @@ -365,18 +364,7 @@ void prepare_ftrace_return(unsigned long return; } - err = ftrace_push_return_trace(old, self_addr, &trace.depth, 0, NULL); - if (err == -EBUSY) { + if (function_graph_enter(old, self_addr, 0, NULL)) __raw_writel(old, parent); - return; - } - - trace.func = self_addr; - - /* Only trace if the calling function expects to */ - if (!ftrace_graph_entry(&trace)) { - current->curr_ret_stack--; - __raw_writel(old, parent); - } } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */