All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Nordell <tim.nordell@logicpd.com>
To: linux-omap@vger.kernel.org
Subject: Resume crash: MUSB interrupt routine interactions with omap2430_musb_set_vbus()
Date: Thu, 06 Sep 2012 08:35:47 -0500	[thread overview]
Message-ID: <5048A6B3.8030503@logicpd.com> (raw)

All -

We've been doing some suspend/resume testing and found that on occasion 
(on the order of 1 in 5000 cycles) the system would lock up.  The 
problem was traced into the MUSB subsystem.  Specifically, the interrupt 
requested inside musb_core.c is of the non-threaded type (e.g. it runs 
in the interrupt context).

...
         /* attach to the IRQ */
         if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
                 dev_err(dev, "request_irq %d failed!\n", nIrq);
                 status = -ENODEV;
                 goto fail3;
         }
...

Later inside the interrupt context of the routine musb_stage0_irq() it 
has the following call:

...
         /* see manual for the order of the tests */
         if (int_usb & MUSB_INTR_SESSREQ) {
...
                 musb_platform_set_vbus(musb, 1);
...
         }
...

which in turn calls

static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
{
         struct usb_otg  *otg = musb->xceiv->otg;
         u8              devctl;
         unsigned long timeout = jiffies + msecs_to_jiffies(1000);
...
                         while (musb_readb(musb->mregs, MUSB_DEVCTL) & 
0x80) {

                                 cpu_relax();

                                 if (time_after(jiffies, timeout)) {
                                         dev_err(musb->controller,
                                         "configured as A device timeout");
                                         ret = -EINVAL;
                                         break;
                                 }
                         }
...

When the system is getting into that routine, it's a superfluous event. 
  E.g. there wasn't actually anything that should have triggered the 
interrupt (nothing is plugged into the USB port).  If the timeout were 
functional, it would have eventually timed out but jiffies are not 
incrementing in the given context.  Additionally, 1 second is a _long_ 
time to wait in an interrupt routine that is not threaded.

So the question becomes to those familiar with the subsystem:  What is 
the proper fix?  Before the patch that introduced the jiffy timeout 
(594632efbb usb: musb: Adding musb support for OMAP4430 - author Hema HK 
<hemahk@ti.com>), it seemed okay for the routine in question to not have 
a 1 second timeout in an interrupt context.

- Tim


             reply	other threads:[~2012-09-06 13:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 13:35 Tim Nordell [this message]
2012-09-06 13:45 ` Resume crash: MUSB interrupt routine interactions with omap2430_musb_set_vbus() Tim Nordell

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=5048A6B3.8030503@logicpd.com \
    --to=tim.nordell@logicpd.com \
    --cc=linux-omap@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 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.