linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Nick Kossifidis <mick@ics.forth.gr>,
	Atish Patra <atish.patra@wdc.com>,
	linux-riscv@lists.infradead.org
Subject: [PATCH 08/12] riscv: remove unreachable !CONFIG_FRAME_POINTER code
Date: Fri, 12 Apr 2019 16:39:44 +0200	[thread overview]
Message-ID: <20190412143948.12478-9-hch@lst.de> (raw)
In-Reply-To: <20190412143948.12478-1-hch@lst.de>

The RISC-V port selects CONFIG_ARCH_WANT_FRAME_POINTERS, which causes
CONFIG_FRAME_POINTER to always be set.  Remove the unreachable code
for the !CONFIG_FRAME_POINTER case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/include/asm/ftrace.h |  6 +-----
 arch/riscv/kernel/stacktrace.c  | 37 ---------------------------------
 2 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h
index c6dcc5291f97..c52073a065e5 100644
--- a/arch/riscv/include/asm/ftrace.h
+++ b/arch/riscv/include/asm/ftrace.h
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Copyright (C) 2017 Andes Technology Corporation */
 
-/*
- * The graph frame test is not possible if CONFIG_FRAME_POINTER is not enabled.
- * Check arch/riscv/kernel/mcount.S for detail.
- */
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && defined(CONFIG_FRAME_POINTER)
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #define HAVE_FUNCTION_GRAPH_FP_TEST
 #endif
 #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index a4b1d94371a0..3cb439f8c7e6 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -20,8 +20,6 @@
 #include <linux/stacktrace.h>
 #include <linux/ftrace.h>
 
-#ifdef CONFIG_FRAME_POINTER
-
 struct stackframe {
 	unsigned long fp;
 	unsigned long ra;
@@ -73,41 +71,6 @@ static void notrace walk_stackframe(struct task_struct *task,
 	}
 }
 
-#else /* !CONFIG_FRAME_POINTER */
-
-static void notrace walk_stackframe(struct task_struct *task,
-	struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
-{
-	unsigned long sp, pc;
-	unsigned long *ksp;
-
-	if (regs) {
-		sp = GET_USP(regs);
-		pc = GET_IP(regs);
-	} else if (task == NULL || task == current) {
-		const register unsigned long current_sp __asm__ ("sp");
-		sp = current_sp;
-		pc = (unsigned long)walk_stackframe;
-	} else {
-		/* task blocked in __switch_to */
-		sp = task->thread.sp;
-		pc = task->thread.ra;
-	}
-
-	if (unlikely(sp & 0x7))
-		return;
-
-	ksp = (unsigned long *)sp;
-	while (!kstack_end(ksp)) {
-		if (__kernel_text_address(pc) && unlikely(fn(pc, arg)))
-			break;
-		pc = (*ksp++) - 0x4;
-	}
-}
-
-#endif /* CONFIG_FRAME_POINTER */
-
-
 static bool print_trace_address(unsigned long pc, void *arg)
 {
 	print_ip_sym(pc);
-- 
2.20.1


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

  parent reply	other threads:[~2019-04-12 14:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 14:39 misc cleanups v2 Christoph Hellwig
2019-04-12 14:39 ` [PATCH 01/12] riscv: use asm-generic/extable.h Christoph Hellwig
2019-04-12 14:39 ` [PATCH 02/12] riscv: turn mm_segment_t into a struct Christoph Hellwig
2019-04-12 14:39 ` [PATCH 03/12] riscv: remove unreachable big endian code Christoph Hellwig
2019-04-12 14:39 ` [PATCH 04/12] riscv: remove CONFIG_RISCV_ISA_A Christoph Hellwig
2019-04-12 14:39 ` [PATCH 05/12] riscv: clear all pending interrupts when booting Christoph Hellwig
2019-04-12 14:39 ` [PATCH 06/12] riscv: simplify the stack pointer setup in head.S Christoph Hellwig
2019-04-12 14:39 ` [PATCH 07/12] riscv: cleanup the parse_dtb calling conventions Christoph Hellwig
2019-04-12 14:39 ` Christoph Hellwig [this message]
2019-04-12 14:39 ` [PATCH 09/12] riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code Christoph Hellwig
2019-04-12 14:39 ` [PATCH 10/12] riscv: remove duplicate macros from ptrace.h Christoph Hellwig
2019-04-12 14:39 ` [PATCH 11/12] riscv: print the unexpected interrupt cause Christoph Hellwig
2019-04-12 16:09   ` Nick Kossifidis
2019-04-12 14:39 ` [PATCH 12/12] riscv: call pm_power_off from machine_halt / machine_power_off Christoph Hellwig

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=20190412143948.12478-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=atish.patra@wdc.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mick@ics.forth.gr \
    --cc=palmer@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;
as well as URLs for NNTP newsgroup(s).