Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp441247pxp; Wed, 16 Mar 2022 08:49:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM0pdYTQ8wAUJ5QWXAitrGkRmlVYLWST8iAeDcglynLnxCjkdcNP/vbCLXuJ8TWqvCHgEC X-Received: by 2002:aa7:d991:0:b0:416:5f6c:e260 with SMTP id u17-20020aa7d991000000b004165f6ce260mr134000eds.268.1647445752194; Wed, 16 Mar 2022 08:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647445752; cv=none; d=google.com; s=arc-20160816; b=ZOALTcGmFtRxU2vp9VT1ZbSNiw5Euc9RZ67Vyt4SwAnxGdOgFMXuNlSa2/hLTkjLxy UOqvtJaCMl5hex8egEF5KeIUvycUpV5qR/xGChJsyU4tRBvke+AUBTc08KwiN5ikyN3P 1Wf2fUnKs2Uh4OqH5HBQThHYbYjwUIIxhX+p0X8yG4JlMThh2P3UjfqLy7c9KjPq4oce zf6nGt3QVeady+Ar5hU8XRRXmFIfrng1P5yf4+Nu+Sn34xhN7cTugSap1D1/KTODvC4q rmVNFLFh4+3guhD8xIT/KH0hP6WgT/YWR62bhVNyjk82Bywgprq8eHnYCPLv4M1YSXfR zdDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=JrmKqzaNwXV6XXbCMOZ3jiMxgrMpyRwRD2eG6CVyD/c=; b=Ph5/trG1pX04T678ERnrNFSjAfbYMPY05AyGlYYLjIP+TtsWpBLzylI4ZkaL9B3wd1 m8vobYjiJUmDn7xXFJeIjzN4nLS0RSbltpAQu2ZrgYvKD56xq7SuK1jNL9/0mN8w80Er HD6+BA2cE8S6nA4ZdWGqZtknp68nSvThXYkCmgtB6J3AvU/dFyHPQcuw3g2ZUusvmqT1 4f2rS+ReMLPE7w/7vPZ9dNPcZNp7mZ9yAjJPE7uV44yjEljF/KWY7XCj4/J5r+Xj7sXW GlZhzgULszKrU7UHdjBNwCU+NxC4ltSancfAwiynzsY2oGJ8mZgadcwDf92exXzcz0hV WvBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo27-20020a0564020b3b00b00418eceb48aasi862225edb.20.2022.03.16.08.48.45; Wed, 16 Mar 2022 08:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348409AbiCOMpi (ORCPT + 99 others); Tue, 15 Mar 2022 08:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiCOMpg (ORCPT ); Tue, 15 Mar 2022 08:45:36 -0400 Received: from ZXSHCAS1.zhaoxin.com (ZXSHCAS1.zhaoxin.com [203.148.12.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BCEC37BC2; Tue, 15 Mar 2022 05:44:21 -0700 (PDT) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 15 Mar 2022 20:44:16 +0800 Received: from [10.29.8.53] (10.29.8.53) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 15 Mar 2022 20:44:15 +0800 Subject: Re: [PATCH] USB: Fix xhci ERDP update issue To: Mathias Nyman , , , , , CC: , , , References: <3c576edf-89c3-ccf3-a43f-4ce2c1ced18d@zhaoxin.com> <261420fb-28b4-0def-a9e1-9c011bab7912@linux.intel.com> From: "WeitaoWang-oc@zhaoxin.com" Message-ID: <1882dfc1-0f46-a594-d75b-b73d30f6d6db@zhaoxin.com> Date: Tue, 15 Mar 2022 20:44:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <261420fb-28b4-0def-a9e1-9c011bab7912@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.29.8.53] X-ClientProxiedBy: ZXSHCAS1.zhaoxin.com (10.28.252.161) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/3/15 下午4:08, Mathias Nyman wrote: > On 14.3.2022 9.25, WeitaoWang-oc@zhaoxin.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 > > 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 >