diff mbox series

powerpc/tm: Don't check for WARN in TM Bad Thing handling

Message ID 1507783525-28940-1-git-send-email-mpe@ellerman.id.au (mailing list archive)
State Accepted
Commit 632f0574167ad3f5d646dad6af87d976a703d93e
Headers show
Series powerpc/tm: Don't check for WARN in TM Bad Thing handling | expand

Commit Message

Michael Ellerman Oct. 12, 2017, 4:45 a.m. UTC
Currently when we take a TM Bad Thing program check exception, we
search the bug table to see if the program check was generated by a
WARN/WARN_ON etc.

That makes no sense, the WARN macros use trap instructions, which
should never generate a TM Bad Thing exception. If they ever did that
would be a bug and we should oops.

We do have some hand-coded bugs in tm.S, using EMIT_BUG_ENTRY, but
those are all BUGs not WARNs, and they all use trap instructions
anyway. Almost certainly this check was incorrectly copied from the
REASON_TRAP handling in the same function.

Remove it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/traps.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Michael Neuling Oct. 12, 2017, 10:47 a.m. UTC | #1
On Thu, 2017-10-12 at 15:45 +1100, Michael Ellerman wrote:
> Currently when we take a TM Bad Thing program check exception, we
> search the bug table to see if the program check was generated by a
> WARN/WARN_ON etc.
> 
> That makes no sense, the WARN macros use trap instructions, which
> should never generate a TM Bad Thing exception. If they ever did that
> would be a bug and we should oops.
> 
> We do have some hand-coded bugs in tm.S, using EMIT_BUG_ENTRY, but
> those are all BUGs not WARNs, and they all use trap instructions
> anyway. Almost certainly this check was incorrectly copied from the
> REASON_TRAP handling in the same function.
> 
> Remove it.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

LGTM

Acked-By: Michael Neuling <mikey@neuling.org>

> ---
>  arch/powerpc/kernel/traps.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 9ae1924c7d1a..0e4099fef198 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -1337,13 +1337,8 @@ void program_check_exception(struct pt_regs *regs)
>  		 * -  A treclaim is attempted when non transactional.
>  		 * -  A tend is illegally attempted.
>  		 * -  writing a TM SPR when transactional.
> -		 */
> -		if (!user_mode(regs) &&
> -		    report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
> -			regs->nip += 4;
> -			goto bail;
> -		}
> -		/* If usermode caused this, it's done something illegal and
> +		 *
> +		 * If usermode caused this, it's done something illegal and
>  		 * gets a SIGILL slap on the wrist.  We call it an illegal
>  		 * operand to distinguish from the instruction just being bad
>  		 * (e.g. executing a 'tend' on a CPU without TM!); it's an
Michael Ellerman Nov. 7, 2017, 11:30 p.m. UTC | #2
On Thu, 2017-10-12 at 04:45:25 UTC, Michael Ellerman wrote:
> Currently when we take a TM Bad Thing program check exception, we
> search the bug table to see if the program check was generated by a
> WARN/WARN_ON etc.
> 
> That makes no sense, the WARN macros use trap instructions, which
> should never generate a TM Bad Thing exception. If they ever did that
> would be a bug and we should oops.
> 
> We do have some hand-coded bugs in tm.S, using EMIT_BUG_ENTRY, but
> those are all BUGs not WARNs, and they all use trap instructions
> anyway. Almost certainly this check was incorrectly copied from the
> REASON_TRAP handling in the same function.
> 
> Remove it.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Acked-By: Michael Neuling <mikey@neuling.org>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/632f0574167ad3f5d646dad6af87d9

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 9ae1924c7d1a..0e4099fef198 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1337,13 +1337,8 @@  void program_check_exception(struct pt_regs *regs)
 		 * -  A treclaim is attempted when non transactional.
 		 * -  A tend is illegally attempted.
 		 * -  writing a TM SPR when transactional.
-		 */
-		if (!user_mode(regs) &&
-		    report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
-			regs->nip += 4;
-			goto bail;
-		}
-		/* If usermode caused this, it's done something illegal and
+		 *
+		 * If usermode caused this, it's done something illegal and
 		 * gets a SIGILL slap on the wrist.  We call it an illegal
 		 * operand to distinguish from the instruction just being bad
 		 * (e.g. executing a 'tend' on a CPU without TM!); it's an