* [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n
@ 2023-05-09 9:15 Nicholas Piggin
2023-05-09 9:16 ` [PATCH 2/2] powerpc/pseries: Remove unused hcall tracing instruction Nicholas Piggin
2023-08-31 4:02 ` [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2023-05-09 9:15 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
With JUMP_LABEL=n, hcall_tracepoint_refcount's address is being tested
instead of its value. This results in the tracing slowpath always being
taken unnecessarily.
Fixes: 9a10ccb29c0a2 ("powerpc/pseries: move hcall_tracepoint_refcount out of .toc")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/platforms/pseries/hvCall.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 35254ac7af5e..ca0674b0b683 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -91,6 +91,7 @@ BEGIN_FTR_SECTION; \
b 1f; \
END_FTR_SECTION(0, 1); \
LOAD_REG_ADDR(r12, hcall_tracepoint_refcount) ; \
+ ld r12,0(r12); \
std r12,32(r1); \
cmpdi r12,0; \
bne- LABEL; \
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] powerpc/pseries: Remove unused hcall tracing instruction
2023-05-09 9:15 [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Nicholas Piggin
@ 2023-05-09 9:16 ` Nicholas Piggin
2023-08-31 4:02 ` [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Piggin @ 2023-05-09 9:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
When JUMP_LABEL=n, the tracepoint refcount test in the pre-call stores
the refcount value to the stack, so the same value can be used for the
post-call (presumably to avoid racing with the value concurrently
changing).
On little-endian (ELFv2) that might have just worked by luck, because
32(r1) is STK_PARAM(R3) there and so the value save gets clobbered by
the tracing code when it's non-zero, but fortunately r3 is the hcall
number and 0 is an invalid hcall number so it should get clobbered by
another non-zero value. In any case, commit cc1adb5f32557
("powerpc/pseries: Use jump labels for hcall tracepoints") removed the
code that actually used the value stored, so now it's just dead code.
It's fragile to be storing to the stack like this, and confusing. Better
remove it.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/platforms/pseries/hvCall.S | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index ca0674b0b683..bae45b358a09 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -92,7 +92,6 @@ BEGIN_FTR_SECTION; \
END_FTR_SECTION(0, 1); \
LOAD_REG_ADDR(r12, hcall_tracepoint_refcount) ; \
ld r12,0(r12); \
- std r12,32(r1); \
cmpdi r12,0; \
bne- LABEL; \
1:
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n
2023-05-09 9:15 [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Nicholas Piggin
2023-05-09 9:16 ` [PATCH 2/2] powerpc/pseries: Remove unused hcall tracing instruction Nicholas Piggin
@ 2023-08-31 4:02 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-08-31 4:02 UTC (permalink / raw)
To: linuxppc-dev, Nicholas Piggin
On Tue, 09 May 2023 19:15:59 +1000, Nicholas Piggin wrote:
> With JUMP_LABEL=n, hcall_tracepoint_refcount's address is being tested
> instead of its value. This results in the tracing slowpath always being
> taken unnecessarily.
>
>
Applied to powerpc/next.
[1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n
https://git.kernel.org/powerpc/c/750bd41aeaeb1f0e0128aa4f8fcd6dd759713641
[2/2] powerpc/pseries: Remove unused hcall tracing instruction
https://git.kernel.org/powerpc/c/61d7ebe0376e2640ba77be16e186b1a6c77eb3f7
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-31 4:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 9:15 [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Nicholas Piggin
2023-05-09 9:16 ` [PATCH 2/2] powerpc/pseries: Remove unused hcall tracing instruction Nicholas Piggin
2023-08-31 4:02 ` [PATCH 1/2] powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n Michael Ellerman
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).