All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Sachin Sant <sachinp@linux.vnet.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH v3 5/9] powerpc/64s/interrupt: preserve regs->softe for NMI interrupts
Date: Wed, 30 Jun 2021 17:46:17 +1000	[thread overview]
Message-ID: <20210630074621.2109197-6-npiggin@gmail.com> (raw)
In-Reply-To: <20210630074621.2109197-1-npiggin@gmail.com>

If an NMI interrupt hits in an implicit soft-masked region, regs->softe
is modified to reflect that. This may not be necessary for correctness
at the moment, but it is less surprising and it's unhelpful when
debugging or adding checks.

Make sure this is changed back to how it was found before returning.

Fixes: 4ec5feec1ad0 ("powerpc/64s: Make NMI record implicitly soft-masked code as irqs disabled")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/include/asm/interrupt.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
index d7df247a149c..789311d1e283 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -227,6 +227,7 @@ struct interrupt_nmi_state {
 	u8 irq_soft_mask;
 	u8 irq_happened;
 	u8 ftrace_enabled;
+	u64 softe;
 #endif
 };
 
@@ -252,6 +253,7 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte
 #ifdef CONFIG_PPC64
 	state->irq_soft_mask = local_paca->irq_soft_mask;
 	state->irq_happened = local_paca->irq_happened;
+	state->softe = regs->softe;
 
 	/*
 	 * Set IRQS_ALL_DISABLED unconditionally so irqs_disabled() does
@@ -311,6 +313,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter
 
 	/* Check we didn't change the pending interrupt mask. */
 	WARN_ON_ONCE((state->irq_happened | PACA_IRQ_HARD_DIS) != local_paca->irq_happened);
+	regs->softe = state->softe;
 	local_paca->irq_happened = state->irq_happened;
 	local_paca->irq_soft_mask = state->irq_soft_mask;
 #endif
-- 
2.23.0


  parent reply	other threads:[~2021-06-30  7:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  7:46 [PATCH v3 0/9] powerpc: fast interrupt exit bug and misc fixes Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 1/9] powerpc/64s: fix hash page fault interrupt handler Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 2/9] powerpc/64e: fix CONFIG_RELOCATABLE build warnings Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 3/9] powerpc/64e: remove implicit soft-masking and interrupt exit restart logic Nicholas Piggin
2021-06-30  7:56   ` Christophe Leroy
2021-07-01  1:26     ` Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 4/9] powerpc/64s: add a table of implicit soft-masked addresses Nicholas Piggin
2021-06-30  7:46 ` Nicholas Piggin [this message]
2021-06-30  7:46 ` [PATCH v3 6/9] powerpc/64: enable MSR[EE] in irq replay pt_regs Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 7/9] powerpc/64/interrupt: add missing kprobe annotations on interrupt exit symbols Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 8/9] powerpc/64s/interrupt: clean up interrupt return labels Nicholas Piggin
2021-06-30  7:46 ` [PATCH v3 9/9] powerpc/64s: move ret_from_fork etc above __end_soft_masked Nicholas Piggin
2021-06-30 13:14 ` [PATCH v3 0/9] powerpc: fast interrupt exit bug and misc fixes 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=20210630074621.2109197-6-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sachinp@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.