linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/4] powerpc/64: do not trace irqs-off at interrupt return to soft-disabled context
Date: Mon, 04 Dec 2017 10:12:02 -0600	[thread overview]
Message-ID: <1512403922.2224.82.camel@kernel.crashing.org> (raw)
In-Reply-To: <87d13v3wpm.fsf@concordia.ellerman.id.au>

On Mon, 2017-12-04 at 16:09 +1100, Michael Ellerman wrote:
> Nicholas Piggin <npiggin@gmail.com> writes:
> 
> > When an interrupt is returning to a soft-disabled context (which can
> > happen for non-maskable interrupts or synchronous interrupts), it goes
> > through the motions of soft-disabling again, including calling
> > TRACE_DISABLE_INTS (i.e., trace_hardirqs_off()).
> > 
> > This is not necessary, because we must already be soft-disabled in the
> > interrupt context, it also may be causing crashes in the irq tracing
> > code to re-enter as an nmi. Replace it with a warning to ensure that
> > soft-interrupts are still disabled.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >  arch/powerpc/kernel/entry_64.S | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> So this patch is the core of the bug fix I gather.
> 
> Git blames says:
> 
>   Fixes: 7c0482e3d055 ("powerpc/irq: Fix another case of lazy IRQ state getting out of sync")
>   Cc: stable@vger.kernel.org # v3.4+
> 
> But I'm wondering how this has been broken that long without us
> noticing? You hit it doing some sort of perf stress test I think - so is
> it just that we've never pushed hard enough? Or did something change to
> expose this? Or we're just not sure?

We have some traps that do local_irq_enable ... you may want to double
check instruction emu, page faults, alignment etc... I wouldn't be
surprised if we have case where an interrupt "returns" soft enabled.

> cheers
> 
> > diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> > index 3320bcac7192..36878b6ee8b8 100644
> > --- a/arch/powerpc/kernel/entry_64.S
> > +++ b/arch/powerpc/kernel/entry_64.S
> > @@ -911,9 +911,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
> >  	beq	1f
> >  	rlwinm	r7,r7,0,~PACA_IRQ_HARD_DIS
> >  	stb	r7,PACAIRQHAPPENED(r13)
> > -1:	li	r0,0
> > -	stb	r0,PACASOFTIRQEN(r13);
> > -	TRACE_DISABLE_INTS
> > +1:
> > +#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
> > +	/* The interrupt should not have soft enabled. */
> > +	lbz	r7,PACASOFTIRQEN(r13)
> > +1:	tdnei	r7,0
> > +	EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
> > +#endif
> >  	b	.Ldo_restore
> >  
> >  	/*
> > -- 
> > 2.15.0

  parent reply	other threads:[~2017-12-04 16:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 16:00 [PATCH 0/4] interrupt tracing fixes Nicholas Piggin
2017-11-16 16:00 ` [PATCH 1/4] powerpc: define __ARCH_IRQ_EXIT_IRQS_DISABLED Nicholas Piggin
2018-01-22  3:34   ` [1/4] " Michael Ellerman
2017-11-16 16:00 ` [PATCH 2/4] powerpc/64: do not trace irqs-off at interrupt return to soft-disabled context Nicholas Piggin
2017-12-04  5:09   ` Michael Ellerman
2017-12-04  6:07     ` Nicholas Piggin
2017-12-04 12:55       ` Michael Ellerman
2017-12-04 16:12     ` Benjamin Herrenschmidt [this message]
2017-12-05  5:52       ` Michael Ellerman
2017-12-12 11:39   ` [2/4] " Michael Ellerman
2017-11-16 16:00 ` [PATCH 3/4] cpuidle/powernv: avoid double irq enable coming out of idle Nicholas Piggin
2018-01-22  3:34   ` [3/4] " Michael Ellerman
2017-11-16 16:00 ` [PATCH 4/4] " Nicholas Piggin
2018-01-22  3:34   ` [4/4] " 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=1512403922.2224.82.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --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;
as well as URLs for NNTP newsgroup(s).