linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org, Alexander Graf <agraf@suse.de>,
	Stuart Yoder <stuart.yoder@freescale.com>
Subject: [PATCH] powerpc/booke: Eliminate rfi from exception entry path.
Date: Tue, 10 Jul 2012 19:34:54 -0500	[thread overview]
Message-ID: <20120711003454.GA22757@tyr.buserror.net> (raw)

Unlike classic, we don't really need the MSR change to be atomic with the
branch.  This eliminates a trap as a KVM guest (in the absence of
hardware hypervisor extensions), where mtmsr is paravirtualized but rfi
is not.  For a virtualized guest without any paravirtualization, this
eliminates an additional two traps (SRR0/1).

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kernel/entry_32.S |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ba3aeb4..6bb637c 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -193,6 +193,9 @@ transfer_to_handler_cont:
 	lwz	r11,0(r9)		/* virtual address of handler */
 	lwz	r9,4(r9)		/* where to go when done */
 #ifdef CONFIG_TRACE_IRQFLAGS
+#ifdef CONFIG_BOOKE
+	mtmsr	r10
+#else
 	lis	r12,reenable_mmu@h
 	ori	r12,r12,reenable_mmu@l
 	mtspr	SPRN_SRR0,r12
@@ -201,6 +204,7 @@ transfer_to_handler_cont:
 	RFI
 reenable_mmu:				/* re-enable mmu so we can */
 	mfmsr	r10
+#endif /* !CONFIG_BOOKE */
 	lwz	r12,_MSR(r1)
 	xor	r10,r10,r12
 	andi.	r10,r10,MSR_EE		/* Did EE change? */
@@ -247,11 +251,23 @@ reenable_mmu:				/* re-enable mmu so we can */
 	mtlr	r9
 	bctr				/* jump to handler */
 #else /* CONFIG_TRACE_IRQFLAGS */
+#ifdef CONFIG_BOOKE
+	/*
+	 * We're not changing address space on Book E, and the extra rfi
+	 * can hurt when virtualized without hardware support -- whereas
+	 * mtmsr can be paravirtualized.
+	 */
+	mtmsr	r10
+	mtctr	r11
+	mtlr	r9
+	bctr
+#else
 	mtspr	SPRN_SRR0,r11
 	mtspr	SPRN_SRR1,r10
 	mtlr	r9
 	SYNC
 	RFI				/* jump to handler, enable MMU */
+#endif /* !CONFIG_BOOKE */
 #endif /* CONFIG_TRACE_IRQFLAGS */
 
 #if defined (CONFIG_6xx) || defined(CONFIG_E500)
-- 
1.7.5.4

             reply	other threads:[~2012-07-11  0:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  0:34 Scott Wood [this message]
2012-07-11  0:36 ` [PATCH] powerpc/booke: Eliminate rfi from exception entry path Benjamin Herrenschmidt
2012-07-11  0:41   ` Scott Wood
2012-07-11  0:53     ` Benjamin Herrenschmidt
2012-07-11  0:44 ` Alexander Graf
2012-07-11  0:47   ` Scott Wood
2012-07-11  0:54     ` Benjamin Herrenschmidt

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=20120711003454.GA22757@tyr.buserror.net \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=stuart.yoder@freescale.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).