Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp401583pxb; Thu, 30 Sep 2021 08:26:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGVb3AR7w+bulGVIiq2izSmpWNnezJlF+wenO4bRZxp3QZiw47ieCDQfi6O7Dj9qMh2fBC X-Received: by 2002:a17:906:8510:: with SMTP id i16mr7495618ejx.442.1633015597075; Thu, 30 Sep 2021 08:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633015597; cv=none; d=google.com; s=arc-20160816; b=l5LrCO0bSsCjcGuj7alva/EkjbX1xbDAtHMpNaEICk9N6+9+h0rQUMRMLFZTejO/dE zmjkPJNitX/FU1W/qJpGmo1Co+wuTi25Q0EF5E3sqqrOoLNOZprQdxjALoi41y4EV2iY BrXXlpqM13WqP138cXr3TUuv4x8ptXVv00f5dBzky+dtl6wYoDZ4RqtZIuY0HD5x7se7 2TUbj69R/iaEgffCA48G/zvPS/e43gegDbdwxLgI+oUAfwa8SOBbXlBM4MTbz4gQpDCa /e2koVgXkRMxfn066orBNtKqsgJWwDsGnR8l0cYRO1rLwOKlmv+WOxVgAxAf+qFst/Aw x+0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DqM7AZslk/Lj+TUAKhTihcIMc1iHjcXnhmWUJwLwnUs=; b=wGnrsjh7X9OEO+NzQ+i28+R56k4NhxyG/HVo5dhpzG5EBq//uinwaPGINSAg6YwANB IKLAt4wNZ7e6PudzOoKfNlhWvarbQq0+0liM3n/Nt5bYOQ0Idju7MIOMOkZX3w4qCSeZ WnrYg5bMuFTsFp36gfVFfTvJe5ay9eE2mvmkLwq+xzV2I0NG38+hGiiDc06E2Hq9XjNb 1lA9vP03k2u2tcvf+o6OFH9zjK/Hdx72A+YeV3Rky13oAmM5fO/MCuNgrGsZtI+zKFVb 4QfYgHm5hxXS4F5m8oqIFwU2Yn5BNDEllqnXfipNGcZefck4Jq8sYBcxz1zVlFXf+im9 J+Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si6102621edb.334.2021.09.30.08.26.11; Thu, 30 Sep 2021 08:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245471AbhI3PUE (ORCPT + 99 others); Thu, 30 Sep 2021 11:20:04 -0400 Received: from netrider.rowland.org ([192.131.102.5]:40469 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S245339AbhI3PUD (ORCPT ); Thu, 30 Sep 2021 11:20:03 -0400 Received: (qmail 472189 invoked by uid 1000); 30 Sep 2021 11:18:19 -0400 Date: Thu, 30 Sep 2021 11:18:19 -0400 From: Alan Stern To: Oliver Neukum Cc: Jason-ch Chen , Hayes Wang , "matthias.bgg@gmail.com" , "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , "Project_Global_Chrome_Upstream_Group@mediatek.com" , "hsinyi@google.com" , nic_swsd Subject: Re: [PATCH] r8152: stop submitting rx for -EPROTO Message-ID: <20210930151819.GC464826@rowland.harvard.edu> References: <20210929051812.3107-1-jason-ch.chen@mediatek.com> <4c2ad5e4a9747c59a55d92a8fa0c95df5821188f.camel@mediatek.com> <274ec862-86cf-9d83-7ea7-5786e30ca4a7@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <274ec862-86cf-9d83-7ea7-5786e30ca4a7@suse.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 11:30:17AM +0200, Oliver Neukum wrote: > > On 29.09.21 11:52, Jason-ch Chen wrote: > > On Wed, 2021-09-29 at 08:14 +0000, Hayes Wang wrote: > >> > > Hi Hayes, > > > > Sometimes Rx submits rapidly and the USB kernel driver of opensource > > cannot receive any disconnect event due to CPU heavy loading, which > > finally causes a system crash. > > Do you have any suggestions to modify the r8152 driver to prevent this > > situation happened? > > > > Regards, > > Jason > > > Hi, > > Hayes proposed a solution. Basically you solve this the way HID or WDM do it > delaying resubmission. This makes me wonder whether this problem is specific > to any driver. If it is not, as I would argue, do we have a deficiency > in our API? > > Should we have something like: usb_submit_delayed_urb() ? There has been some discussion about this in the past. In general, -EPROTO is almost always a non-recoverable error. In usually occurs when a USB cable has been unplugged, before the upstream hub has notified the kernel about the unplug event. It also can occur when the device's firmware has crashed. I do tend to think there is a deficiency in our API, and that it should be fixed by making the core logically disable an endpoint (clear the ep->enabled flag) whenever an URB for that endpoint completes with -EPROTO, -EILSEQ, or -ETIME status. (In retrospect, using three distinct status codes for these errors was a mistake.) Then we wouldn't have to go through this piecemeal approach, modifying individual drivers to make them give up whenever they get one of these errors. But then we'd have also have to make sure drivers have a way to logically re-enable endpoints, for the unlikely case that the error can be recovered from. Certainly set-config, set-interface, and clear-halt should do this. Anything else? Alan Stern