Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp68934pxu; Tue, 13 Oct 2020 16:59:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrVdHljVvwP2yNZOStero4kLT1CxKahJPSNXuUPeJAspcE95teJj9CSM9vLWsAM0oNrwSs X-Received: by 2002:a17:906:1f08:: with SMTP id w8mr2373421ejj.181.1602633544051; Tue, 13 Oct 2020 16:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602633544; cv=none; d=google.com; s=arc-20160816; b=ITDZA0diL3N3wgRIE752U2aJKjYTD4jEzPkqYmog3lCSEc5+lr5jVLomPm5w+uetD/ RrtoNiAFPwHKjX8cbE4M9mYFnLaE0ePzg0p0JoUn4EFxlW9knuIV/vTRGhxZEzOH+qvz tZ4x2Z6o2q/j+ZbgB+jkzn5V5biENh0hRmXoWv3+nLLl2MAAV7qUMdydm2rv8GiJHugH oZ5VWpL/lRVMqYZkYu99VF5kkWBV0BN3UtJ6BjxIDXCfBxALF5k8dxlCR0+YjByFezb9 NAHy31tYATVhOp3BIQaBQJ7pQ1FPgluJCI02prHisio8dtLIjHS3RlvBOIIjoLs/WxEy wcOQ== 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=gKhSWEDpo4bnSs3O/5IRkL7ItqnOAmhdJq/e6xOkn3Y=; b=iMtoUqxjiIuXGGnvVeL1rgz+7tR03+IVxuQIp69o8eYBiR+B+w+ul73tZFMQ+yRHJr Bewf01QBOC5Wc+H0/6pbj4oVe/eNiDWcM+BlftNTLdOp9AwPgoF4rrPxFmgW6SncWwfh TBUfd7ZljcAvH7ZUkCW+Rey8daPo1KNUgOErNIK8I1URXAWf9Emw1v2KxQPis1kk3IMD Fxxf/kDe+J6Y8mv8XFqEiREhYzKmrgyji4wcIHJSYIkojOexUvPI1H2lvQ8NHBuwe/wc 5FTEKk2L68L4gj/xu4Hf21/vML9KLvSFerr6GcGoEKx2TX3CX7utbtLs46eHRKVnGvnp RPfg== 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 ca16si927328edb.546.2020.10.13.16.58.42; Tue, 13 Oct 2020 16:59:04 -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 S1731200AbgJMPY2 (ORCPT + 99 others); Tue, 13 Oct 2020 11:24:28 -0400 Received: from netrider.rowland.org ([192.131.102.5]:55967 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727875AbgJMPY1 (ORCPT ); Tue, 13 Oct 2020 11:24:27 -0400 Received: (qmail 673224 invoked by uid 1000); 13 Oct 2020 11:24:26 -0400 Date: Tue, 13 Oct 2020 11:24:26 -0400 From: Alan Stern To: Pratham Pratap Cc: gregkh@linuxfoundation.org, rafael.j.wysocki@intel.com, mathias.nyman@linux.intel.com, andriy.shevchenko@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, sallenki@codeaurora.org, mgautam@codeaurora.org, jackp@codeaurora.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: core: Don't wait for completion of urbs Message-ID: <20201013152426.GB670875@rowland.harvard.edu> References: <1602586022-13239-1-git-send-email-prathampratap@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1602586022-13239-1-git-send-email-prathampratap@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 04:17:02PM +0530, Pratham Pratap wrote: > Consider a case where host is trying to submit urbs to the > connected device while holding the us->dev_mutex and due to > some reason it is stuck while waiting for the completion of > the urbs. Now the scsi error mechanism kicks in and it calls Are you talking about usb-storage? You should describe the context better -- judging by the patch title, it looks like you're talking about a core driver instead. > the device reset handler which is trying to acquire the same > mutex causing a deadlock situation. That isn't supposed to happen. The SCSI error handler should always cancel all the outstanding commands before invoking the device reset handler. Cancelling the commands will cause the URBs to complete. If you found a test case where this doesn't happen, it probably means there's a bug in the SCSI core code or the USB host controller driver. That bug should be fixed; don't introduce random timeout values to try and work around it. Alan Stern