public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: guoren@kernel.org
To: anup@brainfault.org, paul.walmsley@sifive.com,
	palmer@dabbelt.com, conor.dooley@microchip.com, heiko@sntech.de,
	peterz@infradead.org, arnd@arndb.de, linux-arch@vger.kernel.org,
	keescook@chromium.org, paulmck@kernel.org, frederic@kernel.org,
	nsaenzju@redhat.com, changbin.du@intel.com,
	vincent.chen@sifive.com
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Guo Ren <guoren@linux.alibaba.com>, Guo Ren <guoren@kernel.org>,
	Alan Kao <alankao@andestech.com>,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: [PATCH 1/2] riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument
Date: Wed,  9 Nov 2022 01:49:36 -0500	[thread overview]
Message-ID: <20221109064937.3643993-2-guoren@kernel.org> (raw)
In-Reply-To: <20221109064937.3643993-1-guoren@kernel.org>

From: Guo Ren <guoren@linux.alibaba.com>

The 'retp' is a pointer to the return address on the stack, so we
must pass the current return address pointer as the 'retp'
argument to ftrace_push_return_trace(). Not parent function's
return address on the stack.

Fixes: b785ec129bd9 ("riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Cc: Alan Kao <alankao@andestech.com>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
---
 arch/riscv/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..bcfe9eb55f80 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -58,7 +58,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 		} else {
 			fp = frame->fp;
 			pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
-						   (unsigned long *)(fp - 8));
+						   &frame->ra);
 		}
 
 	}
-- 
2.36.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-11-09  6:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  6:49 [PATCH 0/2] riscv: stacktrace: A fixup and an optimization guoren
2022-11-09  6:49 ` guoren [this message]
2022-11-09  6:49 ` [PATCH 2/2] riscv: stacktrace: Make walk_stackframe cross pt_regs frame guoren
2022-11-21  9:53   ` Guo Ren
2022-11-21 11:49     ` Guo Ren
2022-12-06  2:59   ` Palmer Dabbelt
2022-12-06  3:30     ` Guo Ren
2022-12-06  2:59 ` [PATCH 0/2] riscv: stacktrace: A fixup and an optimization Palmer Dabbelt
2022-12-06  3:10 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221109064937.3643993-2-guoren@kernel.org \
    --to=guoren@kernel.org \
    --cc=alankao@andestech.com \
    --cc=anup@brainfault.org \
    --cc=arnd@arndb.de \
    --cc=changbin.du@intel.com \
    --cc=conor.dooley@microchip.com \
    --cc=frederic@kernel.org \
    --cc=guoren@linux.alibaba.com \
    --cc=heiko@sntech.de \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nsaenzju@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.chen@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox