linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 17/17] powerpc/32: Don't add dummy frames when calling trace_hardirqs_on/off
Date: Fri, 29 Mar 2019 16:38:39 +0000 (UTC)	[thread overview]
Message-ID: <8f513e30d3fc875263befdaf38f4f80c3165c671.1553877076.git.christophe.leroy@c-s.fr> (raw)
In-Reply-To: <cover.1553877076.git.christophe.leroy@c-s.fr>

No need to add dummy frames when calling trace_hardirqs_on or
trace_hardirqs_off. GCC properly handles empty stacks.

In addition, powerpc doesn't set CONFIG_FRAME_POINTER, therefore
__builtin_return_address(1..) returns NULL at all time. So the
dummy frames are definitely unneeded here.

In the meantime, avoid reading memory for loading r1 with a value
we already know.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/entry_32.S | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index c648b75f41a3..c1e9be5cba10 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -237,12 +237,7 @@ transfer_to_handler_cont:
 
 reenable_mmu:
 	/*
-	 * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1.
-	 * If from user mode there is only one stack frame on the stack, and
-	 * accessing CALLER_ADDR1 will cause oops. So we need create a dummy
-	 * stack frame to make trace_hardirqs_off happy.
-	 *
-	 * This is handy because we also need to save a bunch of GPRs,
+	 * We save a bunch of GPRs,
 	 * r3 can be different from GPR3(r1) at this point, r9 and r11
 	 * contains the old MSR and handler address respectively,
 	 * r4 & r5 can contain page fault arguments that need to be passed
@@ -933,18 +928,11 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
 	 */
 	andi.	r10,r9,MSR_EE
 	beq	1f
-	/*
-	 * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
-	 * which is the stack frame here, we need to force a stack frame
-	 * in case we came from user space.
-	 */
 	stwu	r1,-32(r1)
 	mflr	r0
 	stw	r0,4(r1)
-	stwu	r1,-32(r1)
 	bl	trace_hardirqs_on
-	lwz	r1,0(r1)
-	lwz	r1,0(r1)
+	addi	r1, r1, 32
 	lwz	r9,_MSR(r1)
 1:
 #endif /* CONFIG_TRACE_IRQFLAGS */
-- 
2.13.3


      parent reply	other threads:[~2019-03-29 17:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29 16:38 [PATCH v2 00/17] powerpc/32: Implement fast syscall entry Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 01/17] powerpc/32: Refactor EXCEPTION entry macros for head_8xx.S and head_32.S Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 02/17] powerpc/32: move LOAD_MSR_KERNEL() into head_32.h and use it Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 03/17] powerpc/32: make the 6xx/8xx EXC_XFER_TEMPLATE() similar to the 40x/booke one Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 04/17] powerpc/40x: Don't use SPRN_SPRG_SCRATCH2 in EXCEPTION_PROLOG Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 05/17] powerpc/40x: add exception frame marker Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 06/17] powerpc/40x: Split and rename NORMAL_EXCEPTION_PROLOG Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 07/17] powerpc/40x: Refactor exception entry macros by using head_32.h Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 08/17] powerpc/fsl_booke: ensure SPEFloatingPointException() reenables interrupts Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 09/17] powerpc/32: enter syscall with MSR_EE inconditionaly set Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 10/17] powerpc/32: Enter exceptions with MSR_EE unset Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 11/17] powerpc/32: get rid of COPY_EE in exception entry Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 12/17] powerpc: Fix 32-bit handling of MSR_EE on exceptions Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 13/17] powerpc/32: implement fast entry for syscalls on non BOOKE Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 14/17] powerpc/32: implement fast entry for syscalls on BOOKE Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 15/17] powerpc/32: Remove MSR_PR test when returning from syscall Christophe Leroy
2019-03-29 16:38 ` [PATCH v2 16/17] powerpc/32: don't do syscall stuff in transfer_to_handler Christophe Leroy
2019-03-29 16:38 ` Christophe Leroy [this message]

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=8f513e30d3fc875263befdaf38f4f80c3165c671.1553877076.git.christophe.leroy@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.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 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).