Re: [PATCH 1/3] usb: ehci: remove wmb in qh_update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2 Sep 2011, Ming Lei wrote:

> On Wed, Aug 31, 2011 at 11:05 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > You might want to remove also the first wmb() in qh_append_tds().
> 
> I think the first wmb() is used to order the two writing:
> 
>                        qtd->hw_token = HALT_BIT(ehci);
>                        wmb ()
>                        *dummy = *qtd;
> 
> Since dummy has been in hw queue already and must see halt bit of hw_token
> first, the barrier should be kept, otherwise the transaction represented by qtd
> may be executed too early and qtd->hw_next is still not ready.

The transaction represented by qtd can't be executed before the
transaction represented by dummy, since qtd gets spliced at the end of
the transaction list (it becomes the new dummy).  The transaction
represented by dummy won't be executed until after dummy->hw_token is
set to token, and there's already a memory barrier before that
instruction.  This memory barrier will insure that qtd->hw_token is
ready in time.

Alan Stern

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux