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

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

 



Hi,

On Fri, Sep 2, 2011 at 9:58 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 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

I understand dummy is already linked in ehci hw queue, so if
' *dummy = *qtd;' is executed before 'qtd->hw_token = HALT_BIT(ehci);',
dummy will be executed by EHCI. That is the reason why I think the 1st
wmb() shouldn't be removed, right?

> 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.



thanks,
-- 
Ming Lei
--
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