Received: by 10.223.185.111 with SMTP id b44csp146589wrg; Fri, 9 Mar 2018 02:40:36 -0800 (PST) X-Google-Smtp-Source: AG47ELsvL8tJkGgCa5uHPMHvrF/xznfPHtTvOEX3iwNkdx1o/HhC8/lxj5+NeRNukZwE+zi153tk X-Received: by 10.99.117.10 with SMTP id q10mr23869239pgc.423.1520592036753; Fri, 09 Mar 2018 02:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520592036; cv=none; d=google.com; s=arc-20160816; b=v+yZqspId32aS2e8cAwpLnZ3wU0uCQRjzY1aUrPyjh5gklzKl7rDj8X1UybQ67kEGy Am4dpCyT5jM+6IkBrQvoI3ZKFyfoi83vAZbHy09EZdYvkdL9OU8eAF5Sk542lAdStZEy VUi0b+Eg47dotV/+82baNXPOMvWPhPCagNZSN5WjtbJlMl9Ne6ehy5RPDarLoh2LK8QP tLHb0q0v0mrm47P7pij+WDnBHmqf7HeCA0z60a5Kn0YLPbqkelKgVhkMytYz0wHFudRn akkBKbRHAeeaWTMTo6TTfdd/CuRdKJStkMnF6/nuxCWdNGmz85wGzkVuDKIKMe69gk1X 474w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:arc-authentication-results; bh=fzpRxKU+6QpGonbCQu/eHJmAGe2SL0x+Yvo6iyC8yPk=; b=Z4OzXkZW87cot0ZBwPbr0uh2vooZdcMK3z2aimqn13+KMxfH/A09BrWsXVQzyIZAGG 1yEoUGZgxPJt451zbwAa1eyxzHus2BFsKJz9tfHv5bBXGGF5DPK7ckr62iQAM56FYzVC oEOahrTJ8xKDcn9Tku21oCkXienmi1oxw18oknd6lpCaNEw/G91sZP2kdSqT/amDhkmb WyMlQRH/Hzy9xtcyvuA7bKEJHoMUrsPkDkpg8VWQwCpAd3uXbzaSWdL/+7tu3NSgZZht VI2GVnnq97smCdJMT3oQuDh+FameOAnStPoZ9pfIIr6vSdK+xEF73WAh0YpcWOCHx4WQ 3gcQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si625652plk.670.2018.03.09.02.40.21; Fri, 09 Mar 2018 02:40:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751056AbeCIKj0 (ORCPT + 99 others); Fri, 9 Mar 2018 05:39:26 -0500 Received: from mga05.intel.com ([192.55.52.43]:53880 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbeCIKjZ (ORCPT ); Fri, 9 Mar 2018 05:39:25 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2018 02:39:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,445,1515484800"; d="asc'?scan'208";a="210192023" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga006.fm.intel.com with ESMTP; 09 Mar 2018 02:39:22 -0800 From: Felipe Balbi To: Roger Quadros , Baolin Wang Cc: USB , LKML Subject: Re: [PATCH] usb: dwc3: Prevent indefinite sleep in _dwc3_set_mode during suspend/resume In-Reply-To: <2b0a25a3-e720-136c-106f-42515247ec8a@ti.com> References: <1519730526-22274-1-git-send-email-rogerq@ti.com> <87sh9l5z4l.fsf@linux.intel.com> <94cd6377-1327-2309-8d69-6ab0de2bdfd4@ti.com> <87po4i3o1v.fsf@linux.intel.com> <87k1uq3ho6.fsf@linux.intel.com> <8ec0485e-89af-568b-e34a-b0cd490817d0@ti.com> <87h8puwyn5.fsf@linux.intel.com> <5bc56ef5-66b1-d40c-1639-e748fe18cdbd@ti.com> <87muzha9h4.fsf@linux.intel.com> <2b0a25a3-e720-136c-106f-42515247ec8a@ti.com> Date: Fri, 09 Mar 2018 12:39:14 +0200 Message-ID: <87efkta5yl.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Roger Quadros writes: >>>>>> When we set up the DWC3_DEPCMD_ENDTRANSFER command in >>>>>> dwc3_stop_active_transfer(), we can do not set DWC3_DEPCMD_CMDIOC, >>>>>> then there will no endpoint command complete interrupts I think. >>>>>> >>>>>> cmd |=3D DWC3_DEPCMD_CMDIOC; >>>>> >>>>> I remember some part of the databook mandating CMDIOC to be set. We >>>>> could test it out without and see if anything blows up. I would, >>>>> however, require a lengthy comment explaining that we're deviating fr= om >>>>> databook revision x.yya, section foobar because $reasons. :-) >>>>> >>>> >>>> This is what the v3.10 databook says >>>> >>>> "When issuing an End Transfer command, software must set the CmdIOC >>>> bit (field 8) so that an Endpoint Command Complete event is generated >>>> after the transfer ends. This is necessary to synchronize the >>>> conclusion of system bus traffic before the End Transfer command is >>>> completed." >>>> >>>> with a note >>>> >>>> "If GUCTL2[Rst_actbitlater] is set, Software can poll the completion >>>> of the End Transfer command by polling the command active bit to be >>>> cleared to 0." >>>> >>>> fyi. >>>> >>>> Rst_actbitlater - "Enable clearing of the command active bit for the >>>> ENDXFER command after the command execution is completed. This bit is >>>> valid in device mode only." >>>> >>>> So I'd prefer not to clear CMDIOC for all cases. >>>> >>>> Could we some how just tackle the dwc3_gadget_exit case like I did in >>>> this patch? >>> >>> if you can send a version that doesn't iterate over all endpoints twice, >>> sure. We still need a comment somewhere, and I fear we may get >>> interrupts later in some cases. How would we deal with that? >>> >>=20 >> how about explicitly masking that interrupt? Is it possible? >>=20 > > Other easy option is to use wait_event_interruptible_lock_irq_timeout() > instead of wait_event_lock_irq() in dwc3_gadget_stop(). > > Is a 200ms timeout sufficient? And after the first timeout we assume all > will timeout so no point in waiting 200ms for each endpoint. We can do that. And I think some 5ms is more than enough :-) I'd be surprised if it takes anything over some 200us for the EndTransfer command to complete. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlqiZFIACgkQzL64meEa mQbvSw//dF6NeOBwsZBreTUH6be2VxQ2K1AVWrhcbAMFQAV1vHE3IGxqFn0LGtag +kszazE4oiqs3zCjrFRxVibOT8UrNIpx/Ud0Bl/CSC2ot3yLzJkbaNHYtcrNCYPH Bo2K63hZ+GH+06mJYBgknVik970rAHV95y1yCSj4g+cDGZxyO+TviJbxCMSMPMrv qLCvY7itOuiXhDfTGDTsTslDq+t/dxcTugxHHt+6WD3LSuYVBs45Ebo00IqgK65b O2guCFM+MRKw2PEAiHwFnmknOxmfg6M4miQKtQThRvwtTsftiy2b9pInv0tiE6yt 1NzFjdOSVvKoaurQVvWUmxX87a++vf1GqeB/jUQKfbK9kGNFH9mbSchzfo3LE3mk zf2YkfLu+X3eE5wOboKoTOsj5YL7DF8ikGVUD8R8OyVEZKTPCG++T3i6MQRNJiqy gMlbb50prIcGwQveiA4nBSbBrj8klbHb9lWwqYyaiLvjGXM+gcpfCalK/Ww6v2Pj oK58wSSS0yCdPKpu6Z9qJoUnYtQ5ZlyQHhXtbHLZdSGt/RpfshyIMGr9nJu7eqfP XOm93YwfbrK6LxGeX5xPKmuYUFpApql8JUe0DNoR+GZpggj2hIG7NQqV2iPJfvoJ XdSoSIxiWm8AtvRBUMfeby5OJtHBycB1iPwZd4zaYbjycRvOEws= =Co6l -----END PGP SIGNATURE----- --=-=-=--