linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"Chris.Packham@alliedtelesis.co.nz" 
	<Chris.Packham@alliedtelesis.co.nz>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: fsl_espi errors on v5.7.15
Date: Mon, 7 Sep 2020 15:38:37 +0000	[thread overview]
Message-ID: <a6bae2a775c3e6b9115a1371157404c4e0f8a73a.camel@infinera.com> (raw)
In-Reply-To: <23d13439e4cc1872c29db2f93e715a61f4843943.camel@infinera.com>

[SNIP]
> > 

> > > Would you be able to ftrace the interrupt handler function and see if you
> > > can see a difference in number or timing of interrupts? I'm at a bit of
> > > a loss.
> > 
> > I tried ftrace but I really wasn't sure what I was looking for.
> > Capturing a "bad" case was pretty tricky. But I think I've identified a
> > fix (I'll send it as a proper patch shortly). The gist is
> > 
> > diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
> > index 7e7c92cafdbb..cb120b68c0e2 100644
> > --- a/drivers/spi/spi-fsl-espi.c
> > +++ b/drivers/spi/spi-fsl-espi.c
> > @@ -574,13 +574,14 @@ static void fsl_espi_cpu_irq(struct fsl_espi
> > *espi, u32 events)
> >   static irqreturn_t fsl_espi_irq(s32 irq, void *context_data)
> >   {
> >          struct fsl_espi *espi = context_data;
> > -       u32 events;
> > +       u32 events, mask;
> > 
> >          spin_lock(&espi->lock);
> > 
> >          /* Get interrupt events(tx/rx) */
> >          events = fsl_espi_read_reg(espi, ESPI_SPIE);
> > -       if (!events) {
> > +       mask = fsl_espi_read_reg(espi, ESPI_SPIM);
> > +       if (!(events & mask)) {
> >                  spin_unlock(&espi->lock);
> >                  return IRQ_NONE;
> >          }
> > 
> > The SPIE register contains the TXCNT so events is pretty much always
> > going to have something set. By checking events against what we've
> > actually requested interrupts for we don't see any spurious events.
> > 
> > I've tested this on the T2080RDB and on our custom hardware and it seems
> > to resolve the problem.
> > 
> 
> I looked at the fsl_espi_irq() too and noticed that clearing of the IRQ events
> are after processing TX/RX. That looks a bit odd to me.

I should have been more specific. I think you can loose IRQs as fsl_espi_irq() works now.
Consider this:
1) You get TX IRQ and enter fsl_espi_irq()
2) Enter fsl_espi_fill_tx_fifo() to process any chars until done.
3) Now you get one more TX IRQ
4) fsl_espi_irq() clear events -> IRQ from 3) is lost.

 Jocke

  reply	other threads:[~2020-09-07 15:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14  2:48 fsl_espi errors on v5.7.15 Chris Packham
2020-08-14  6:19 ` Heiner Kallweit
2020-08-16 21:09   ` Chris Packham
2020-08-18 22:44     ` Chris Packham
2020-08-19  6:15       ` Heiner Kallweit
2020-08-19 21:08         ` Chris Packham
2020-08-24 22:04           ` Chris Packham
2020-08-25  3:54             ` Chris Packham
2020-08-25  7:22               ` Heiner Kallweit
2020-08-25 22:22                 ` Chris Packham
2020-08-26  1:48                   ` Chris Packham
2020-08-26  6:07                     ` Chris Packham
2020-08-26  6:38                       ` Heiner Kallweit
2020-08-26 22:26                         ` Chris Packham
2020-08-27  7:12                         ` Nicholas Piggin
2020-08-27 22:07                           ` Chris Packham
2020-08-30 12:30                             ` Nicholas Piggin
2020-08-30 13:55                               ` Heiner Kallweit
2020-08-30 21:00                               ` Chris Packham
2020-08-30 21:41                                 ` Heiner Kallweit
2020-08-30 21:59                                   ` Chris Packham
2020-08-31 12:33                                     ` Heiner Kallweit
2020-09-01  1:25                                       ` Chris Packham
2020-09-01  6:14                                         ` Nicholas Piggin
2020-09-01 23:29                                           ` Chris Packham
2020-09-01 23:31                                             ` Chris Packham
2020-09-03 23:58                                           ` Chris Packham
     [not found]                                             ` <CAFSsGVvRMQoEoBN1hpao_4uM1yF2wwuKPbMkAcwFWyE1X8HDbQ@mail.gmail.com>
2020-09-06 21:03                                               ` Chris Packham
2020-09-07  9:53                                             ` Joakim Tjernlund
2020-09-07 15:38                                               ` Joakim Tjernlund [this message]
2020-09-01  2:52                                       ` Chris Packham
2020-09-01  7:38                                         ` Heiner Kallweit

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=a6bae2a775c3e6b9115a1371157404c4e0f8a73a.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=benh@kernel.crashing.org \
    --cc=broonie@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.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).