All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org
Subject: [PATCH 1/3] parisc: don't use dereference_function_descriptor() in trace stub
Date: Tue, 19 Oct 2021 20:31:50 +0200	[thread overview]
Message-ID: <20211019183152.26191-2-svens@stackframe.org> (raw)
In-Reply-To: <20211019183152.26191-1-svens@stackframe.org>

dereference_function_descriptor() calls get_kernel_nofault(),
which itself might call into tracing. This leads to a deadlock.

Instead of reverting back to casts to compare whether there's
a trace function set, just always call the appropriate trace function.
With dynamic ftrace this function shouldn't be called at all
when ftrace is disabled. It adds a function call for the non-dynamic
case, but people concerned about the costs of ftrace should use
dynamic ftrace anyways.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 arch/parisc/kernel/ftrace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
index 0a1e75af5382..f5f467ebf94c 100644
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -58,10 +58,7 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
 #endif
 	extern struct ftrace_ops *function_trace_op;
 
-	if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED &&
-	    ftrace_trace_function != ftrace_stub)
-		ftrace_trace_function(self_addr, parent,
-				function_trace_op, fregs);
+	ftrace_trace_function(self_addr, parent, function_trace_op, fregs);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	if (dereference_function_descriptor(ftrace_graph_return) !=
@@ -101,6 +98,7 @@ int __init ftrace_dyn_arch_init(void)
 }
 int ftrace_update_ftrace_func(ftrace_func_t func)
 {
+	ftrace_trace_function = func;
 	return 0;
 }
 
-- 
2.33.0


  reply	other threads:[~2021-10-19 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 18:31 [PATCH 0/3] ftrace fixes for PA-RISC Sven Schnelle
2021-10-19 18:31 ` Sven Schnelle [this message]
2021-10-19 18:31 ` [PATCH 2/3] parisc/ftrace: use static key to enable function graph Sven Schnelle
2021-10-19 18:31 ` [PATCH 3/3] parisc: mark xchg functions notrace Sven Schnelle

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=20211019183152.26191-2-svens@stackframe.org \
    --to=svens@stackframe.org \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.