From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: "Naveen N . Rao" <naveen.n.rao@linux.vnet.ibm.com>,
Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code
Date: Fri, 23 Apr 2021 13:11:08 +1000 [thread overview]
Message-ID: <20210423031108.1046067-5-npiggin@gmail.com> (raw)
In-Reply-To: <20210423031108.1046067-1-npiggin@gmail.com>
---
arch/powerpc/platforms/pseries/lpar.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 835e7f661a05..a961a7ebeab3 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -1828,8 +1828,11 @@ void hcall_tracepoint_unregfunc(void)
/*
* Since the tracing code might execute hcalls we need to guard against
- * recursion. H_CONFER from spin locks must be treated separately though
- * and use _notrace plpar_hcall variants, see yield_to_preempted().
+ * recursion, but this always seems risky -- __trace_hcall_entry might be
+ * ftraced, for example. So warn in this case.
+ *
+ * H_CONFER from spin locks must be treated separately though and use _notrace
+ * plpar_hcall variants, see yield_to_preempted().
*/
static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
@@ -1843,7 +1846,7 @@ notrace void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
depth = this_cpu_ptr(&hcall_trace_depth);
- if (*depth)
+ if (WARN_ON_ONCE(*depth))
goto out;
(*depth)++;
@@ -1864,7 +1867,7 @@ notrace void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)
depth = this_cpu_ptr(&hcall_trace_depth);
- if (*depth)
+ if (*depth) /* Don't warning again on the way out */
goto out;
(*depth)++;
--
2.23.0
next prev parent reply other threads:[~2021-04-23 3:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 3:11 [PATCH 0/4] Fix queued spinlocks and a bit more Nicholas Piggin
2021-04-23 3:11 ` [PATCH 1/4] powerpc/pseries: Fix hcall tracing recursion in pv queued spinlocks Nicholas Piggin
2021-04-27 13:43 ` Naveen N. Rao
2021-05-01 1:22 ` Nicholas Piggin
2021-05-02 13:48 ` Michael Ellerman
2021-04-23 3:11 ` [PATCH 2/4] powerpc/pseries: Don't trace hcall tracing wrapper Nicholas Piggin
2021-04-27 13:52 ` Naveen N. Rao
2021-04-23 3:11 ` [PATCH 3/4] powerpc/pseries: use notrace hcall variant for H_CEDE idle Nicholas Piggin
2021-04-27 13:53 ` Naveen N. Rao
2021-04-23 3:11 ` Nicholas Piggin [this message]
2021-04-27 13:59 ` [PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code Naveen N. Rao
2021-05-01 1:24 ` Nicholas Piggin
2021-05-04 10:25 ` Naveen N. Rao
2021-05-04 10:45 ` Nicholas Piggin
2021-05-04 16:18 ` Naveen N. Rao
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=20210423031108.1046067-5-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=naveen.n.rao@linux.vnet.ibm.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 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.