Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5624409ybe; Tue, 10 Sep 2019 06:36:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFZj9hCIyPBS2m3isELSw3upKuO7QYAvg6mqQBCgXgB9mmxkfnBYk+/8A3gyOCLVp2k9ou X-Received: by 2002:a50:b885:: with SMTP id l5mr29755033ede.190.1568122582364; Tue, 10 Sep 2019 06:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568122582; cv=none; d=google.com; s=arc-20160816; b=cXkW4GNR7YPxbeIJnH7nO+oYkpQ1yXvey033R3QbuROOSuDwfjQo2WWHrSmkqEefed +rs90VCkBKcUWxgqQau2kLvExb6sz3uQrtmIQeRX0BSt2YFHerBzLXgFn9Wz3DHBywFT 1VTJvPQ4NjYursedh7phWz2ZU9XPSHlO8eJM3kbr1X7LV9oOLYSFin4fsBtna4qcTN/v xDKc9cabkHxmyvdB/LwHr/62UE+QkcQybgtIxhdiQml3SZz8/w1dx4MV+5j9PYk9MXkG X5cBG+aP2AX99ZeFlBcrkeQxRsNJOhLV+ZlbFhIMNcuOYMKPQdXWKVAjsHHw+wRbVpT7 monQ== 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:dkim-signature; bh=0C/DGTNAt/pxMbfWShWSjnQBCZsM1Gq2DZ026OeEeEM=; b=rFYqHQEpwrWFwkPHIc+E4jwSMb7uiPqYysR834wSoLfhKSvB+07ldnoTBywtaBXPOy ZbVQcvIf317TUtOWuHEFBRUm0O7A89l4d7EDbclm/6eGG+9wUtiBDpX7edpcXeRd136w 1Yw1h0ftnmphMfmGAb9lyTkDKGRy4Q5SrM3sbDuRR2f2vl5Kz6ShBtSljZEofXjKNSbi aJfR3gmsqoqjh7yawkYQCozEE9sDMeleox273Zx5GOQWQFOewoui+33GbV/xvc5pao24 d83AZWLDWrtVEikzXY3ktLLyopHzgZP+ktn80RgWGYGuHv3s9ic+veBY36Wo4WDQVaQR NvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gn3jTLva; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lu11si8970804ejb.215.2019.09.10.06.35.58; Tue, 10 Sep 2019 06:36:22 -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=pass header.i=@gmail.com header.s=20161025 header.b=gn3jTLva; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390621AbfIJMWh (ORCPT + 99 others); Tue, 10 Sep 2019 08:22:37 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43394 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726841AbfIJMWh (ORCPT ); Tue, 10 Sep 2019 08:22:37 -0400 Received: by mail-wr1-f67.google.com with SMTP id q17so15082047wrx.10; Tue, 10 Sep 2019 05:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0C/DGTNAt/pxMbfWShWSjnQBCZsM1Gq2DZ026OeEeEM=; b=gn3jTLva7gqm10XLzZP+1zgIyvlnmeQxkjC5x0FhBvTsLZfzQUbv577MFC3ej61qkk QUcHeyWAUQbDIq5yWKSmbVRY0MA2LCbQtWWlOaSWWR8zE3CX3e1fnfOl+iorBVTWak3Q ynUXATF9cdyRp5feFGyarKGjYuVmABNH2J+4h8qiJ2y2Gjs//9Tm2Pl4xNnN/Ik99P7c lz3PDzSrup6Ogajcd57S4+QwS5MaAzgxOWehuvA9JLELfyChSHfhyghE/Wb1lCKCk75A cyvTpzeOgAGSajMFeHQlfKfcA3/eTUApjsPMtIyvNcsw+Zqxf+MwIPqeg2zQ2plIKEs0 THLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0C/DGTNAt/pxMbfWShWSjnQBCZsM1Gq2DZ026OeEeEM=; b=iNyD8oUFHklTattERf8Fjva7KMtE6zqZxFTxXnol5/e4YqauejTT4g/XAbDoOMBKuq RjEY/n+hoReFHa393aOidJJzMOJeGzj8zNKD4nsh1keytxI7ROy7Quc3X8vokjY/JtU0 2otl6f4A0Wq/JQioGGAZGOdQCSZWqrWUp4jYaXbVNKfHrMSmKZyVJVtkG+IMcI0kkQ3W 7oPBTQ7MlCbdjwEDpFymyy6uG6PjTwoq8ETkdUIWpaDB7tv2xtJf0Xg09TXS5ux1Fjqy J2cubelXORGVkk3MTmS3l8DQs8U1om3wVXEQjefDpdxgSgHd1mUwGreyhBg3AYEHgbD4 /VZg== X-Gm-Message-State: APjAAAWYmBE5YGZeLDm4NLEgwpW1cRvhAAFLTTQl9P9YnQREjAH8+Ysa xTfXG/p4IQVmyL6UKuuOWRI= X-Received: by 2002:a5d:560e:: with SMTP id l14mr3161232wrv.257.1568118153842; Tue, 10 Sep 2019 05:22:33 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id u18sm2503981wmj.11.2019.09.10.05.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 05:22:32 -0700 (PDT) Date: Tue, 10 Sep 2019 14:22:31 +0200 From: Thierry Reding To: Jon Hunter Cc: Wolfram Sang , Laxman Dewangan , 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: <20190910122231.GA9897@ulmo> References: <20190910092917.29901-1-jonathanh@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <20190910092917.29901-1-jonathanh@nvidia.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --82I3+IH0IqGh5yIs 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 > --- > drivers/i2c/busses/i2c-tegra.c | 40 +++++++++++++++++++--------------- > 1 file changed, 22 insertions(+), 18 deletions(-) Acked-by: Thierry Reding --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl13lYUACgkQ3SOs138+ s6GNIhAAr1wpfhG5Dempiu90U5owP50YjVPmaZPewQkYKLavbo7O6qsOI1UDmlhY H2Iyz/H48Pnx3WzrdeEdFOKCHC654BdG/No4Dc0Y+/repnm6FATjclt0aEAd9MHv nNvnCPut/9dn05JFmTWPSJTYcV8rBN7bAXFxrqhRuFbZXiKt+bF4RHUD7jDQa6/X YF9Qw6D11VDci3PUwMsSILTQ/cgGG5GfTQTEEPKKlx5VZ1pBnHqtkbhH3b8EFTSN JptAswAB80EgVt0e6MFugHjOWTQkyU5QmEu5qK620sKf7Gw92ZYUed29Rw8zZKFR KjGxPM/kbbfkvtHuPrkd3SloBq8UApsYIq20Av0ZCrN/a4CAR2BKS1SgFF2cRRUd 2pbROKmOoq4d0WBrnQha2ZXCHHE5/mTgOb9Hmgn7rkSXjPBp89xRVFEcRGRo+Wxk iCRljLwmJZcOpczQMFW/W3kktkB5q1BBRDK0Qt2kA70R/zdqs/MYFZaj8ly5rVrX fF65CVBALJHJkpBka1220/cei1cgqyHTVxi6o2h73v29lRi7ueWb9up707g6n4Tb MYcmAQKyhD32xPXN2/W4y6AJVvIdr3uDH7+xfX+HgzXm1Vom0Lmzxh0dhSz7bIWA 13U0feJQ5Ov1kKdiU3H3sv/CYuIx3E+PpvonIPOr9AxYlKkDdRs= =wwod -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--