Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp49784imj; Thu, 14 Feb 2019 15:07:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IZI/h/QFaURvBya9KKT0M9MThjRGTbMxXPoq+RNcG45fQXuCxhdDaNAyTAkQVZpRucPQWBE X-Received: by 2002:a17:902:7588:: with SMTP id j8mr6938473pll.22.1550185641369; Thu, 14 Feb 2019 15:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550185641; cv=none; d=google.com; s=arc-20160816; b=CtQF/f4QisslURhPsiRq5NZ8p+4gGiV2kRopI8MVREfVkkwzQICnQhscir+zGyajJv qVWqdGPILQy8UhieW9TA0Z5D1+pYRKOXXA39W5Pq5KWs6m9VJTjayVHt9ZeGcll+WLbb grx0hIRVBWXVjs61l+MSVq9ndtoRZxLYHvoP4y9HkZxLYFNcd1dcOUk7z1VP+oWv1Vye jTtk2ADqtqIdJjhSAtLptsRVayuj4Q8VuLwva7XRnbPRjELYYiG2wh+i3JqOZG4EhSPw kL0nY6AEsLQmmK5CLCIMwnsYQZ151CTbf3cKR0cTmLzgdsi11Kn66q8u+CuZUEXOnN0t 0UQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=YIDPgftbQEajlkrzX7dYfom73D6C4mipD+Ip1dMGhyQ=; b=U3X4v3k9PSXXOcNfkmE4X1AxT7kYl6dlK+oKnp0JfZIdMfq6NTg8yoqd4zvfkvCoH1 KmxszUGiOsxaGihCCRsdi8HkDUpuSpOq3bFCfeBDwD1IFrQMlffdSS4d/t8QjQx+IXX4 y1hLopWbAdhUpFyWslxzQc7BdWiQGmSaaIcU1KP+2cGePdW6/V1NDgs7yfMj2F2TB90W bNzVk1jDHsT0rOHeWchwY5LIBQU+9WC1kdLLZnOErEwjKSX8+J/8uQi/njiD/y+d6vFN VINdy02bzBvbTZE6Gqe6H9ZkrkxUIKMBanxTUUh4L4q+AmtNAus4PUQETftEtnPvbnTW pEzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=NTArWyMj; 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=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si3468685pgk.201.2019.02.14.15.06.39; Thu, 14 Feb 2019 15:07:21 -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=@synopsys.com header.s=mail header.b=NTArWyMj; 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=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437145AbfBNLnv (ORCPT + 99 others); Thu, 14 Feb 2019 06:43:51 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:42442 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbfBNLnv (ORCPT ); Thu, 14 Feb 2019 06:43:51 -0500 Received: from mailhost.synopsys.com (badc-mailhost1.synopsys.com [10.192.0.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id DCF7124E20A3; Thu, 14 Feb 2019 03:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1550144631; bh=vGC8AVemBHxssQXUd3ikttdHqoi7yY2qYaAnNCS9qmE=; h=From:To:CC:Subject:Date:References:From; b=NTArWyMjutjVUw851p6hni8yeMcL/5Lw9u0j68W74TQvd+wxars0C2m/qQ2NWkygQ R/2GeaXkglhHewYbRjfiM0UvJpZ/dhFXnriowAbSQirD6kOpasRoi+5bSlCutpAWAb gEWpwbejnwXTpEY3mvuc19HX6Zj7uIaYnodakYAA/QzM9ax8JDAMZQdS1DH9Zrk859 vULaG+nVTnGjb04p8Op21wq6uJIuaWrTuH6s94K/6cI0FgOVp7MJBGLNqdFnDNCxVo Ut48JgdLPew3rqVOxRwz2OkXiKdq7hEII/riR9kQFrMNwJYEhHA2PBji/AlNiZ9fp7 LRd8vTOmQuK9A== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 7C27FA0071; Thu, 14 Feb 2019 11:43:50 +0000 (UTC) Received: from AM04WEHTCA.internal.synopsys.com (10.116.16.190) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 03:43:50 -0800 Received: from AM04WEMBXA.internal.synopsys.com ([fe80::79c3:55f2:1f20:5bf4]) by am04wehtca.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Thu, 14 Feb 2019 15:43:47 +0400 From: Minas Harutyunyan To: Jaehoon Chung , "linux-usb@vger.kernel.org" CC: "minas.harutyunyan@synopsys.com" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "m.szyprowski@samsung.com" Subject: Re: [PATCH] usb: dwc2: hcd: call dwc2_is_controller_alive under spinlock Thread-Topic: [PATCH] usb: dwc2: hcd: call dwc2_is_controller_alive under spinlock Thread-Index: AQHUxEycCYLg8CCwHU26ysYDrcXjtA== Date: Thu, 14 Feb 2019 11:43:46 +0000 Message-ID: <410670D7E743164D87FA6160E7907A56013A7DC6C8@am04wembxa.internal.synopsys.com> References: <1550138622-10761-1-git-send-email-jh80.chung@samsung.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.132] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jaehoon Chung,=0A= =0A= On 2/14/2019 2:04 PM, Jaehoon Chung wrote:=0A= > This patch is referred to Robert's patch=0A= > commit cf54772b913b ("usb: dwc2: call dwc2_is_controller_alive() under sp= inlock")=0A= > =0A= > During running sdb with otg mode, the usb is hung sometime.=0A= > =0A= > The one of SDB hang issues should be fixed with this patch.=0A= > After hang, it doesn't never trigger the usb interrupt.=0A= > =0A= > Signed-off-by: Jaehoon Chung =0A= > ---=0A= > drivers/usb/dwc2/hcd_intr.c | 7 ++++---=0A= > 1 file changed, 4 insertions(+), 3 deletions(-)=0A= > =0A= > diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c=0A= > index 88b5dcf..8d3b155 100644=0A= > --- a/drivers/usb/dwc2/hcd_intr.c=0A= > +++ b/drivers/usb/dwc2/hcd_intr.c=0A= > @@ -2222,13 +2222,13 @@ irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsot= g *hsotg)=0A= > u32 gintsts, dbg_gintsts;=0A= > irqreturn_t retval =3D IRQ_NONE;=0A= > =0A= > + spin_lock(&hsotg->lock);=0A= > +=0A= > if (!dwc2_is_controller_alive(hsotg)) {=0A= > dev_warn(hsotg->dev, "Controller is dead\n");=0A= > - return retval;=0A= > + goto out;=0A= > }=0A= > =0A= > - spin_lock(&hsotg->lock);=0A= > -=0A= > /* Check if HOST Mode */=0A= > if (dwc2_is_host_mode(hsotg)) {=0A= > gintsts =3D dwc2_read_core_intr(hsotg);=0A= > @@ -2276,6 +2276,7 @@ irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg = *hsotg)=0A= > }=0A= > }=0A= > =0A= > +out:=0A= > spin_unlock(&hsotg->lock);=0A= > =0A= > return retval;=0A= > =0A= =0A= 1. Checking core alive or not was introduced in our internal reference =0A= driver for our setups, because sometime AHB-PCI bridge can hung, not =0A= core itself. If it happen then only way to overcome it - reboot core =0A= setup and PC.=0A= 2. Actually this issue was fixed on our setups and currently no need to =0A= check access via bridge to core.=0A= 3. Any case if it still happen on some platforms then first need to =0A= check and fix HW.=0A= =0A= On asserted any interrupt for dwc2, handlers call sequence is follow: =0A= common->gadget->host handlers. If core alive checked in common handler =0A= then checking same stuff in host handler again not needed at all.=0A= =0A= So, core alive checking in host handler create issue for your test, I =0A= suggest to not fix alive checking in host interrupt handler as you =0A= suggested and done in common handler, but just remove it.=0A= =0A= Thanks,=0A= Minas=0A= =0A= =0A= =0A=