On Mon, 4 Jan 2010, Sean wrote:

> Alan Stern wrote:
> > Try inserting a line saying:
> >
> >     td_check(ohci, hash, "#2c");
> >
> > two lines above the #2b line, i.e., just after the wmb().  That'll help 
> > narrow down the search for the bug.
> Alan,
> 
> I put the extra line in and ran capture-example twice. This is what I got:
>  
> ohci_hcd 0000:00:0b.0: Circular pointer #2c: 32 c6782800 c66a4800 c6782800
> ohci_hcd 0000:00:0b.0: Circular pointer #2c: 1 c6782040 c66a4040 c6782040
...

All right.  Let's try this patch in place of all the others, then.

Alan Stern


Index: usb-2.6/drivers/usb/host/ohci-q.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ohci-q.c
+++ usb-2.6/drivers/usb/host/ohci-q.c
@@ -505,6 +505,7 @@ td_fill (struct ohci_hcd *ohci, u32 info
        struct urb_priv         *urb_priv = urb->hcpriv;
        int                     is_iso = info & TD_ISO;
        int                     hash;
+       volatile struct td      * volatile td1, * volatile td2;
 
        // ASSERT (index < urb_priv->length);
 
@@ -558,11 +559,30 @@ td_fill (struct ohci_hcd *ohci, u32 info
 
        /* hash it for later reverse mapping */
        hash = TD_HASH_FUNC (td->td_dma);
+
+       td1 = ohci->td_hash[hash];
+       td2 = NULL;
+       if (td1) {
+               td2 = td1->td_hash;
+               if (td2 == td1 || td2 == td) {
+                       ohci_err(ohci, "Circular hash: %d %p %p %p\n",
+                                       hash, td1, td2, td);
+                       td2 = td1->td_hash = NULL;
+               }
+       }
+
        td->td_hash = ohci->td_hash [hash];
        ohci->td_hash [hash] = td;
 
        /* HC might read the TD (or cachelines) right away ... */
        wmb ();
+
+       if (td1 && td1->td_hash != td2) {
+               ohci_err(ohci, "Hash value changed: %d %p %p %p\n",
+                                       hash, td1, td2, td);
+               td1->td_hash = (struct td *) td2;
+       }
+
        td->ed->hwTailP = td->hwNextTD;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to