Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1214068imu; Fri, 21 Dec 2018 14:59:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4meupbCximbR6ypwtX2/I1TI6JnxJqemR7Vq4AHg6SzYgJ0y4qZK6+i4oO/jRSYQTH9isC X-Received: by 2002:a62:2292:: with SMTP id p18mr4514983pfj.9.1545433160981; Fri, 21 Dec 2018 14:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545433160; cv=none; d=google.com; s=arc-20160816; b=RYhvh6Vz+90HO68PGKOCrLDxRaS0pujsk4vvi/qUWobD1joisUNG61XBGaCpMXsbT6 YvmT4aBp25z0dujr6lQ1sBbz9UnMF84OuW6LaCAfcXsODRI6V8db/BClpkVjiWf3iDUA FbmIO1iB/6Fp/FS/li04Pvkr2EZ1UuagqB2UY5JGqdDKw96Ed4Ay767k3Mcr9isY6pyS Xzgnv0avHoMrYXB8oWfJ5ksllvPWFZrtqsoKDku8MnHk//AWqvLJlHwjtYWeClieYPL8 xv0vdiUn60gXgrOB/xKf+wgsDZ6rBrTbWjiKEqed7DMDWpgyJ0uk5Z1CMCoRk4CLyf3u wZ6Q== 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=DKoHXb7DD6scPzUGZaf+wJI/Q+crqEpPBOHxm0nFYik=; b=yOlht9DSsytNqMmPJA1dpTsBQmy27RejeGp6MAAj9KlkbiL58gZYPWmINM8pj821S4 hHsI9O+XpsuV09/ebYaknHsUcGzsE4aFurKf+VDNOdbuGf9QDx03dtKr0U9bh971XYxh POJ9ZZKuI3FGw72mEjY0UL1sIavKbrBx3MELnnrSFTLeG+nFlptl6gXPqnaVErxOdY0S g6Xou2IHn4FiBQ6MeNVOwGYNJrbuJwcXONqLCgvkSbsYUbWiaXUjDdq5vFGnncC9noYu j3UBv5xeEes3reWaLWvOEXQseIs2EVskEJ9KJVNdJ+g1QLuOWlBMolkCIM22/pOA222g SPjA== 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 t23si19208704pgi.181.2018.12.21.14.59.05; Fri, 21 Dec 2018 14:59:20 -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; 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 S2390894AbeLUOu0 (ORCPT + 99 others); Fri, 21 Dec 2018 09:50:26 -0500 Received: from sauhun.de ([88.99.104.3]:43864 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387417AbeLUOu0 (ORCPT ); Fri, 21 Dec 2018 09:50:26 -0500 Received: from localhost (p54B334FA.dip0.t-ipconnect.de [84.179.52.250]) by pokefinder.org (Postfix) with ESMTPSA id ABBF62E3542; Fri, 21 Dec 2018 15:50:22 +0100 (CET) Date: Fri, 21 Dec 2018 15:50:22 +0100 From: Wolfram Sang To: Hans de Goede Cc: Lukas Wunner , Wolfram Sang , linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/10] i2c: add suspended flag and accessors for i2c adapters Message-ID: <20181221145022.umsugdwadw5a5ag6@ninjato> References: <20181219164827.20985-1-wsa+renesas@sang-engineering.com> <20181219164827.20985-2-wsa+renesas@sang-engineering.com> <20181219172250.ytronxeq2yc4vp4r@wunner.de> <83b17734-2437-5a04-8843-e18ccf7ad398@redhat.com> <20181219223341.GA998@kunai> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="s2jmrr4347zzegwl" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --s2jmrr4347zzegwl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > > I think this might be as simple as adding: > > >=20 > > > if (WARN_ON(adap->dev.parent->power.is_suspended)) > > > return -ESHUTDOWN; Peter, I think this should work for muxes, too, or? The i2c_transfer() call to the mux will not be rejected, but it will be later when we reach the root adapter. And then the error code will be pushed down the tree until we arrive at the mux again. So, the rejection will not happen at the earliest time, but it will happen. Is my understanding correct? > > I have seen this flag but decided against it. One reason is because it > > is marked as "PM core only". >=20 > Right and we definitely should not be touching it, but reading it should > be fine. Seems like it. So far, no rejection from the other PM people :) > No you are right, there is a race here, but I don't think we are likely to > hit that race. Normally there won't be any ongoing i2c-transfers during > a system suspend and more over, the goal of adding this check is to help > find problems, so even if the check sometimes does not trigger because > of the race that is not really a big deal. You are right that the impact of a missed detection is not fatal. That helps. The low likeliness was not an argument for me, though, because detecting rare things is very important IMO. Because, well, they are rare and especially hard to debug. > I think we need to get really unlucky to have both a suspend ordering > problem in the first case (already a somewhat rare thing) combined with > hitting this race in such a way *each time* that we don't trigger the > WARN_ON. And here you convinced me: even if we miss a detection once, I agree it is super super unlikely to hit the race every time. > To me this seems a case of perfect being the enemy of good. When we > first started discussing this you wanted to not have to modify the > adapter/bus drivers for the check, using adap->dev.parent->power.is_suspe= nded > gives us that and it will also work for complex cases like > the i2c-designware case, so I believe the benefits outway the downsides. I'll try it. --s2jmrr4347zzegwl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlwc/aoACgkQFA3kzBSg Kbb5bQ//URYlNvbXXExtMF0qLfiMDARGWqfm2kgBo2NeAlG+mCOpUuKOdjzF2Xbc 32cnfKCyw1bvKLMTyLLdaEzuQihOCUlKSsc1le6qepNiOvedI6Tp9XfS17Q6Z73K fJLIjImgM5ZHOEN0y2GnSfz3QxM265h5VUBqyZzfkAddi5QrDwDP1wniTXVrw0Z7 04q1EQ1ypXbgvkHgRtnzg/gv5OkmovUEV7QBFS9U8RchgiXmYOvlJZkR/l4ZW60K PEqv6IuBgfC6ikHMaRyovnhVm2jiEm6bsLi/RgwJxxAWPwFJaFcF2hf4r6rnBSi4 sZrDP0jOQxKARqKaiRv/Szp2RlJY5f/PFsrmwDt/LD7F591vhVZdG8/mO4oYLphd pKgnu2VBFENJVEMVZ76KbhAGz6J4mh+agjOlX0NKKXWO/au0+qFWVrcqJfP0VbiC CL7Dux/fjMsBvmDwaawP0uR2dSsKgnL8YQhDDxjN9PXU/RmFzF1dpGaAa/nuXKVZ 8KsbZaricdNv+jrHLklZPTZi9a9hTJrOtjeTvbYt2DLpitZRdiTjtC6bds9sWisz 4SGO8KMgxm0tBMSwsTIYNmMA8d/5AdVMCtPxlrUXk7AgPFjzAhU/li+emcQ5pUO4 GkrPLtjbUll25du9Gr4O1I6qcq+x7hwgBr4uSClf63QizTK4L24= =LQSI -----END PGP SIGNATURE----- --s2jmrr4347zzegwl--