Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5424928imm; Tue, 18 Sep 2018 09:18:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdajHhIPk5UKaEbykS6hvQ+qMtpQpJRKaHEF4bEJWo5N442bvdYogRTsh8NpA+bMf8F7rbIa X-Received: by 2002:a62:384a:: with SMTP id f71-v6mr31610047pfa.48.1537287526870; Tue, 18 Sep 2018 09:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537287526; cv=none; d=google.com; s=arc-20160816; b=IOwX5/esCNr/SqfuUEokCrfPoDr/Ropk1038rkpBRWIb1IFri9If/6KTWEJLdhPDOZ mjzd0zcAO99EY/QV81Ux1iVbw4DsvTqozeP1BHQxNdRivSnv03QJVo+h69lkZRNoZrMo D+I5mApkCbmXfgYK3WPHnhNDHz3JfdV/kDu5Q41oBptES3TOgw3MpGUpLAXX29J/JS/z xbpSr+yN6cRIDTTR4a55f5KK1dP7lYvILNEJqk00k3zIB4xtaXqH9VRxgdKdmY6TBihz Z+JyKUCOq7NqqfVp19PpaE0Ahz6IDUVNMuT0Gd/xEb/XcEB9ickYm/7UDjSb9N9aOM0f 31UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=Q8f5TrSNLIe1z/M/aehl1L0nQlXQ0Vr9/8sv0pfynt8=; b=eHvNf570TWxK3vB2rPlD5szKUEKrRZIhGWkMygfdf4sapIV8r5fT0lQ52kaPoDH3r8 jMqWdQtfxIoCksyBn0zXsWI6n+TQ+6BBud9Lh3fp/JvrWyGSylhsaA1UklGArRZMQP9d yD0WecdOQvsilCfhF7wBkqPDptz+ptuJIT8D7V0WhGkTtKGVXF/aVbIlQZ09rbYR6h6S L2JgQvFPjlf3ANSCXLCX5jVqw175VX543VJDJb7oGcW+yT0N2xSPTQGa9TovGiTFMqom xfNd5roY09BYJJktCHnQIaW07nW2MWfHW5t5huWu6ZA2bIXwrWyBPl3kJ2dONIjao/uS sYrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=jBy6sSuz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184-v6si17355665pgj.421.2018.09.18.09.17.58; Tue, 18 Sep 2018 09:18:46 -0700 (PDT) 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=fail header.i=@kemnade.info header.s=20180802 header.b=jBy6sSuz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729923AbeIRVtp (ORCPT + 99 others); Tue, 18 Sep 2018 17:49:45 -0400 Received: from mail.andi.de1.cc ([85.214.239.24]:44476 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728065AbeIRVtp (ORCPT ); Tue, 18 Sep 2018 17:49:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q8f5TrSNLIe1z/M/aehl1L0nQlXQ0Vr9/8sv0pfynt8=; b=jBy6sSuzNRE8jzCiuudEaivvK BDKssQX5P7AUEhOAMMuMF3FCbouAE/oN+8/4UrRPS1TVFJ55Z5CWEf+ullopJCgPD2LFhO0jHh447 ayJVLWeCPK9e6WE06gLlozNJOYBaHH7uwGm49RwoG9KPmf4ZtQDfzcVoQoTlGboNMH5Yo=; Received: from p5dcc36a5.dip0.t-ipconnect.de ([93.204.54.165] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2Ifo-0005nY-QG; Tue, 18 Sep 2018 18:16:24 +0200 Date: Tue, 18 Sep 2018 18:16:19 +0200 From: Andreas Kemnade To: Dmitry Torokhov Cc: kishon@ti.com, lee.jones@linaro.org, daniel.thompson@linaro.org, wsa@the-dreams.de, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Discussions about the Letux Kernel Subject: Re: [PATCH RESEND] phy: phy-twl4030-usb: fix denied runtime access Message-ID: <20180918181619.2e266f0d@aktux> In-Reply-To: <20180917222345.GA203020@dtor-ws> References: <20180917052254.12336-1-andreas@kemnade.info> <20180917175131.GA104770@dtor-ws> <20180917205634.6a320cad@aktux> <20180917222345.GA203020@dtor-ws> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/hF17.lQIoc7SEI58RHUA+gC"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/hF17.lQIoc7SEI58RHUA+gC Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, On Mon, 17 Sep 2018 15:23:45 -0700 Dmitry Torokhov wrote: > On Mon, Sep 17, 2018 at 08:56:34PM +0200, Andreas Kemnade wrote: > > Hi Dmitry, > >=20 > > On Mon, 17 Sep 2018 10:51:31 -0700 > > Dmitry Torokhov wrote: > > =20 > > > Hi Andreas, > > >=20 > > > On Mon, Sep 17, 2018 at 07:22:54AM +0200, Andreas Kemnade wrote: =20 > > > > When runtime is not enabled, pm_runtime_get_sync() returns -EACCESS, > > > > the counter will be incremented but the resume callback not called, > > > > so enumeration and charging will not start properly. > > > > To avoid that happen, wait and try again later. > > > >=20 > > > > Practically this happens when the device is woken up from suspend by > > > > plugging in usb. > > > >=20 > > > > Signed-off-by: Andreas Kemnade > > > > --- > > > > drivers/phy/ti/phy-twl4030-usb.c | 9 +++++++++ > > > > 1 file changed, 9 insertions(+) > > > >=20 > > > > diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-= twl4030-usb.c > > > > index a44680d64f9b..1f3cf4e48383 100644 > > > > --- a/drivers/phy/ti/phy-twl4030-usb.c > > > > +++ b/drivers/phy/ti/phy-twl4030-usb.c > > > > @@ -552,6 +552,15 @@ static irqreturn_t twl4030_usb_irq(int irq, vo= id *_twl) > > > > =20 > > > > status =3D twl4030_usb_linkstat(twl); > > > > =20 > > > > + /* we might get here too early when runtime is not ready yet > > > > + * and we will get an EACCESS later, so try again later > > > > + */ =20 > > >=20 > > > How exactly can this happen? What disables (and later re-enables) > > > runtime PM? =20 > > If the whole resume process is started by plugging in usb, the > > interrupt will be triggered still in the resume process so that=20 > > runtime resume is not yet possible, pm_runtime_get_sync() returns > > EACCESS =20 >=20 > I see. This all seems a bit wonky, to be honest. I would expect that the > driver would have a suspend routine that disables interrupt and also > configure interrupt for wakeup (enable_irq_wake) and kick bus scanning > from there instead of aborting interrupt handler... >=20 well, that seems doable. So there will be a v2. > > =20 > > > How can we guarantee that the interrupt will be > > > re-triggered? > > > =20 > > The interrupt will not be re-triggered but the handler will be > > called at some other places... > > =20 > > > > + if (!pm_runtime_enabled(twl->dev)) { > > > > + cancel_delayed_work(&twl->id_workaround_work); > > > > + schedule_delayed_work(&twl->id_workaround_work, HZ); > > > > + return IRQ_HANDLED; > > > > + } > > > > + =20 > > ... for example by this delayed work which is already there. =20 >=20 > If we decide to keep this, it should be mod_delayed_work() I think. >=20 Well, is that valid for the other uses of id_workaround_work() (which are clearly required)? So there should be a second, independent cleanup patch for the existing uses? Regards, Andreas=20 --Sig_/hF17.lQIoc7SEI58RHUA+gC Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE7sDbhY5mwNpwYgrAfb1qx03ikyQFAluhJNMACgkQfb1qx03i kyRqSRAAxyTwGaRnx00uUC5GgMf7USmj0z/RC/wWCX+8F/UnZfMyvGl4zgEeE9wd uXMgKTAJxHCIYSgp106rgo3Y/IbqMZ1t0o27HuD7fmmL2HJ8MuxiZkNYVzkfuKz4 518CgFqBi8q6SP+zAG9TI3bQZJapFbxORoSdRAQGcfFDYeicCx5ObUJh4BRMI5Ey sX9g237+QzuNMTYvTYa0Vh0HiceHnkAlD2Sj2+jgMFHS7cKitj4bnAajxCNG5y/i C0OZ4JUsm4d3Ztea7HEi4g5TI97l24sHraYhHbcPZ8twVlccgEwGWrtsuDHclXFc DFbaeqWRsvLhw0jtdRRtKGiB40cX5W8WAVFTG3HEzBbostSzeln7hGb3vPR1a5rO 4MdWLFTDTFUZyxEfm1CD7qRap7zD/v+choz1ya8kAe/f4plTBdLKWxkC+pZzQRij nsy+kmC3PSsTH/w6CpBWv883ZiESLijxeLvmP8/69vZTaqhUzRz01tVIvSHtoUgm lEDSDkMvLpktKUuchUV3tpeyjPU74iuZsCJC+yEIQnYg2TPdOAUKLhpEeGC7NiYr P7F5xANEntc13a4fotAK6k2pA4Z6ftvseWCvfgavWoUfgIRShk/mfqI8wbctS5Fo DRaM5Zk/Fp5Nsqy7FsjA0P4pUj/0C+bHkavbqQjl6SxF388tTKk= =miFt -----END PGP SIGNATURE----- --Sig_/hF17.lQIoc7SEI58RHUA+gC--