linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH v4 16/17] powerpc/interrupt: Refactor prep_irq_for_{user/kernel_enabled}_exit()
Date: Fri, 18 Jun 2021 01:51:15 +1000	[thread overview]
Message-ID: <20210617155116.2167984-17-npiggin@gmail.com> (raw)
In-Reply-To: <20210617155116.2167984-1-npiggin@gmail.com>

From: Christophe Leroy <christophe.leroy@csgroup.eu>

prep_irq_for_user_exit() is a superset of
prep_irq_for_kernel_enabled_exit().

Rename prep_irq_for_kernel_enabled_exit() as prep_irq_for_enabled_exit()
and have prep_irq_for_user_exit() use it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/interrupt.c | 29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 6ba693f99e5a..138c450b01bd 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -50,7 +50,7 @@ static inline bool exit_must_hard_disable(void)
  * restartable is true then EE/RI can be left on because interrupts are handled
  * with a restart sequence.
  */
-static notrace __always_inline bool prep_irq_for_kernel_enabled_exit(bool restartable)
+static notrace __always_inline bool prep_irq_for_enabled_exit(bool restartable)
 {
 	/* This must be done with RI=1 because tracing may touch vmaps */
 	trace_hardirqs_on();
@@ -77,29 +77,14 @@ static notrace __always_inline bool prep_irq_for_kernel_enabled_exit(bool restar
 
 static notrace __always_inline bool prep_irq_for_user_exit(void)
 {
-	user_enter_irqoff();
-	/* This must be done with RI=1 because tracing may touch vmaps */
-	trace_hardirqs_on();
-
-#ifdef CONFIG_PPC32
-	__hard_EE_RI_disable();
-#else
-	if (exit_must_hard_disable())
-		__hard_EE_RI_disable();
+	bool ret;
 
-	/* This pattern matches prep_irq_for_idle */
-	if (unlikely(lazy_irq_pending_nocheck())) {
-		if (exit_must_hard_disable()) {
-			local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
-			__hard_RI_enable();
-		}
-		trace_hardirqs_off();
+	user_enter_irqoff();
+	ret = prep_irq_for_enabled_exit(true);
+	if (!ret)
 		user_exit_irqoff();
 
-		return false;
-	}
-#endif
-	return true;
+	return ret;
 }
 
 /* Has to run notrace because it is entered not completely "reconciled" */
@@ -469,7 +454,7 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
 		 * Stack store exit can't be restarted because the interrupt
 		 * stack frame might have been clobbered.
 		 */
-		if (!prep_irq_for_kernel_enabled_exit(unlikely(stack_store))) {
+		if (!prep_irq_for_enabled_exit(unlikely(stack_store))) {
 			/*
 			 * Replay pending soft-masked interrupts now. Don't
 			 * just local_irq_enabe(); local_irq_disable(); because
-- 
2.23.0


  parent reply	other threads:[~2021-06-17 15:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 15:50 [PATCH v4 00/17] powerpc/64: fast interrupt exits Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 01/17] powerpc/interrupt: Fix CONFIG ifdef typo Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 02/17] powerpc: remove interrupt exit helpers unused argument Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 03/17] powerpc/64s: introduce different functions to return from SRR vs HSRR interrupts Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 04/17] powerpc/64s: avoid reloading (H)SRR registers if they are still valid Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 05/17] powerpc/64: handle MSR EE and RI in interrupt entry wrapper Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 06/17] powerpc/64: move interrupt return asm to interrupt_64.S Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 07/17] powerpc/64s: system call avoid setting MSR[RI] until we set MSR[EE] Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 08/17] powerpc/64s: save one more register in the masked interrupt handler Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 09/17] powerpc/64: allow alternate return locations for soft-masked interrupts Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 10/17] powerpc/64: interrupt soft-enable race fix Nicholas Piggin
2022-05-16 16:36   ` Christophe Leroy
2021-06-17 15:51 ` [PATCH v4 11/17] powerpc/64: treat low kernel text as irqs soft-masked Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 12/17] powerpc/64: use interrupt restart table to speed up return from interrupt Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 13/17] powerpc/interrupt: Rename and lightly change syscall_exit_prepare_main() Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 14/17] powerpc/interrupt: Refactor interrupt_exit_user_prepare() Nicholas Piggin
2021-06-17 15:51 ` [PATCH v4 15/17] powerpc/interrupt: Interchange prep_irq_for_{kernel_enabled/user}_exit() Nicholas Piggin
2021-06-17 15:51 ` Nicholas Piggin [this message]
2021-06-17 15:51 ` [PATCH v4 17/17] powerpc/interrupt: Remove prep_irq_for_user_exit() Nicholas Piggin
2021-06-25  6:21 ` [PATCH v4 00/17] powerpc/64: fast interrupt exits Michael Ellerman

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=20210617155116.2167984-17-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.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).