public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mark Lord <lkml@rtr.ca>,
	pavel@suse.cz, oliver@neukum.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, jikos@suse.cz, gregkh@suse.de,
	akpm@linux-foundation.org
Subject: Re: [PATCH] usb ehci_iaa_watchdog fix
Date: Mon, 7 Apr 2008 16:37:16 -0700	[thread overview]
Message-ID: <200804071637.16864.david-b@pacbell.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0804021658170.2107-100000@iolanthe.rowland.org>

On Wednesday 02 April 2008, Alan Stern wrote:
> On Wed, 2 Apr 2008, David Brownell wrote:
> 
> > > It fixes the cause rather than the symptom.
> > 
> > I'm not sure I'd agree with that.
> 
> Really?  The logic seemed clear enough to me.
> 
>      1. Evidently the ehci_iaa_watchdog routine was getting called at a 
> 	time when the host controller wasn't running -- which had to
> 	have been after it was suspended.

The change to remove the HC_IS_RUNNING test meant that routine
would then work when hcd->state is HC_STATE_SUSPENDED or possibly
HC_STATE_RESUMING.  (Since those are the two states for which
HC_IS_RUNNING fails, other than HC_STATE_HALTED which shouldn't
be happening here...)

Now, prior to the now-merged patch that was skipping some work,
and that seemed to cause resume problems.  Making it not skip
the work made the resume behave (as did the now-merged patch).


>      2. But ehci_bus_suspend() calls end_unlink_async(), which turns
> 	off the IAA watchdog timer.

Not exactly.  First, ehci_bus_suspend() force the timer off all
by itself ... way too early, while things can still retrigger it.
That's a buggy idiom that should be fixed.  (As you've agreed,
elsewhere.)

Second, it doesn't always call end_unlink_async() ... only when
one or more async unlink is still pending.

Third, if it *does* call end_unlink_async(), it can retriger
the timer when it needs to do another unlink.  Only when the
HC is halted (HC_STATE_HALT) is that logic bypassed, scrubbing
several endpoints at once.  (And a minor fourth point, direct
calls to end_unlink_async leaves the IAA IRQ machinery active.)

I think your fix handles the "one pending unlink" case, but
not the more general "N pending unlinks" ...


>      3. Hence the timer must have been restarted later on while 
> 	ehci_bus_suspend() was still running.  The call to ehci_work() 
> 	appeared to be the only place that could have happened.

Removing the state check in the watchdog changed behavior, so the
HC must have been in one of the two states I listed above when
that watchdog fired (SUSPENDED or RESUMING).  And it had work to
do, which (because of the state check) it didn't do.


>      4. Thus moving the end_unlink_async() call to after ehci_work()
> 	(or just to be doubly safe, after ehci_halt() and the change
> 	to HC_STATE_SUSPENDED) should take care of all pending QH
> 	unlinks and leave none of them unfinished.

It takes care of *ONE* pending QH unlink.  If there's more than
one, it retriggers the timer, so this problem will reappear...


> Strictly speaking, it would be best to move the del_timer_sync() calls
> to after ehci_lock is released.  But it doesn't really matter if the
> timer routines get invoked after the controller is suspended.

When the timer would be retriggered, to finish additional unlinks,
it does matter.  A complete fix for this would (a) disable the IAA
watchdog timer later, once it can never be retriggered again, and
(b) make end_unlink_async handle the multiple-unlinks case when the
HC is suspended, including not retriggering the watchdog.

- Dave


> 
> Alan Stern
> 



  reply	other threads:[~2008-04-07 23:37 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 15:29 2.6.25-rc7: Ugh Mark Lord
2008-03-27 16:07 ` Greg KH
2008-03-28  0:32   ` Jiri Kosina
2008-03-28  1:57     ` Mark Lord
2008-03-28  3:12       ` David Miller
2008-03-28  4:42         ` Bob Tracy
2008-03-28  4:56           ` David Miller
2008-03-28  5:17             ` Mark Lord
2008-03-28  6:01               ` david
2008-03-28 16:34             ` Bob Tracy
2008-04-05 18:23             ` Bill Davidsen
2008-03-28  5:36         ` Mike Galbraith
2008-03-28  5:46         ` Mark Lord
2008-03-28  5:52           ` Mark Lord
2008-03-28  6:05             ` Mark Lord
2008-03-28  6:58               ` David Brownell
2008-03-28  9:16                 ` Ingo Molnar
2008-03-28  9:49                   ` David Brownell
2008-03-28 10:20                     ` Ingo Molnar
2008-03-28 11:01                       ` Pavel Machek
2008-03-28 15:03                       ` Jan Engelhardt
2008-03-28 20:14                         ` David Brownell
2008-03-28 12:51                     ` Kconfig RTC selection (was: 2.6.25-rc7: Ugh.) Tilman Schmidt
2008-03-28 13:49                       ` Kconfig RTC selection Mark Lord
2008-03-28 19:22                       ` Kconfig RTC selection (was: 2.6.25-rc7: Ugh.) David Brownell
2008-03-29 12:55                         ` Kconfig RTC selection Tilman Schmidt
2008-03-28 13:47                     ` 2.6.25-rc7: Ugh Mark Lord
2008-03-28 20:04                       ` Kconfig RTC selection (was: 2.6.25-rc7: Ugh.) David Brownell
2008-03-28 21:06                         ` Adrian Bunk
2008-03-28 21:23                           ` David Brownell
2008-03-28 21:33                             ` Adrian Bunk
2008-03-28 21:45                               ` David Brownell
2008-03-28 21:59                                 ` Adrian Bunk
2008-03-28 22:18                                   ` David Brownell
2008-03-28 22:36                                     ` Adrian Bunk
2008-03-29 11:40                                     ` [rtc-linux] " Alessandro Zummo
2008-03-28 14:56                     ` 2.6.25-rc7: Ugh Jan Engelhardt
2008-03-28 17:47                       ` Adrian Bunk
2008-03-29  3:58               ` Mark Lord
2008-03-28  1:51   ` Mark Lord
2008-03-28  2:11   ` Mark Lord
2008-03-28  2:13     ` Mark Lord
2008-03-28 14:34     ` Alan Stern
2008-03-28 14:57       ` Mark Lord
2008-03-27 22:00 ` Rafael J. Wysocki
2008-03-28  5:22   ` Mark Lord
2008-03-28  2:14 ` Mark Lord
2008-03-28  9:24   ` Pavel Machek
2008-03-30 21:04     ` Mark Lord
2008-03-30 21:09       ` Mark Lord
2008-03-31 11:55       ` Oliver Neukum
2008-03-31 14:39         ` Mark Lord
2008-03-31 15:04           ` Oliver Neukum
2008-03-31 15:04             ` Mark Lord
2008-03-31 15:14               ` Mark Lord
2008-03-31 16:37               ` Oliver Neukum
2008-03-31 17:03                 ` Mark Lord
2008-03-31 17:06                   ` Mark Lord
2008-03-31 17:15                   ` Mark Lord
2008-03-31 17:21                     ` Mark Lord
2008-03-31 17:30                       ` Mark Lord
2008-03-31 18:05                         ` Oliver Neukum
2008-03-31 19:21                           ` Mark Lord
2008-04-02  8:04                             ` Oliver Neukum
2008-04-02 14:38                               ` Mark Lord
2008-04-02 14:38                                 ` Mark Lord
2008-04-02 15:05                                   ` 2.6.25-rc7/rc8 USB dead on resume Mark Lord
2008-04-02 15:21                                     ` Oliver Neukum
2008-04-02 15:08                                   ` 2.6.25-rc7: Ugh Alan Stern
2008-04-02 15:44                                     ` 2.6.25-rc7: Ugh. ---> PATCH Mark Lord
2008-04-02 15:47                                       ` Mark Lord
2008-04-02 15:49                                         ` Mark Lord
2008-04-02 20:09                                       ` Alan Stern
2008-04-02 16:04                                     ` 2.6.25-rc7: Ugh David Brownell
2008-04-02 16:09                                       ` Mark Lord
2008-04-02 20:22                                         ` David Brownell
2008-04-02 16:20                                       ` [PATCH] usb ehci_iaa_watchdog fix Mark Lord
2008-04-02 16:48                                         ` Alan Stern
2008-04-02 17:34                                           ` Mark Lord
2008-04-02 18:08                                             ` Mark Lord
2008-04-02 19:20                                               ` Alan Stern
2008-04-02 20:42                                                 ` David Brownell
2008-04-02 21:08                                                   ` Alan Stern
2008-04-07 23:37                                                     ` David Brownell [this message]
2008-04-08  2:13                                                       ` Alan Stern
2008-04-02 20:31                                           ` David Brownell
2008-04-02 20:55                                             ` Alan Stern
2008-04-02 23:07                                               ` David Brownell
2008-04-02 16:56                                         ` David Brownell
2008-04-01  9:59                           ` 2.6.25-rc7: Ugh Pavel Machek

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=200804071637.16864.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=jikos@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkml@rtr.ca \
    --cc=oliver@neukum.org \
    --cc=pavel@suse.cz \
    --cc=stern@rowland.harvard.edu \
    /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