mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/32: Restore clearing of MSR[RI] in interrupt_exit_kernel_prepare()
Date: Wed, 3 Sep 2025 11:28:03 +0200	[thread overview]
Message-ID: <77252ee2-4640-45f4-a7cb-76e2d47ed0c4@csgroup.eu> (raw)
In-Reply-To: <e6166d2568386517de96a89e6cb3c7bd67e71eec.1756723048.git.christophe.leroy@csgroup.eu>



Le 01/09/2025 à 12:37, Christophe Leroy a écrit :
> Commit 13799748b957 ("powerpc/64: use interrupt restart table to speed
> up return from interrupt") removed the inconditional clearing of MSR[RI]
> when returning from interrupt into kernel. But powerpc/32 doesn't
> implement interrupt restart table hence still need MSR[RI] to be
> cleared.

This is needed but not enough. A synchronisation instruction is needed 
after clearing MSR[RI], otherwise the Instruction Breakpoint still 
triggers on a few instructions passed clearing of RI, allthough the 
LCTRL2[BRKNOMSK] is unset, meaning "Masked mode, breakpoints are 
recognized only when MSR[RI] =1 (reset value)"

We could as a isync() after __hard_EE_RI_disable(), but to minimise the 
impact it will be better to move clearing of MSR[RI] in the low-level 
assembly part of interrupt exit, just before the mtspr to SRR0 and SRR1, 
as was done before commit 6f76a01173cc ("powerpc/syscall: implement 
system call entry/exit logic in C for PPC32")

> 
> Fixes: 13799748b957 ("powerpc/64: use interrupt restart table to speed up return from interrupt")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>   arch/powerpc/kernel/interrupt.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index e0c681d0b076..e63bfde13e03 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -443,6 +443,9 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
>   
>   		if (unlikely(stack_store))
>   			__hard_EE_RI_disable();
> +#else
> +	} else {
> +		__hard_EE_RI_disable();
>   #endif /* CONFIG_PPC64 */
>   	}
>   


      reply	other threads:[~2025-09-03  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 10:37 Christophe Leroy
2025-09-03  9:28 ` 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=77252ee2-4640-45f4-a7cb-76e2d47ed0c4@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.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

all inboxes | Powered by JetHome®