All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Jeffery <djeffery@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org, Laurence Oberman <loberman@redhat.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Ewan Milne <emilne@redhat.com>,
	apanagio@redhat.com, torez@redhat.com
Subject: Re: [PATCH] usb: ehci: Prevent missed ehci interrupts with edge-triggered MSI
Date: Wed, 14 Jul 2021 12:10:26 -0400	[thread overview]
Message-ID: <CA+-xHTGb73f_nCHg=D0qyFp2v-UaCpyisdbWvoUKTaVB077Zeg@mail.gmail.com> (raw)
In-Reply-To: <20210714142923.GA380727@rowland.harvard.edu>

On Wed, Jul 14, 2021 at 10:29 AM Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Wed, Jul 14, 2021 at 10:03:09AM -0400, David Jeffery wrote:

> >
> > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> > index 36f5bf6a0752..2283205d4b40 100644
> > --- a/drivers/usb/host/ehci-hcd.c
> > +++ b/drivers/usb/host/ehci-hcd.c
> > @@ -704,14 +704,18 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
> >  {
> >       struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
> >       u32                     status, masked_status, pcd_status = 0, cmd;
> > +     u32                     current_status;
> >       int                     bh;
> >
> >       spin_lock(&ehci->lock);
> >
> > -     status = ehci_readl(ehci, &ehci->regs->status);
> > +     status = 0;
> >
> > +     current_status = ehci_readl(ehci, &ehci->regs->status);
> > +restart:
> > +     status |= current_status;
> >       /* e.g. cardbus physical eject */
> > -     if (status == ~(u32) 0) {
> > +     if (current_status == ~(u32) 0) {
> >               ehci_dbg (ehci, "device removed\n");
> >               goto dead;
> >       }
>
> Mild stylistic quibble: I generally prefer to have a blank line before a
> /* ... */ comment.  And it doesn't seem reasonable to have a blank line
> between "status = 0" and the current_status assignment, since those are
> similar once-only things before the beginning of the "restart" loop.
> Also, I would move the "status |= current_status" line after the test
> for device removed, since that test doesn't use status.
>
> But obviously none of these things affect the patch's correntness.

I'll update it with requested changes and resend it.

>
> You can choose to submit a new version of the patch with those stylistic
> changes, or if you prefer, just stick with this version.  Either way,
>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>
> Does this issue affect any other PCI-based host controller drivers?
>
> Alan Stern
>

Possibly.  The uhci driver should have the same issue if hardware
exists with it and has MSI for it.  I suspect the ohci driver has a
similar issue, but I'm not familiar enough with its interfaces and
specification to say for sure.

David Jeffery


  reply	other threads:[~2021-07-14 16:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 14:03 [PATCH] usb: ehci: Prevent missed ehci interrupts with edge-triggered MSI David Jeffery
2021-07-14 14:27 ` Andy Shevchenko
2021-07-14 15:55   ` David Jeffery
2021-07-14 19:35     ` Andy Shevchenko
2021-07-14 14:29 ` Alan Stern
2021-07-14 16:10   ` David Jeffery [this message]
2021-07-14 16:27     ` Alan Stern

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='CA+-xHTGb73f_nCHg=D0qyFp2v-UaCpyisdbWvoUKTaVB077Zeg@mail.gmail.com' \
    --to=djeffery@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=apanagio@redhat.com \
    --cc=emilne@redhat.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=stern@rowland.harvard.edu \
    --cc=torez@redhat.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.