Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2971547imm; Sun, 1 Jul 2018 09:26:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdKdh7CVh7/5SbcwXRBd3iuIYMrKAUW2+6dwNP1hSWv5t9V6drFEbxaeDQE6n22R79lXo2l X-Received: by 2002:a62:3c4:: with SMTP id 187-v6mr2661973pfd.128.1530462365367; Sun, 01 Jul 2018 09:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530462365; cv=none; d=google.com; s=arc-20160816; b=qaylwferQ2wJeY3cFgmeauRNxDafr2jjc82pXrpPgdv/MNhaRKQpzq/MKukNlTVLGL H8r2/vqRI9yfinqEo4/YpF+h4am/QF8PjNsc9DQ85VFtebY+JWNFNlkk6LSS1ZgRzoIR qGtCwHPo4cE0Q5CBYQnv+2hoibXwOrCTYCQ1ZqMoaHxI86HP0WiJvofR7M6UqXOLQhCy UyF9gdej200Z72kHl1/o3LjCjge6nCECyJgcuBTcHzsskVlByvcf4CQKHmxcoRGC+D6Z PNQdeEmcHDsFKlxsV2qtbr+90p7c7G/atP9p3F9grmxn8stEmgXEtv9eVlgzi/4VwSkY aQ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ws4Yl2VrrHQPOj83G94Rn+vD8J3KUW2N6SGtez5xkmg=; b=sLJf+mbdWh/e7P5csayubFhGdOc2BltlxWZfbiXZR6i4NhteiQ2Cmi5omI6Jxdkx68 biRqEM2oYSIEjBa/rMVQxEZXo8KyDc94EuU+WlLN8ltZNx148qgnEXsSI+qV/0wAxfME wwoYuNv9bdqhRGNnIzo5tW6u3AyVvbDDKTNew17Shtpq6LJYKmH/vrDNuZlGb+MkIQf7 NX15FvrdFC+V9HHxIeufUwnifaaaxsBQC+BwF9UrJ3TVq4SaqGZAaCALNNSZTDKubWbF 2u3ojA9MUU+2/CqOb5j230O43LkWSpg2YV4vCvpG6sPUR3n3lCfh7ELW5hPy9eXqqcyy ZBoA== 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 z23-v6si13649306pfh.266.2018.07.01.09.25.51; Sun, 01 Jul 2018 09:26:05 -0700 (PDT) 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 S965211AbeGAQYr (ORCPT + 99 others); Sun, 1 Jul 2018 12:24:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33526 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965131AbeGAQYk (ORCPT ); Sun, 1 Jul 2018 12:24:40 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EA9E4AE0; Sun, 1 Jul 2018 16:24:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Schiffer , Matt Redfearn , Paul Burton Subject: [PATCH 4.9 017/101] mips: ftrace: fix static function graph tracing Date: Sun, 1 Jul 2018 18:21:03 +0200 Message-Id: <20180701160757.823536881@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthias Schiffer commit 6fb8656646f996d1eef42e6d56203c4915cb9e08 upstream. ftrace_graph_caller was never run after calling ftrace_trace_function, breaking the function graph tracer. Fix this, bringing it in line with the x86 implementation. While we're at it, also streamline the control flow of _mcount a bit to reduce the number of branches. This issue was reported before: https://www.linux-mips.org/archives/linux-mips/2014-11/msg00295.html Signed-off-by: Matthias Schiffer Tested-by: Matt Redfearn Patchwork: https://patchwork.linux-mips.org/patch/18929/ Signed-off-by: Paul Burton Cc: stable@vger.kernel.org # v3.17+ Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/mcount.S | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S @@ -116,10 +116,20 @@ ftrace_stub: NESTED(_mcount, PT_SIZE, ra) PTR_LA t1, ftrace_stub PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */ - bne t1, t2, static_trace + beq t1, t2, fgraph_trace nop + MCOUNT_SAVE_REGS + + move a0, ra /* arg1: self return address */ + jalr t2 /* (1) call *ftrace_trace_function */ + move a1, AT /* arg2: parent's return address */ + + MCOUNT_RESTORE_REGS + +fgraph_trace: #ifdef CONFIG_FUNCTION_GRAPH_TRACER + PTR_LA t1, ftrace_stub PTR_L t3, ftrace_graph_return bne t1, t3, ftrace_graph_caller nop @@ -128,24 +138,11 @@ NESTED(_mcount, PT_SIZE, ra) bne t1, t3, ftrace_graph_caller nop #endif - b ftrace_stub -#ifdef CONFIG_32BIT - addiu sp, sp, 8 -#else - nop -#endif - -static_trace: - MCOUNT_SAVE_REGS - - move a0, ra /* arg1: self return address */ - jalr t2 /* (1) call *ftrace_trace_function */ - move a1, AT /* arg2: parent's return address */ - MCOUNT_RESTORE_REGS #ifdef CONFIG_32BIT addiu sp, sp, 8 #endif + .globl ftrace_stub ftrace_stub: RETURN_BACK