Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp933242pxp; Wed, 16 Mar 2022 21:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9/8mKTQP0NK/Ijl6hxfIKmsaZtjMarZbmiJw+7fRRVi/zcCtEvjwiF5dvKceFuuRWEUlm X-Received: by 2002:aa7:980a:0:b0:4f7:7ed:eae4 with SMTP id e10-20020aa7980a000000b004f707edeae4mr2899382pfl.22.1647492477560; Wed, 16 Mar 2022 21:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647492477; cv=none; d=google.com; s=arc-20160816; b=eKaAyP+KPDiYfIlQykAMxC5VILJyuXqhgs+QydjQWWhimUSrKwb2Ch+hSDqjXYs+YS vynAhyxFnxuQKLShLmgjGdo4ZJzVFBFzinWPunonMw1wFqf7ws9bslpN1B+ctHrnsIU7 Nyx5+2G1hcRP4DZCyJ2t+IcfU1eRTbfcltg+GticCA/jsK6vkBUgV/3tQb8DufLx9M3Y 2Gd+n+ekkt9Htnf1c8ESTSiyL9zKf6wGKGT26uwMVR1MaIuDQK/M9GkErjHz+rOotCNO gIIwvb9mjeGCcswsbyWodO/fpbkhqHUtYjlmGpZBrk05Wrp91f3ti/GKfY0YTTv7DVbg Q5yg== 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:subject:from :references:cc:to:dkim-signature; bh=mWB3CZLiH+/lk0vbrQji5BMeWa9BB0epJRCDxzqE2TI=; b=bkYwcW7rroZE/vX/exa5Rievpw06cv6+AqCPPWwm3hopbIqShhHwHhMZMNxVwccjVr +GMBZdDjI9JrVycIhLQnSYAeRSM0bhzCrG+CMVk/gzN+ACfea+tIL+bNz/eaHoEPbew4 Ec9kHBy3Z8IKoANMh6CuRTH+ebtQO/bhpgp4lD6It2rdtW26IXFImB478f5LDnWMOPF4 Aw8vDbLJbnQ3vMWbNLAt5Z38vm51nSlXfBvc7OeLAl+PLHiLtgcPz03gUvS62ZlyK9ef zHGl1RzDc4LSwQFkrQ5obi/H+zrBdJl6ATwayXZzX6I7mZOUQDtiSY4MdZ7MSE4edtIb eSbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NPYLy9lK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v10-20020a1709028d8a00b00153a4ea055csi3351544plo.187.2022.03.16.21.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NPYLy9lK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D1EA99EF2; Wed, 16 Mar 2022 21:08:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356308AbiCPNVi (ORCPT + 99 others); Wed, 16 Mar 2022 09:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356332AbiCPNVb (ORCPT ); Wed, 16 Mar 2022 09:21:31 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7855692B8; Wed, 16 Mar 2022 06:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647436747; x=1678972747; h=to:cc:references:from:subject:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=3gydTSfJJ0kj7X+pEx3OA6sK9bKnh0Gb6dYO4OHWtjw=; b=NPYLy9lK9jY8hOqyrqfYiffIpKlW9C57obYh/zuTqUXUJwiPllHUDbXQ TOKzIDMdqNlag2JaN6SBEdUxBtke4iLeJ1mBhte4PrW+BwaVvatiMekzb v0WTBum0j4QvDdjio25oiizpbmxk1BJIhQB2eut5h2m2Ff2uFKrtXy5DL FBjqPxZvmps3cPmF3nB9HzHT0ssU4hQGvyOVBwGtWRmdZei5p8gM2GsfV WXfMcn5n5orKEKAYWrzxg6ofSATCoyKBoDuDk1bQbKPSjCILAPjjk1LRT pJ2z0j9g3YBs/avUaiw5jBq+JMqIMq3zgSo1AvowAkky5GfHkbf3K7S/c A==; X-IronPort-AV: E=McAfee;i="6200,9189,10286"; a="343013016" X-IronPort-AV: E=Sophos;i="5.90,186,1643702400"; d="scan'208";a="343013016" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 06:19:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,186,1643702400"; d="scan'208";a="646642824" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.199]) ([10.237.72.199]) by orsmga004.jf.intel.com with ESMTP; 16 Mar 2022 06:18:58 -0700 To: "WeitaoWang-oc@zhaoxin.com" , mathias.nyman@intel.com, gregkh@linuxfoundation.org, stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: CobeChen@zhaoxin.com, TimGuo@zhaoxin.com, tonywwang@zhaoxin.com, weitaowang@zhaoxin.com References: <3c576edf-89c3-ccf3-a43f-4ce2c1ced18d@zhaoxin.com> <261420fb-28b4-0def-a9e1-9c011bab7912@linux.intel.com> <1882dfc1-0f46-a594-d75b-b73d30f6d6db@zhaoxin.com> From: Mathias Nyman Subject: Re: [PATCH] USB: Fix xhci ERDP update issue Message-ID: <6c11dc4f-4984-e7aa-9fc5-7026100b38e1@linux.intel.com> Date: Wed, 16 Mar 2022 15:20:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <1882dfc1-0f46-a594-d75b-b73d30f6d6db@zhaoxin.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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