linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: David Brownell <david-b@pacbell.net>, Greg KH <greg@kroah.com>,
	vojtech@suse.cz, linux-usb-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	pochini@shiny.it, davidm@hpl.hp.com
Subject: Re: [linux-usb-devel] Re: serious 2.6 bug in USB subsystem?
Date: Fri, 5 Mar 2004 23:21:32 -0800	[thread overview]
Message-ID: <16457.31740.99944.563029@napali.hpl.hp.com> (raw)
In-Reply-To: <16457.26208.980359.82768@napali.hpl.hp.com>

>>>>> On Fri, 5 Mar 2004 21:49:20 -0800, David Mosberger <davidm@linux.hpl.hp.com> said:

  David> It's not an issue of DMA coherency, it's an issue of DMA
  David> vs. interrupt ordering.  I believe the WHD interrupt is
  David> arriving at the CPU before the DMA update to the HCCA is
  David> done.

Actually, it looks like I misunderstood the OHCI spec on first reading.
It seems like the causal relationship goes like this:

 (1) Start of Frame -> (2) update HccaFrameNumber -> (3) trigger SF interrupt

Now, suppose you get a WDH interrupt between (1) and (2).  You'd read
the old frame-number yet by the time the interrupt from (3) arrives
the HC might already be accessing the ED that you're about to remove.

If this is correct, then the first patch is probably a better
approach:

===== drivers/usb/host/ohci-q.c 1.48 vs edited =====
--- 1.48/drivers/usb/host/ohci-q.c	Tue Mar  2 05:52:46 2004
+++ edited/drivers/usb/host/ohci-q.c	Fri Mar  5 17:25:55 2004
@@ -438,7 +451,7 @@
 	 * behave.  frame_no wraps every 2^16 msec, and changes right before
 	 * SF is triggered.
 	 */
-	ed->tick = OHCI_FRAME_NO(ohci->hcca) + 1;
+	ed->tick = OHCI_FRAME_NO(ohci->hcca) + 2;
 
 	/* rm_list is just singly linked, for simplicity */
 	ed->ed_next = ohci->ed_rm_list;

This actually makes tons of sense if you think of it like jiffies: you
need to make sure you delay at least one full frame-interval.  If you
set the tick to "+ 1" and the current tick is almost over, that
requirement is violated.  Setting it to "+ 2" should be safe.  The
only problem I can think of is if the delay between point (1) and (2)
were to exceed one frame-interval (1 msec).  While unlikely, the right
PCI topology and heavy bus traffic perhaps could cause such delays.
However, even then it's probably OK because the HC would presumably
stall when trying to update the HccaFrameNumber the second time and
the previous update hasn't completed yet.

Here is one little piece of evidence that's consistent with this
explanation: last week I tried to rip some audio tracks off a CD.
With PIO, this caused interrupts to get delayed 2-3msec and that
caused all kinds of weird effects on the USB bus.  Mostly, I'd
suddenly lose the keyboard or the mouse, though reconnecting them
would "fix" the problem for a short time.

	--david

  reply	other threads:[~2004-03-06  7:21 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-27 22:35 serious 2.6 bug in USB subsystem? David Mosberger
2003-10-28  1:30 ` Greg KH
2003-10-28  3:00   ` David Mosberger
2003-10-30 15:11     ` [linux-usb-devel] " David Brownell
2003-10-30 20:15       ` David Mosberger
     [not found]         ` <16289.55171.278494.17172@napali.hpl.hp.com>
2003-10-31 16:23           ` David Brownell
2003-10-31 18:34             ` David Mosberger
2003-10-31 18:50               ` Valdis.Kletnieks
2003-10-31 19:28               ` David Brownell
2003-10-31 19:50                 ` David Mosberger
2003-10-31 20:06                   ` David S. Miller
2004-03-06  2:08             ` David Mosberger
2004-03-06  2:13               ` David Mosberger
2004-03-06  4:55               ` David Brownell
2004-03-06  5:49                 ` David Mosberger
2004-03-06  7:21                   ` David Mosberger [this message]
2004-03-06  8:39                     ` David Mosberger
2004-03-06 16:37                   ` David Brownell
2004-03-08  6:18                     ` Grant Grundler
2004-03-08 18:58                       ` David Mosberger
2004-03-08 21:48                         ` David Brownell
2004-03-09  9:15                           ` David Mosberger
2004-03-09 17:36                             ` David Brownell
2004-03-09 17:58                               ` David Mosberger
2004-03-09 20:39                                 ` David Brownell
2004-03-09 23:32                                   ` David Mosberger
2004-03-10  2:53                                     ` David Brownell
2004-03-10  6:11                                       ` David Mosberger
2004-03-10  6:59                                   ` David Mosberger
2004-03-10  7:52                                     ` Wouter Lueks
2004-03-10 16:49                                       ` David Mosberger
2004-03-10 19:49                                         ` Wouter Lueks
2004-03-10 16:22                                     ` David Brownell
2004-03-10 18:04                                       ` David Mosberger
2004-03-11  2:43                                         ` David Brownell
2004-03-11  5:35                                           ` David Mosberger
2004-03-10 19:29                                     ` Colin Leroy
2004-03-06  9:17                 ` [linux-usb-devel] " David Mosberger
2004-03-06 17:30                   ` David Brownell
2004-03-07 13:48                     ` Matthias Andree
2004-03-08 18:49                     ` David Mosberger
2003-11-03  3:46         ` David Brownell
2003-11-03 21:25           ` David Mosberger
2004-03-03 12:33 ` Wouter Lueks
2004-03-03 15:30   ` Wouter Lueks

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=16457.31740.99944.563029@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=david-b@pacbell.net \
    --cc=davidm@hpl.hp.com \
    --cc=greg@kroah.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=pochini@shiny.it \
    --cc=vojtech@suse.cz \
    /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).