lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <edfa2f91-80e9-fa05-3a91-9c22ce223f29@zhaoxin.com>
Date:   Thu, 17 Mar 2022 10:43:04 +0800
From:   "WeitaoWang-oc@...oxin.com" <WeitaoWang-oc@...oxin.com>
To:     Mathias Nyman <mathias.nyman@...ux.intel.com>,
        <mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
        <stern@...land.harvard.edu>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <CobeChen@...oxin.com>, <TimGuo@...oxin.com>,
        <tonywwang@...oxin.com>, <weitaowang@...oxin.com>
Subject: Re: [PATCH] USB: Fix xhci ERDP update issue

On 2022/3/16 21:20, Mathias Nyman wrote:
> On 15.3.2022 14.44, WeitaoWang-oc@...oxin.com wrote:
>> On 2022/3/15 下午4:08, Mathias Nyman wrote:
>>> On 14.3.2022 9.25, WeitaoWang-oc@...oxin.com wrote:
>>>> On some situations, software handles TRB events slower than adding TRBs,
>>>> xhci_irq will not exit until all events are handled. If xhci_irq just
>>>> handles 256 TRBs and exit, the temp variable(event_ring_deq) driver records in xhci irq is equal to driver current dequeue pointer. It will cause driver not update ERDP and software dequeue pointer lost sync with ERDP. On the next xhci_irq, the event ring is full but driver will not update ERDP as software dequeue pointer is equal to ERDP.
>>>>
>>>> [  536.377115] xhci_hcd 0000:00:12.0: ERROR unknown event type 37
>>>> [  566.933173] sd 8:0:0:0: [sdb] tag#27 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
>>>> [  566.933181] sd 8:0:0:0: [sdb] tag#27 CDB: Write(10) 2a 00 17 71 e6 78 00 00 08 00
>>>> [  572.041186] xhci_hcd On some situataions,the0000:00:12.0: xHCI host not responding to stop endpoint command.
>>>> [  572.057193] xhci_hcd 0000:00:12.0: Host halt failed, -110
>>>> [  572.057196] xhci_hcd 0000:00:12.0: xHCI host controller not responding, assume dead
>>>> [  572.057236] sd 8:0:0:0: [sdb] tag#26 uas_eh_abort_handler 0 uas-tag 6 inflight: CMD
>>>> [  572.057240] sd 8:0:0:0: [sdb] tag#26 CDB: Write(10) 2a 00 38 eb cc d8 00 00 08 00
>>>> [  572.057244] sd 8:0:0:0: [sdb] tag#25 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD
>>>>
>>>> Fixed this issue by update software record temp variable when handles 128 TRB events.>
>>>> Signed-off-by: Weitao Wang <WeitaoWang-oc@...oxin.com>
>>>
>>> Thanks
>>>
>>> Solution itself looks good but patch has some minor format issue:
>>>
>>>
>>> It would also be interesting to know if the full event ring was triggered in a real
>>> life usecase?
>>> If that is the case I might need to look more into it.
>>>
>>> Bigger event ring, more rings, faster handler, avoid irqoff time...
>>>
>>> Thanks
>>> Mathias
>>> .
>> Some performance test tools such as fio or iometer can be used to reproduce
>>   this case, If tested with 4KB read or write. xHCI will generate a lost TRB
>>   events fast than software consume on a certain period of time. Once the interrupt is entered, software may handle more than 128 TRBs at a time.
>> While the software is processing, xHCI is still generating events. This may
>> has problems caused by the ERDP update mechanism. If update software
>>   record temp variable when handles 128 TRB events, event ring full will not
>>   happen any more even though fio test with 4KB read or write.
>>
>> Thanks
>> Weitao Wang
>>>
> 
> Thanks for the clarification.
> 
> Could you resubmit this after fixing the minor patch format issue?
> Also make sure patch passes checkpatch test
> 
> Thanks
> -Mathias

All right, I'll resubmit this patch.Thanks for your help.

Weitao Wang
> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ