From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D29641A83AF; Tue, 16 Jul 2024 14:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721140090; cv=none; b=ZI+gUjnD53dKagab7ZX0KS+S3HkJhvTntQqtJDzlyjh7vkZO25MLz+5s5e55SUHEnSHwFWQ0EXZ43asJRTP087ZEzBe/tWHr9dRqRYk2Ftcm9rAst+cpFjC8+MiLhGeftcQufNslan3G2VgBYcCcArwxHXGJwldNuIKsWUxxM6o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721140090; c=relaxed/simple; bh=GvxcA8wr20XF4fdAl9dv1Gnq+YAu/czSgSdTv7mKfqU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kIIdfsyCsq4+UehSsYgnNb1Y1nalk7YlUFjkaYLs+SU4U3sNqCaDEcM69uFfpKH4hNxLqj3B6tAkzgL7B4TZXedFlkeNE5mLbh+NPq0V1yrXrRADxqDalAxh7FFSapYFDdXjjsiSZS6SSSiUErNVp3Zk1MSIrRvNzZXt1ERr93o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rndp89b5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rndp89b5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 685D3C4AF0F; Tue, 16 Jul 2024 14:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721140090; bh=GvxcA8wr20XF4fdAl9dv1Gnq+YAu/czSgSdTv7mKfqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rndp89b5g4wlnQBK6DclfrnvwlN+rVdhpWnk+N6rpSCyEDZjiNyTUmfjk0QxMdnqE ad1zqnl1SWS/TPwDNR6uX4gGb0avt5/rY26DuBn5/Y4Gr3fvdjrrg157aLJUALWGC4 gVF/xqGvPdztxQbaX8EmJCs6ncQaHfsPbJ/ifT2aUh0I/B1AzwweJ7A0ixLZpiyCFR WZxMPQMmXy8jVXNlLkxIBCS20UIKwISSl6GaXIUwMGSP4t4/dfuigivFkU0yOI+gLH HkDntTcq533HofVlveRDR3y3vRDSMJB64JBonP653xYiVAt89680JDjMwfVkdEdCnI SHlVwH9iS88Bw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Puranjay Mohan , Steven Rostedt , Palmer Dabbelt , Sasha Levin , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, dev.mbstr@gmail.com, alexghiti@rivosinc.com, andy.chiu@sifive.com, linux-riscv@lists.infradead.org Subject: [PATCH AUTOSEL 6.6 18/18] riscv: stacktrace: fix usage of ftrace_graph_ret_addr() Date: Tue, 16 Jul 2024 10:26:53 -0400 Message-ID: <20240716142713.2712998-18-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716142713.2712998-1-sashal@kernel.org> References: <20240716142713.2712998-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.40 Content-Transfer-Encoding: 8bit From: Puranjay Mohan [ Upstream commit 393da6cbb2ff89aadc47683a85269f913aa1c139 ] ftrace_graph_ret_addr() takes an `idx` integer pointer that is used to optimize the stack unwinding. Pass it a valid pointer to utilize the optimizations that might be available in the future. The commit is making riscv's usage of ftrace_graph_ret_addr() match x86_64. Signed-off-by: Puranjay Mohan Reviewed-by: Steven Rostedt (Google) Link: https://lore.kernel.org/r/20240618145820.62112-1-puranjay@kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/kernel/stacktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 0d3f00eb0baee..10e311b2759d3 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -32,6 +32,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *arg) { unsigned long fp, sp, pc; + int graph_idx = 0; int level = 0; if (regs) { @@ -68,7 +69,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, pc = regs->ra; } else { fp = frame->fp; - pc = ftrace_graph_ret_addr(current, NULL, frame->ra, + pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra, &frame->ra); if (pc == (unsigned long)ret_from_exception) { if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc))) -- 2.43.0