Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp968761pxp; Wed, 16 Mar 2022 22:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLXDSP/MFi1kTobs/LNeKVLXJvxCbxlNBzAGtC1yOR7PmnqweUcOjlXQm64Pv/HYqRP0dY X-Received: by 2002:a65:49cc:0:b0:372:a079:cb3a with SMTP id t12-20020a6549cc000000b00372a079cb3amr2414121pgs.222.1647496771050; Wed, 16 Mar 2022 22:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647496771; cv=none; d=google.com; s=arc-20160816; b=kR6nbdxfc/0I2xqdSjiQN2uoqu1OY4zNNXC3spwUuPA/XrGSEHgdzOQzd4YTSRgRY7 1+KoRo1KgvQ/Pjellvicnd1p1Ydf4m+j5YeKdZY9Oe++WmY3FW+tFne0DV4xpssa6het lAiMqOZMbztnnIofR06rrNHyi4+bkujIBKgNsAu6wf3kIQKUmmxqfcfm/aEhbXQdxRd4 EzLc6HsJYxxUWpDT0TytWx3bPi8W3vJBsh3tfIu0FXCv5PdP6w3CKFI4GNCLUpiVl54T HV0A0mqMGSmV50+KNTdtR0z1GVjjtL13L8lWN1xT4Tn0B38n0J4JDDF/fE+oVDdSOwmm gmeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=uOQSdc6hVqj5xhDiJ8JAsztWE56MET11rHBMBhfXrEY=; b=LaLjTdVSsYzz3WawAkMgIGXlAAAmNJnA8BPknUESSac0fQlZOjcDVllsFbuL5UTvQH UG3fUp14GtxC/PkVlzfxYcn762phSQ1JAUFyrq3UUlwEiGgJkDr6hxHtzEYtjwIQCQpN J1L3IpXK85m22D8wTD9g61j+LIHMXF7xn8GEuKR87vexvnY/9vpntSGJ+4PaGLekzPfU TF0bBCimoVtYPSxdNmV+q6rDYFM28LQ0y5NYn7NlITieaZTYvFxec7OndHnhWwCv515C zj9/wtMBhCutQH1dLyGdAZSxdkpPj8IB4j+67qYhFBCZP2wqZhpBufo0+s1tRuUUr2UT 4miw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w12-20020a170902e88c00b00153db4c8ccesi2105389plg.62.2022.03.16.22.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:59:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6D2DE1FC9DA; Wed, 16 Mar 2022 21:58:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353438AbiCQCo2 (ORCPT + 99 others); Wed, 16 Mar 2022 22:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236570AbiCQCo1 (ORCPT ); Wed, 16 Mar 2022 22:44:27 -0400 Received: from ZXSHCAS2.zhaoxin.com (ZXSHCAS2.zhaoxin.com [203.148.12.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2D3DF96; Wed, 16 Mar 2022 19:43:10 -0700 (PDT) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Thu, 17 Mar 2022 10:43:07 +0800 Received: from [10.29.8.49] (10.29.8.49) 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; Thu, 17 Mar 2022 10:43:05 +0800 Message-ID: Date: Thu, 17 Mar 2022 10:43:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] USB: Fix xhci ERDP update issue Content-Language: en-US To: Mathias Nyman , , , , , CC: , , , References: <3c576edf-89c3-ccf3-a43f-4ce2c1ced18d@zhaoxin.com> <261420fb-28b4-0def-a9e1-9c011bab7912@linux.intel.com> <1882dfc1-0f46-a594-d75b-b73d30f6d6db@zhaoxin.com> <6c11dc4f-4984-e7aa-9fc5-7026100b38e1@linux.intel.com> From: "WeitaoWang-oc@zhaoxin.com" In-Reply-To: <6c11dc4f-4984-e7aa-9fc5-7026100b38e1@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.29.8.49] 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, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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/16 21:20, Mathias Nyman wrote: > On 15.3.2022 14.44, WeitaoWang-oc@zhaoxin.com wrote: >> 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 >>> > > 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 > .