Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2064850rwl; Thu, 13 Apr 2023 00:49:47 -0700 (PDT) X-Google-Smtp-Source: AKy350by02HXEcyo62F0VUGiAxGqa1kI/JxT4pqARUYPT/pDAVf/BVyHYQQ/J6F+Ok12QmJWoEXv X-Received: by 2002:a05:6402:4cb:b0:504:9350:f458 with SMTP id n11-20020a05640204cb00b005049350f458mr988250edw.1.1681372187684; Thu, 13 Apr 2023 00:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681372187; cv=none; d=google.com; s=arc-20160816; b=yGOEdxC2PQ8wbKQu4uXB8WuYvQpofJQYdcW9rFey4eWljIY3FKnIu8xh3jjjp6FGZg sIuCGUhhGUprtyl1k3HqPLgBnpizJ3i8SUAFmyommDrRFD62t+ucqMKTBWVvyecGR4u1 XetK1vaaHzAwKMcUCpDLXMt+1EA0q8ZPI+NhIcOpcwweypUwuULtlToEklxESv9/w4Sl IQOPYvpXst38E9jbzfhFsN5i0RyzvY8lCGvctHqZY/ljMXgpeh9YPZ6H3t/y5LzXynxf ygZTQCe9DgrsBfbzfelXhftEH3kFbQYs2gqT8KPnzTpN4uQ5LkN/89YkHJyAuFP5xakf 6o7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=naKObkSl5hq5feaZ3211J1OQ3/6qNad/PdSNCqRywgk=; b=0ZR2mGA2Dn3ZHDQna2DeyX5PYHyBNdoKrm8w/DLvqhz0tw4meQQN9Sd/up4v+1PfyT MGtFqsPueYtrEbQWLgbDzZvEeNSozCnmFM7GuvXVz19klt62UK4JIT3sms8yI3YRRKAI 5jtTS6VFWTsb/U7/7xzAtlAY8zKSc2D8YdTd4FrV1Qy/CWCVA13dU9lz4/UU49gOVt7P qezFD3zM6ef3jceyltgOUMC+V/MEGGBpAqPblENv2sugugCU7gnHXLSPZ9XQbPgZMpma x6KImXna2+2b+kOAhSoqOXp/XjMsx+0/Y2g+/1lcbJaUipwD/vrXjng5bBj+tr5uk+wd XcSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FrJeJ2G8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a056402004c00b005049c85875esi1094313edu.659.2023.04.13.00.49.18; Thu, 13 Apr 2023 00:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FrJeJ2G8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbjDMHsq (ORCPT + 99 others); Thu, 13 Apr 2023 03:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjDMHsp (ORCPT ); Thu, 13 Apr 2023 03:48:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1E48A4F; Thu, 13 Apr 2023 00:48:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 415EF638E9; Thu, 13 Apr 2023 07:47:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514B0C433EF; Thu, 13 Apr 2023 07:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681372073; bh=Ds+MxkKs0/lIPSgCrnQJry+1qiKWouiibiaJxitKFcY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FrJeJ2G8SKvoCPcCuWPYZfhj7odZs0u6zB+pSOYFbSjaOjrkw2lp9Rkh+OIsLrqLg TgOeFPkMtSawjkV3w9hZCqvUVNiJLX0fyjuxo6El0ujvZuaSkcsHVqZNWYuiBV+0Rr QBNbcEvB0EkFQRN5DwlQGLEfZVGK1IdQiDloMXjY= Date: Thu, 13 Apr 2023 09:47:50 +0200 From: Greg KH To: Wesley Cheng Cc: Thinh.Nguyen@synopsys.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, quic_jackp@quicinc.com, quic_ugoswami@quicinc.com Subject: Re: [PATCH v3 2/3] usb: dwc3: gadget: Stall and restart EP0 if host is unresponsive Message-ID: <2023041310-absolute-task-8ba6@gregkh> References: <20230410231954.437-1-quic_wcheng@quicinc.com> <20230410231954.437-3-quic_wcheng@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230410231954.437-3-quic_wcheng@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 Mon, Apr 10, 2023 at 04:19:53PM -0700, Wesley Cheng wrote: > It was observed that there are hosts that may complete pending SETUP > transactions before the stop active transfers and controller halt occurs, > leading to lingering endxfer commands on DEPs on subsequent pullup/gadget > start iterations. > > dwc3_gadget_ep_disable name=ep8in flags=0x3009 direction=1 > dwc3_gadget_ep_disable name=ep4in flags=1 direction=1 > dwc3_gadget_ep_disable name=ep3out flags=1 direction=0 > usb_gadget_disconnect deactivated=0 connected=0 ret=0 > > The sequence shows that the USB gadget disconnect (dwc3_gadget_pullup(0)) > routine completed successfully, allowing for the USB gadget to proceed with > a USB gadget connect. However, if this occurs the system runs into an > issue where: > > BUG: spinlock already unlocked on CPU > spin_bug+0x0 > dwc3_remove_requests+0x278 > dwc3_ep0_out_start+0xb0 > __dwc3_gadget_start+0x25c > > This is due to the pending endxfers, leading to gadget start (w/o lock > held) to execute the remove requests, which will unlock the dwc3 > spinlock as part of giveback. > > To mitigate this, resolve the pending endxfers on the pullup disable > path by re-locating the SETUP phase check after stop active transfers, since > that is where the DWC3_EP_DELAY_STOP is potentially set. This also allows > for handling of a host that may be unresponsive by using the completion > timeout to trigger the stall and restart for EP0. > > Fixes: c96683798e27 ("usb: dwc3: ep0: Don't prepare beyond Setup stage") I'm confused. You have a Fixes: tag here, yet this patch depends on patch 1/3, right? This implies that you do not want or need this to be backported to any stable kernels, right? Or do you? If so, put the bug fixes first, and properly add a cc: stable tag, so that they will get backported correctly. If not, then don't even put a fixes tag on it as obviously it isn't a bugfix that is relevant to track anywhere, and then this is just a normal new feature to be added to the driver. Please resolve this and submit a new series based on your decision. thanks, greg k-h