Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4392775ima; Mon, 4 Feb 2019 15:58:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IaRHe130K2GbgdNmmKOI+ItPi4aMFuNMdPlydZr7BrulpRB9g4grjCR+30CLbl58+xXNo41 X-Received: by 2002:a63:c503:: with SMTP id f3mr1771241pgd.431.1549324698971; Mon, 04 Feb 2019 15:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549324698; cv=none; d=google.com; s=arc-20160816; b=ZIELOHC8fnVHbWIKPUBtbti0kFEK1ea6rcu93joNeyFHEMIQ/nZiBw5m5AVNmTbflY dianHInuuF5+y/FldZ9vVrf99/GUma/V6BdNdwBm8m5s7L7polNWUM7HJtzKdZ04qHgK zfixDu9iqESVg5PUO/iyQD7m+bMlThZ9WzvuPqODF2kIhI1l8MbMugulee2r03ixJQgZ GK50Gx38F4a3KIOyAmgyxf3i70U24ipmpUyGnfzxTuCUvClvybxR1OYRRhA/TcLg+1rM aMW6X7Hjv8iOgxGhGSK3ekIY1Rf34Y4vDKqMY473jJI8MKRMMKWBkl4pDB6aJR8tnsxj ZiXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=M5LxtiaLrwNYmxAzewqdE7BKm4uCmKthl2fCcxdImwg=; b=0FYq5B1ytDH4Ld+uMw4qHTm0Tx9XvU3ZQcjeZWBtPBXzePpPMuE4sBkutH8iiGAZSB b7k1W+SoXdm9rg9gGjUwutnfzkLA9qbANPK4O8MyLOohPSm3NF1wumJs2YEMQuJpdezP Lf4snGa4IjvaevUIyATI6cE9lKRhy1P0XrAm57fkBOxdJhFCRx14qsgtlHNwB1b/FNrB nM8DrGhNi1ebBexRdzzlJHqlwvNkKYJ+g8NgDOPWhOnBVMMEz9dK/wn/JhY4CbjS1MCB xtZsPMlDRDoYeuuihoY9b2co1+8Ho2hMwn0Zz2oZ7ATzNQsY70a4ht+6hVKof15Lw7R+ U+ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W4S3u3SL; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v61si1480745plb.54.2019.02.04.15.58.02; Mon, 04 Feb 2019 15:58:18 -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=@linaro.org header.s=google header.b=W4S3u3SL; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727467AbfBDX56 (ORCPT + 99 others); Mon, 4 Feb 2019 18:57:58 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42707 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbfBDX56 (ORCPT ); Mon, 4 Feb 2019 18:57:58 -0500 Received: by mail-wr1-f66.google.com with SMTP id q18so1775019wrx.9 for ; Mon, 04 Feb 2019 15:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M5LxtiaLrwNYmxAzewqdE7BKm4uCmKthl2fCcxdImwg=; b=W4S3u3SLWQ/g97C8A1p9QU+w6eY0VHIiaZtlvriTLsk+8mMRR4HSP8kKq4C9L+iB1L d+L/MiYmyWShEot0EZUi+uzr5vO9upFglilxcU5NBlV4QySwLPoUiePL7lc0Cf1kurro bOw/6Rm7CppsYoF4YC8MenKtFwJFwkZmjxJ1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M5LxtiaLrwNYmxAzewqdE7BKm4uCmKthl2fCcxdImwg=; b=iMt4Vc6Mvzev5Htb8BvAKZw15lGzDh0Mp93gX84vKarL/h1Q6RgMivzh45ykqMsw9a J8hdmmCtKQBxLd+9fh/wa2vzjCLN4VlHn1UzDlzbYuE+mT0/GGpx3XSBXvDw7dgyv1Vv f8hZRDoQ8CYrbWOFJdkdatQwAf1FCXUZ8xitYmcCEMEDvrROCPtWF4pzzz3VcSriDMVw ufqB7ZJ7G/Xq9LIVunY0O/vjfR/FsBeTH7dtU91QsdIh8rtwCUBNXW+tcw7T40B1eAsp PcZPUk6BanczbMx+B+MfC8fPa0nuUJpyqhIc6QJBA1aBLpcnAt0i3Ld6zc5kvt7my2mS 4aew== X-Gm-Message-State: AHQUAuamvQd7BaksbZQsQYyl/Cv3M50oN88UHIMZJNdBsIcMhTic2Fz5 oqrwHPJFna8sP1pUzAvicDc4tBa+WVwRiIy/LQVfZzsL X-Received: by 2002:a5d:4c8a:: with SMTP id z10mr1292184wrs.75.1549324676529; Mon, 04 Feb 2019 15:57:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Stultz Date: Mon, 4 Feb 2019 15:57:45 -0800 Message-ID: Subject: Re: Frequent dwc3 crashes on suspend or reboot since 5.0-rc1 To: Alan Stern Cc: Felipe Balbi , Zeng Tao , Jack Pham , Thinh Nguyen , Chen Yu , lkml , Linux USB List , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 2, 2019 at 9:00 AM Alan Stern wrote: > > On Fri, 1 Feb 2019, John Stultz wrote: > > > Hey all, > > Since the 5.0 merge window opened, I've been tripping on frequent > > dwc3 crashes on reboot and suspend, which I've added an example to the > > bottom of this mail. > > > > I've dug in a little bit and sort of have a sense of whats going on. > > > > In ffs_epfile_io(): > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/gadget/function/f_fs.c#n1065 > > > > The completion done is setup on the stack: > > DECLARE_COMPLETION_ONSTACK(done); > > > > Then later we setup a request and queue it: > > req->context = &done; > > ... > > ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC); > > > > Then wait for it: > > if (unlikely(wait_for_completion_interruptible(&done))) { > > /* > > * To avoid race condition with ffs_epfile_io_complete, > > * dequeue the request first then check > > * status. usb_ep_dequeue API should guarantee no race > > * condition with req->complete callback. > > */ > > usb_ep_dequeue(ep->ep, req); > > This code contains a bug: It assumes that usb_ep_dequeue() waits until > the request has been completed. You should insert > > wait_for_completion(&done); > > right here. > > > interrupted = ep->status < 0; > > } > Thanks! This does seem to resolve the issue I'm seeing. Are you planning to send in such a patch, or would it help if I sent it out? thanks -john