Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1428713ybe; Fri, 13 Sep 2019 16:57:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMhzWybqse8R03nFX7ykvcRA6KwZFUsVHRfshIbQ0DB9MRoXmmuEd/3CksB4DVM8bWu1Uc X-Received: by 2002:a17:906:53c1:: with SMTP id p1mr41138754ejo.227.1568419056941; Fri, 13 Sep 2019 16:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568419056; cv=none; d=google.com; s=arc-20160816; b=ZImf5vF7RkhmoBguOF4qTcgeiuOhhb+qkB6cIE8UaoFVCFXZ20LSOIAHEVfDiFqQW+ m0mfzM/lpP3nQgdVxM52+yiyu5FEHSPZtxAEIhOoXgUis8VQNw5ybOL1f++21zV1sdjs gJ1e2qRWNPV4uudmei3SrYXpVY6SDqSBQVv77gDHXGLCA3aPIWVxclZVRfUCCD5zH2FG CEpXa2DGKvvKhg444JRzq0u8uV5O0NeS8fMVDk8CVBL67HdGJjHCS8BqRTHnP6eskmqv 9knDdBC5bbudxt3bVHaCWyuyge2HS7bv2TqW/EhqAVB+fZpP+h8iNpWU2WQLxpnIMKZs sgXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tO69MzRPgSxcIvzLNbTjx2A/WlvwXo5of5YO2dxWvcw=; b=ZYzumAxjjSCQ+hcmIxXs1nbLHB+xNjA3ebphp4vouq+bpyivAOHuHZrI19y7txLFGg 9aMHDpXVtLqAP8c4epv0YQwyUKY/l9VNgNKfga1yg9DBPQJ/hKu99hvxDavHwVUojk5A wKXHi4DBOHctz4aJr4Lkqzulpr5j+sheicfYNf/ommp/kXkmmyjNTbUDjy9/FaPaFa5p OvcCgkLY4I3wXqM/llfPFtB9G8LrUQMrDRjsO+xQGvOsJTLvXlxWQRNUD5hDjp0EF2pW gERcczkQq4091Yn8FxxMUKDTOesSUz2E51QdTJml2myHU1FOLi+GPVZD35qKdk5NkVVd reDw== ARC-Authentication-Results: i=1; mx.google.com; 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 d3si15207373eja.30.2019.09.13.16.57.00; Fri, 13 Sep 2019 16:57:36 -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; 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 S2387786AbfIMOSo (ORCPT + 99 others); Fri, 13 Sep 2019 10:18:44 -0400 Received: from sauhun.de ([88.99.104.3]:35986 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbfIMOSo (ORCPT ); Fri, 13 Sep 2019 10:18:44 -0400 Received: from localhost (234.77.63.94.rev.vodafone.pt [94.63.77.234]) by pokefinder.org (Postfix) with ESMTPSA id AB6CA2C3115; Fri, 13 Sep 2019 16:18:41 +0200 (CEST) Date: Fri, 13 Sep 2019 15:18:41 +0100 From: Wolfram Sang To: Jon Hunter Cc: Laxman Dewangan , Thierry Reding , linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: tegra: Move suspend handling to NOIRQ phase Message-ID: <20190913141841.GC1022@kunai> References: <20190910092917.29901-1-jonathanh@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="69pVuxX8awAiJ7fD" Content-Disposition: inline In-Reply-To: <20190910092917.29901-1-jonathanh@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --69pVuxX8awAiJ7fD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 10, 2019 at 10:29:17AM +0100, Jon Hunter wrote: > Commit acc8abcb2a9c ("i2c: tegra: Add suspend-resume support") added > suspend support for the Tegra I2C driver and following this change on > Tegra30 the following WARNING is seen on entering suspend ... >=20 > WARNING: CPU: 2 PID: 689 at /dvs/git/dirty/git-master_l4t-upstream/kerne= l/drivers/i2c/i2c-core.h:54 __i2c_transfer+0x35c/0x70c > i2c i2c-4: Transfer while suspended > Modules linked in: brcmfmac brcmutil > CPU: 2 PID: 689 Comm: rtcwake Not tainted 5.3.0-rc7-g089cf7f6ecb2 #1 > Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0xb4/0xc8) > [] (dump_stack) from [] (__warn+0xe0/0xf8) > [] (__warn) from [] (warn_slowpath_fmt+0x48/0x6c) > [] (warn_slowpath_fmt) from [] (__i2c_transfer+0x35c= /0x70c) > [] (__i2c_transfer) from [] (i2c_transfer+0x58/0xf4) > [] (i2c_transfer) from [] (i2c_transfer_buffer_flags= +0x4c/0x70) > [] (i2c_transfer_buffer_flags) from [] (regmap_i2c_w= rite+0x14/0x30) > [] (regmap_i2c_write) from [] (_regmap_raw_write_imp= l+0x35c/0x868) > [] (_regmap_raw_write_impl) from [] (_regmap_update_= bits+0xe4/0xec) > [] (_regmap_update_bits) from [] (regmap_update_bits= _base+0x50/0x74) > [] (regmap_update_bits_base) from [] (regulator_disa= ble_regmap+0x44/0x54) > [] (regulator_disable_regmap) from [] (_regulator_do= _disable+0xf8/0x268) > [] (_regulator_do_disable) from [] (_regulator_disab= le+0xf4/0x19c) > [] (_regulator_disable) from [] (regulator_disable+0= x34/0x64) > [] (regulator_disable) from [] (regulator_bulk_disab= le+0x28/0xb4) > [] (regulator_bulk_disable) from [] (tegra_pcie_powe= r_off+0x64/0xa8) > [] (tegra_pcie_power_off) from [] (tegra_pcie_pm_sus= pend+0x25c/0x3f4) > [] (tegra_pcie_pm_suspend) from [] (dpm_run_callback= +0x38/0x1d4) > [] (dpm_run_callback) from [] (__device_suspend_noir= q+0xc0/0x2b8) > [] (__device_suspend_noirq) from [] (dpm_noirq_suspe= nd_devices+0x100/0x37c) > [] (dpm_noirq_suspend_devices) from [] (dpm_suspend_= noirq+0x1c/0x48) > [] (dpm_suspend_noirq) from [] (suspend_devices_and_= enter+0x1d0/0xa00) > [] (suspend_devices_and_enter) from [] (pm_suspend+0= x220/0x74c) > [] (pm_suspend) from [] (state_store+0x6c/0xc8) > [] (state_store) from [] (kernfs_fop_write+0xe8/0x1c= 4) > [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x1c= 4) > [] (__vfs_write) from [] (vfs_write+0xa4/0x184) > [] (vfs_write) from [] (ksys_write+0x9c/0xdc) > [] (ksys_write) from [] (ret_fast_syscall+0x0/0x54) > Exception stack(0xe9f21fa8 to 0xe9f21ff0) > 1fa0: 0000006c 004b2438 00000004 004b2438 00000004 000= 00000 > 1fc0: 0000006c 004b2438 004b1228 00000004 00000004 00000004 0049e78c 004= b1228 > 1fe0: 00000004 be9809b8 b6f0bc0b b6e96206 >=20 > The problem is that the Tegra PCIe driver indirectly uses I2C for > controlling some regulators and the I2C driver is now being suspended > before the PCIe driver causing the PCIe suspend to fail. The Tegra PCIe > driver is suspended during the NOIRQ phase and this cannot be changed > due to other dependencies. Therefore, we also need to move the suspend > handling for the Tegra I2C driver to the NOIRQ phase as well. >=20 > In order to move the I2C suspend handling to the NOIRQ phase we also > need to avoid calling pm_runtime_get/put() because per commit > 1e2ef05bb8cf ("PM: Limit race conditions between runtime PM and system > sleep (v2)") these cannot be called early in resume. The function > tegra_i2c_init(), called during resume, calls pm_runtime_get/put() and > so move these calls outside of tegra_i2c_init(), so this function can > be used during the NOIRQ resume phase. >=20 > Fixes: acc8abcb2a9c ("i2c: tegra: Add suspend-resume support") >=20 > Signed-off-by: Jon Hunter Applied to for-next, thanks! --69pVuxX8awAiJ7fD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl17pUAACgkQFA3kzBSg KbYHuhAAlvTw4F2YkaELJucgf10FnYx+rri3f8bXFgPngE/Hm0Fa/zqFqvexSCjn P1dqa0GVptFu68JHSz64wbxnynZ/tTN9hcy0TxJA1Ob2Yd9zGz3UWkZMyQlYFMBE SoMDsGrTzoDm3Yh7ENATNJRZew0/Wr2+oe/z1IdBAYKiFh+p2bUVhVvwtHUydznT Q02/xe5BMPRRPZ4DY2gpO4OkttJbZz6qXFnJM5VCwLqBaUBYp6mIsmMOlOrBNc5F 4ROfkmKhXn3fL3sRND+2P00BYVyaStHP6U7Jm7SZ+2fJncLlcF674CCMdm2r6H7C RB2XMAgP3YsPx/SFy0WDtMhKrHx32MUUwnJ329Vxj4xQ5GZH7lmEQKei1IOcdNdI AwAuBf+B68PRIdm5aL3tHWcrBklxKhwCD0XERjwl862C5/ugsuSb1UYzz/BIA/nv G52PYq70iD/ZBUswmkzzDd3/ehSFqyoD/XUlz5hrjRhADHJJN7Yt9y2ypPLEfsL6 5na67Xf91L9sKRDIsI9CDD0hh6mjXdDVob993NUM0TVe/pmnmlPrneWV+kUrb1Du n7kVfQh6yN8+yigjA3heXBjs1WbaMSgZB9cwCpEVHFVSTCMvXVJCVtONjQfaiXyC aWb9EyCiNxvso6K2Y5M3M7QQU1DhrwcizvSeucNgp+B3mcqixjU= =ic6W -----END PGP SIGNATURE----- --69pVuxX8awAiJ7fD--