Received: by 10.213.65.68 with SMTP id h4csp3514793imn; Mon, 9 Apr 2018 23:32:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx49R90f2kbnp+vJaXtBrYHc10YGXnNMP0GmFwam0wD6XRfrYEDtpO/bcOp0iWjSCG+7oPH81 X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr42762946plb.198.1523341969373; Mon, 09 Apr 2018 23:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523341969; cv=none; d=google.com; s=arc-20160816; b=sWxEhQbhVKctUVimQOEQOheLeGjx05mOYanH+vTbz6jALpkRISom+JpIIkbsKsdIV/ TyK+4hbkO1pQAiQenecY6ssEBlLMpt7oGiAfuiMMzUECwkw1Ja/Mazh6oPGZv2vDNQJM 6m81Ojsrli0cQcZH/Vs16aZ2biC1P2b6KadUsF1DOgnOynR2Z0vGaC5X+rUWPmm3yh2S n5CieMO/+0ooUSj6CP4q5QdSbQ3RpUiGPUHaxnsqoXbdiUUPnFnpJSqkR1SLzWBgbPQD gpREoKqxNzS0WpUJi8skGsfRkzbR5bgMnqpjqPTLsKK5PTzaInlx8o7fgtAt4z3j0ZFD Ne8g== 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 :arc-authentication-results; bh=p9LIQZOimpBL3hV1Ajb51dZ3O3D9F91NCK5YxlCfFQI=; b=0YpeMLrWt7HBhqDfVzWZNl18lY1PcuUOBRGjG3OWSatAA1IUDn20z5stbxGu0k38xa DsR18JxFlXLIhHYfXIPF5bIkj3pR/2GHdzrhU840wnnUC6XonnW6p72zZzEyD4Xzjdr6 D/deU0UBNjKzC+vNNlSWNO03y3XwSP1PLuog1223nCkYIUPBgzXBEhwALQ7+xzGuqU2z r7wXoIW+Lotetz8tGsXpjcnqIICQrlDVH+GF00eBD+WHLdKlGUeaKz8CaFD8HohMJo0f BH2yMUnA27Z3bYkHNEWJ4SDSBNcWMTVhvo+ozioqULc4Ni41lSoxvZFj3PHxDIMOuJWr sSIA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 m8si1330536pgu.98.2018.04.09.23.32.11; Mon, 09 Apr 2018 23:32:49 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983AbeDJG30 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 10 Apr 2018 02:29:26 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:51374 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbeDJG3Z (ORCPT ); Tue, 10 Apr 2018 02:29:25 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0597D24E1220; Mon, 9 Apr 2018 23:29:25 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id DBE935518; Mon, 9 Apr 2018 23:29:24 -0700 (PDT) Received: from AM04WEHTCB.internal.synopsys.com (10.116.16.192) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 9 Apr 2018 23:29:24 -0700 Received: from AM04WEMBXB.internal.synopsys.com ([fe80::1006:bcdd:1b7:579b]) by am04wehtcb.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Tue, 10 Apr 2018 10:29:21 +0400 From: Minas Harutyunyan To: Felipe Balbi , Minas Harutyunyan , Roger Quadros CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] usb: dwc3: Prevent indefinite sleep in _dwc3_set_mode during suspend/resume Thread-Topic: [PATCH v2] usb: dwc3: Prevent indefinite sleep in _dwc3_set_mode during suspend/resume Thread-Index: AQHTt7VttcDOmDIowUqzUI1Hi/JpmA== Date: Tue, 10 Apr 2018 06:29:20 +0000 Message-ID: <410670D7E743164D87FA6160E7907A560113AE789A@am04wembxb.internal.synopsys.com> References: <1519730526-22274-1-git-send-email-rogerq@ti.com> <69517684-bd39-e945-0c9e-ccd52b8050d5@ti.com> <87y3isffog.fsf@linux.intel.com> <5ea0ad17-d538-72ec-ed59-004242c4cd26@ti.com> <410670D7E743164D87FA6160E7907A560113ABB478@am04wembxa.internal.synopsys.com> <87zi38438h.fsf@linux.intel.com> <410670D7E743164D87FA6160E7907A560113ABBA4B@am04wembxa.internal.synopsys.com> <87d100qwc5.fsf@linux.intel.com> <410670D7E743164D87FA6160E7907A560113ABC945@am04wembxa.internal.synopsys.com> <410670D7E743164D87FA6160E7907A560113ABCA0A@am04wembxa.internal.synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.63] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Filipe, On 3/19/2018 5:53 PM, Minas Harutyunyan wrote: > Hi, > > On 3/19/2018 3:36 PM, Minas Harutyunyan wrote: >> Hi, >> >> On 3/19/2018 12:55 PM, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Minas Harutyunyan writes: >>>>>>>>> Thanks for picking this for -next. >>>>>>>>> Is it better to have this in v4.16-rc fixes? >>>>>>>>> and also stable? v4.12+ >>>>>>>> >>>>>>>> Well, there was no "Fixes: foobar" or "Cc: stable" lines in the commit >>>>>>>> log ;-) >>>>>>>> >>>>>>>> The best we can do now, is wait for -rc1 and manually send the commit to >>>>>>>> stable. >>>>>>>> >>>>>>> >>>>>>> That's fine. Thanks. >>>>>>> >>>>>> >>>>>> Same issue seen in dwc3_gadget_ep_dequeue() function where also used >>>>>> wait_event_lock_irq() - as result infinite loop. >>>>> >>>>> how did this happen? During rmmod dwc3? Or, perhaps, after you unloaded >>>>> a gadget driver? >>>>> >>>> No, not during rmmod's. >>>> We using our internal USB testing tool. Test case; ISOC OUT, transfer >>>> size N frames. When host starts ISOC OUT traffic then the dwc3 based on >>>> "Transfer not ready" event in frame F starts transfers staring from >>>> frame F+4 (for bInterval=1) as result 4 requests, which already queued >>>> on device side, remain incomplete. Function driver on some timeout >>>> trying dequeue these 4 requests (without disabling EP) to complete test. >>>> For IN ISOC's these requests completed on MISSED ISOC event, but for >>>> ISOC OUT required call dequeue on some timeout. >>> >>> okay >>> >>>>>> Actually to fix this issue I updated condition of wait function >>>>>> from: >>>>>> !(dep->flags & DWC3_EP_END_TRANSFER_PENDING) >>>>>> to: >>>>>> !(dep->flags & DWC3_EP_END_TRANSFER_PENDING & DWC3_EP_ENABLED) >>>>> >>>>> you're not fixing anything. You're, essentially, removing the entire >>>>> end transfer pending logic. >>>> yes, you are right, but how to overcome this infinite loop? Replace >>>> wait_event_lock_irq() by wait_event_interruptible_lock_irq_timeout()? >>> >>> The best way here would be to figure why we're missing command complete >>> IRQ in those cases. According to documentation, we *should* receive that >>> interrupt, so why is it missing? >>> >> >> Additional info on test. Core configuration is HS only mode, test speed >> HS, core version v2.90a. Maybe it will help to understand cause of issue. >> BTW, currently to pass above describe ISOC OUT test we just commented >> wait_event_lock_irq() in dwc3_gadget_ep_dequeue() function and >> successfully received request completion in function driver. >> Thanks, >> Minas >> > > One more info: while function driver call dequeue, host periodically > send control read command to get status of test from function - test In > Progress or Finished. > Thanks, > Minas > Your last dwc3 patch series allow us to successfully dequeuing remaining requests without falling in to infinite loop. Thank you, Minas