Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp26922imu; Fri, 14 Dec 2018 13:45:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xi2ojqiDE9kfow0X4cgL7NgaPd0UVRJDSy9lAX7FHhExsO8NlZNJPiN0jxi43hIQ+kkbUj X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr4332629plb.46.1544823926338; Fri, 14 Dec 2018 13:45:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544823926; cv=none; d=google.com; s=arc-20160816; b=lXmq5DoZKspju8AyFHzuCng83TEocBKunYYat9C/1lhsjrwoS5f2MLV//UJYANaXyn euvT6Tg4/+9M013yIxPDAZgkmoxkOM7UMkCGxg5sFXeClVhQWVbzuEFhb3tALRfdngtO 0SSbsQTAVusMKDtMukdOqfflkCR/pOO2jP7TmoJEMsJTbF+OehNEcb2yfRS+QHprRjTu CzyQzAbOFu0jbr414JlZJ7jLe+WHSwtVho0llAoc6J5ixJWww9If4RRyT7ANJwruinT5 SRuksbvexxOATgwpKpGjb3E9KOoRolFIhJ1BBxdAUPCx4yob9cpMQl4EooLwXPMMYaHC xSOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=W4Z3/g+Ig+2u66hgTA4kTu4jyBixFbXqKpXJDRa0oZg=; b=X7q2qCNvGBpdQKPS5DVJesyNU/Yx6BrDevZWTXDtDABtDnTqHX6hYU4zQouJaHlVVY jHan0temgyC7sY124EN3w8s4zi2V9llgxJp9daxq7+SAywD1MPaRQVJoC4HLuHudOxGo qsuteRQYB0pEDDsTLhQQCDRb+LyUo6iOI9yiYxnSWxISUZrGJ4bVzAviKjGc9VLYqHJa zwueGv2leyz15J9zmHsdy4LIF6TDKxEL/VDrwKzQGSWKyrZKpJvcf8D9vc43n1lcjj7z VbKIpnHFzcuUgYdN69K/UKHv7zKWb+mH1pfUk9oOa/bqCLupBsmWrgWCc8wi/h+plvmu M98w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=V1DP0JPO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k135si3228871pgc.574.2018.12.14.13.45.11; Fri, 14 Dec 2018 13:45:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=V1DP0JPO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731137AbeLNVnA (ORCPT + 99 others); Fri, 14 Dec 2018 16:43:00 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:40510 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730758AbeLNVnA (ORCPT ); Fri, 14 Dec 2018 16:43:00 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id A328624E0EC0; Fri, 14 Dec 2018 13:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1544823779; bh=Wu+TVcoDh+xsDcUVrnmqZ6QOZuZZGH4Y3fupPjy9T9M=; h=From:To:CC:Subject:Date:References:From; b=V1DP0JPOhr0BdyvFMjEHjmM4Ks7ah1CkR9Wn+9zgEXtTCxE1tAHLVSsdWae1rqexT q76ftOZIS3lw1oLnVgL5p2ZRHZWDwd0jlXts2tqhfr9DHV+DSCo+kzz0KFH4qNG/F0 cM7Ae/V+383VuPe1lEJ1xc9wOO4mxHzRYjm52/erNmm30NTaVRdmAzQkWrWTw+XAG/ s8xUjBD//5mJLhaBIkdz8yndybaoPFgoBiupY9y+F2oZqh/FFeLJ6jQg0+NBgSK2LT DE2V7g4tzf8eN/uec0QPqfG5Sxl3kEhA0dAtzyw04OmXZrzJrJXicfR5weQPSfzxw6 ikfxFEsjCrLCg== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id CAE61376E; Fri, 14 Dec 2018 13:42:55 -0800 (PST) Received: from us01wembx1.internal.synopsys.com ([169.254.1.228]) by US01WXQAHTC1.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Fri, 14 Dec 2018 13:42:55 -0800 From: Thinh Nguyen To: Felipe Balbi , "Zengtao (B)" CC: liangshengjun , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Thinh Nguyen Subject: Re: [PATCH] usb: dwc3: gadget: fix miss isoc issue introduced by IRQ latency Thread-Topic: [PATCH] usb: dwc3: gadget: fix miss isoc issue introduced by IRQ latency Thread-Index: AQHUk4c4aTEJCOLnsUKRaItzQg17Vw== Date: Fri, 14 Dec 2018 21:42:54 +0000 Message-ID: <30102591E157244384E984126FC3CB4F639AA2A3@us01wembx1.internal.synopsys.com> References: <1544805179-2248-1-git-send-email-prime.zeng@hisilicon.com> <87efaklcd1.fsf@linux.intel.com> <678F3D1BB717D949B966B68EAEB446ED24E20BE5@dggemm526-mbx.china.huawei.com> <878t0sl5br.fsf@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.20] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zengtao,=0A= =0A= On 12/14/2018 3:24 AM, Felipe Balbi wrote:=0A= > Hi,=0A= >=0A= > "Zengtao (B)" writes:=0A= >>> -----Original Message-----=0A= >>> From: Felipe Balbi [mailto:balbi@kernel.org]=0A= >>> Sent: Friday, December 14, 2018 4:52 PM=0A= >>> To: Zengtao (B) =0A= >>> Cc: liangshengjun ; Zengtao (B)=0A= >>> ; Greg Kroah-Hartman=0A= >>> ; linux-usb@vger.kernel.org;=0A= >>> linux-kernel@vger.kernel.org=0A= >>> Subject: Re: [PATCH] usb: dwc3: gadget: fix miss isoc issue introduced = by=0A= >>> IRQ latency=0A= >>>=0A= >>> * PGP Signed by an unknown key=0A= >>>=0A= >>> Zeng Tao writes:=0A= >>>=0A= >>>> If it's a busy system, some times when we start an isoc transfer, the= =0A= >>>> framenumber get from the event buffer may be already elasped, in this= =0A= >>>> case, we will get all the packets dropped due to miss isoc. And we=0A= >>>> turn into transfer nothing, to fix this issue, we need to fix the=0A= >>>> framenumber to make sure that it's not out of date.=0A= >>>>=0A= >>>> Signed-off-by: Liang Shengjun =0A= >>>> Signed-off-by: Zeng Tao =0A= >>> There's a patch going upstream already doing this:=0A= >>>=0A= >>> https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/commit/?h= =0A= >>> =3Dnext&id=3Dd53701067f048b8b11635e964b6d3bd9a248c622=0A= >>>=0A= >> Sorry, I think I missed to update to the latest version. But I think my = =0A= >> patch is more efficient. Because I just sync the frame from the HW, it= =0A= >> won't fail and there is no need to extra tries.=0A= >>=0A= >> What do you think about it?=0A= > the 14 bits you use for your check is not representative of the actual=0A= > micro-frame you're currently in. Thinh explained that in the discussion= =0A= > we had until we came to the patch I pointed you to above. Please look at= =0A= > the mailing list archives for details.=0A= >=0A= =0A= There are several issues with this patch.=0A= 1) Your frame elapsed time check is not based on interval but statically=0A= DWC3_EVENT_PRAM_SOFFN / 2. That's about 1 second. So it doesn't account=0A= for isoc transfers with large service interval of 1 sec or more.=0A= 2) This function __dwc3_gadget_target_frame_elapsed() should have=0A= comments for what it does. The name implies that this function checks=0A= for eframe > cframe, and not eframe > cframe + 1s.=0A= 3) If this check fails, then it will do DWC3_ALIGN_FRAME() at least=0A= twice. The isoc transfer will start 1 more interval into the future than=0A= it needs to.=0A= =0A= Also, I think the role of this check should be from the controller as it=0A= has more information and its own logic to decide if the selected future=0A= uframe has elapsed.=0A= =0A= BR,=0A= Thinh=0A=