From: Alan Stern <stern@rowland.harvard.edu>
To: Doug Anderson <dianders@chromium.org>
Cc: Frank Mori Hess <fmh6jj@gmail.com>,
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
John Youn <John.Youn@synopsys.com>,
Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"# 4.0+" <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc2: Fix shutdown callback in platform
Date: Fri, 29 May 2020 15:00:31 -0400 [thread overview]
Message-ID: <20200529190031.GA2271@rowland.harvard.edu> (raw)
In-Reply-To: <CAD=FV=XsLA3w2QPcNF3-mgZbZoGsz4kg_QvHcoZV=XTVDYhnSg@mail.gmail.com>
On Fri, May 29, 2020 at 11:45:53AM -0700, Doug Anderson wrote:
> Hi,
>
> On Fri, May 29, 2020 at 11:21 AM Frank Mori Hess <fmh6jj@gmail.com> wrote:
> >
> > On Fri, May 29, 2020 at 1:53 PM Doug Anderson <dianders@chromium.org> wrote:
> > > >
> > > > I don't get it. A hypothetical machine could have literally anything
> > > > sharing the IRQ line, right?
> > >
> > > It's not a real physical line, though? I don't think it's common to
> > > have a shared interrupt between different IP blocks in a given SoC.
> > > Even if it existed, all the drivers should disable their interrupts?
> >
> > I don't know, it's a hypothetical machine so it can be whatever you
> > want. The driver requests shared irqs, if it doesn't actually support
> > irq sharing, it shouldn't request them.
>
> I guess? As I understood it drivers have to be very carefully coded
> up to support sharing their IRQ with someone else and I'm not
> convinced dwc2 does that anyway. Certainly it doesn't hurt to keep
> dwc2 clean, but until I see someone that's actually sharing dwc2's
> interrupt and I can actually see an example I'm not sure I'm going to
> spend too much time thinking about it.
This is silly. If the driver says it supports shared IRQs, then it
should actually support them.
> > > > Anyways, my screaming interrupt occurs after a a new kernel has been
> > > > booted with kexec. In this case, it doesn't matter if the old kernel
> > > > called disable_irq or not. As soon as the new kernel re-enables the
> > > > interrupt line, the kernel immediately disables it again with a
> > > > backtrace due to the unhandled screaming interrupt. That's why the
> > > > dwc2 hardware needs to have its interrupts turned off when the old
> > > > kernel is shutdown.
> > >
> > > Isn't that a bug with your new kernel? I've seen plenty of bugs where
> > > drivers enable their interrupt before their interrupt handler is set
> > > to handle it. You never know what state the bootloader (or previous
> > > kernel) might have left things in and if an interrupt was pending it
> > > shouldn't kill you.
> >
> > It wouldn't hurt to add disabling of the dwc2 irq early in dwc2
> > initialization,
>
> More than it not hurting, I'd consider it a bug in the driver (and a
> much more serious one than shutdown not disabling the interrupt).
Normally the first thing a driver would do is reset the hardware, and
that reset should disable any interrupt source.
> > but why leave the irq screaming after shutdown?
>
> Sure. So I guess the answer is to just do both disable the interrupt
> and make sure that the interrupt handler has finished.
>
> dwc2_disable_global_interrupts(hsotg);
> disable_irq(hsotg->irq);
Drivers with shared IRQs don't call disable_irq(); they call
synchronize_irq(). It will do what you want (wait until all running
handlers have returned).
Alan Stern
next prev parent reply other threads:[~2020-05-29 19:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 11:56 [PATCH] usb: dwc2: Fix shutdown callback in platform Minas Harutyunyan
2020-05-29 14:49 ` Doug Anderson
[not found] ` <0f6b1580-41d8-b7e7-206b-64cda87abfd5@synopsys.com>
2020-05-29 16:37 ` Doug Anderson
2020-05-29 17:44 ` Frank Mori Hess
2020-05-29 17:52 ` Doug Anderson
2020-05-29 18:21 ` Frank Mori Hess
2020-05-29 18:45 ` Doug Anderson
2020-05-29 19:00 ` Alan Stern [this message]
2020-05-29 19:07 ` Doug Anderson
[not found] ` <52f936c5-7f3f-5da0-33b8-3e6d4a4008d1@synopsys.com>
2020-05-29 19:45 ` Frank Mori Hess
2020-05-29 19:46 ` Doug Anderson
[not found] ` <f68ce0c2-7014-64ff-73e3-94d93897e3b2@synopsys.com>
2020-05-29 20:29 ` Frank Mori Hess
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=20200529190031.GA2271@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=John.Youn@synopsys.com \
--cc=Minas.Harutyunyan@synopsys.com \
--cc=balbi@kernel.org \
--cc=dianders@chromium.org \
--cc=fmh6jj@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.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