From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A18CCC4360F for ; Mon, 1 Apr 2019 11:54:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 723BD206DD for ; Mon, 1 Apr 2019 11:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbfDALyS (ORCPT ); Mon, 1 Apr 2019 07:54:18 -0400 Received: from sauhun.de ([88.99.104.3]:50782 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfDALyR (ORCPT ); Mon, 1 Apr 2019 07:54:17 -0400 Received: from localhost (p54B331B1.dip0.t-ipconnect.de [84.179.49.177]) by pokefinder.org (Postfix) with ESMTPSA id 06A622C7BF4; Mon, 1 Apr 2019 13:54:14 +0200 (CEST) Date: Mon, 1 Apr 2019 13:54:14 +0200 From: Wolfram Sang To: Peter Zijlstra Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Frederic Weisbecker , Ingo Molnar , Thomas Gleixner Subject: Re: [RFC PATCH] i2c: remove use of in_atomic() Message-ID: <20190401115414.hxrqqjujvwczdafz@ninjato> References: <20190327211256.17232-1-wsa+renesas@sang-engineering.com> <20190401104756.GK11158@hirez.programming.kicks-ass.net> <20190401111323.ajvo4drongc6dtel@ninjato> <20190401112109.GB12232@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i6ygapewcnz2fobg" Content-Disposition: inline In-Reply-To: <20190401112109.GB12232@hirez.programming.kicks-ass.net> 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 --i6ygapewcnz2fobg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > "This matches the use cases for atomic I2C transfers I have seen so far: > > very late communication (mostly to a PMIC) to powerdown or reboot the > > system." >=20 > Ah, sorry, I missed that. >=20 > > And yes, I would never recommend a HW design to use I2C for shutting > > down/rebooting. But such HW is out there. >=20 > Can we then make the whole thing conditional on: >=20 > system_state > SYSTEM_RUNNING >=20 > Such that we're sure to never trigger this under any other conditions? Oh, we can for sure modify the code to something else. Actually, this is why I was calling out to you. I was never comfortable with the old 'in_atomic() || irqs_disabled()' code, but wasn't sure what would be an adequate replacement which will not risk regressions. The above condition makes much more sense to me and is also much more readable. Can it simply replace irqs_disabled()? Are interrupts already disabled for system_state > SYSTEM_RUNNING? (I got a bit lost in the code paths when trying to figure it out) --i6ygapewcnz2fobg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlyh++IACgkQFA3kzBSg KbZoahAAruazcsi+JSHoP4Pk52K5w1109bs+btGr6Ti6AqRIUsAQPlPuBHbmtrLW YbfICiy7sdtvDRPImwOVVrY88/TBPWb2QcW5HUNuf9ePLKY5zeqyQ52NQYvK5CMs TI2ywZRQ7E/ViwXI5gwFDD9jl3Ygn6ag8n3Y1elEYsqllbUYw5Zf6qUnWKY1YH12 ogrdw4u23jmFiazbX1KZ1v0WwLxKl70JO3yVuJc/tAl4sncuZ4t1Cb1QYjngfYxv LDy80jsvp1B28JDeN/qEwrX5/Jx/9fPebKPhQzToPREUbj5+hT2fDu1loGOJkIsY dWuhme12B3nujnRsZzDR9YPpF32YNBa6JWwl/QxBNgJzBWSAI3zET8M6vIFSKkwo xjdeluZ5hGii+r34SG70HfM2p5zo/UgnkEHhnfgQkIOc6xlRlRdn9oDWTnCPXrjc HxodJyPWOi4wnuVdbvtBZsPmIXbj02azZfu4/61jGKij5NHQv+JFYGQdUaptCYZg B0QRusvI9v/gXc/ljz0h6JU5gp2QXGlWitw1wh03+dwvJvxGr6V9HbDdEM+8p17k vup4WcfWjUNzjeLhqeVHRvqo6frJAJ+/uJAJwe0CRec2hfcly2Zf8UNkgpk6/3jA fc8j09d5uCWf9kY2XD7i8y4ErOrYKrzKXI05Bq2uPFUXJdRSAss= =Gz1t -----END PGP SIGNATURE----- --i6ygapewcnz2fobg-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D69C43381 for ; Mon, 1 Apr 2019 11:54:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06D6620883 for ; Mon, 1 Apr 2019 11:54:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XGVtFhNo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06D6620883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=the-dreams.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GasCmRK56322XHgm/iynU+pF/Jt6Hs8QqqdtmC1I++o=; b=XGVtFhNo3hrG5OwcgHGUuu+zg 41wk8mGvJ1QMfeEFJr8pGcqRqovjbqIPkaL8nqvJEO1mB1I6xocpMi2mTmvgbaYM1OsxTq4CXHBqj hO1foz7945GV5KHBI10r5BpTFZS4LxlgUlbKNkDs/pWQvytxHI1Yvt59HHS2sZV9rmLqlkkrLRun3 IvGSicOf/F3K4mcL5x3XE4KvkCtlKMxU0chgwanbvDpv5Zo+vpaVZVpblG/mB+yIY8daHGuESWdIS hNYBVufVJk60/yTdAylWCnxMB86aG/qQ8o9aed4wmp1oZu76GfG5zYt0zsTvEgiOI7P542sf8Cgm/ jf2Rev0fg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAvW6-0000IR-5f; Mon, 01 Apr 2019 11:54:18 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAvW3-0000Hq-Sg for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 11:54:17 +0000 Received: from localhost (p54B331B1.dip0.t-ipconnect.de [84.179.49.177]) by pokefinder.org (Postfix) with ESMTPSA id 06A622C7BF4; Mon, 1 Apr 2019 13:54:14 +0200 (CEST) Date: Mon, 1 Apr 2019 13:54:14 +0200 From: Wolfram Sang To: Peter Zijlstra Subject: Re: [RFC PATCH] i2c: remove use of in_atomic() Message-ID: <20190401115414.hxrqqjujvwczdafz@ninjato> References: <20190327211256.17232-1-wsa+renesas@sang-engineering.com> <20190401104756.GK11158@hirez.programming.kicks-ass.net> <20190401111323.ajvo4drongc6dtel@ninjato> <20190401112109.GB12232@hirez.programming.kicks-ass.net> MIME-Version: 1.0 In-Reply-To: <20190401112109.GB12232@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_045416_076594_B6E8F70E X-CRM114-Status: GOOD ( 10.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Weisbecker , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-i2c@vger.kernel.org, Thomas Gleixner , Ingo Molnar , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============3724373187902765211==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3724373187902765211== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i6ygapewcnz2fobg" Content-Disposition: inline --i6ygapewcnz2fobg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > "This matches the use cases for atomic I2C transfers I have seen so far: > > very late communication (mostly to a PMIC) to powerdown or reboot the > > system." >=20 > Ah, sorry, I missed that. >=20 > > And yes, I would never recommend a HW design to use I2C for shutting > > down/rebooting. But such HW is out there. >=20 > Can we then make the whole thing conditional on: >=20 > system_state > SYSTEM_RUNNING >=20 > Such that we're sure to never trigger this under any other conditions? Oh, we can for sure modify the code to something else. Actually, this is why I was calling out to you. I was never comfortable with the old 'in_atomic() || irqs_disabled()' code, but wasn't sure what would be an adequate replacement which will not risk regressions. The above condition makes much more sense to me and is also much more readable. Can it simply replace irqs_disabled()? Are interrupts already disabled for system_state > SYSTEM_RUNNING? (I got a bit lost in the code paths when trying to figure it out) --i6ygapewcnz2fobg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlyh++IACgkQFA3kzBSg KbZoahAAruazcsi+JSHoP4Pk52K5w1109bs+btGr6Ti6AqRIUsAQPlPuBHbmtrLW YbfICiy7sdtvDRPImwOVVrY88/TBPWb2QcW5HUNuf9ePLKY5zeqyQ52NQYvK5CMs TI2ywZRQ7E/ViwXI5gwFDD9jl3Ygn6ag8n3Y1elEYsqllbUYw5Zf6qUnWKY1YH12 ogrdw4u23jmFiazbX1KZ1v0WwLxKl70JO3yVuJc/tAl4sncuZ4t1Cb1QYjngfYxv LDy80jsvp1B28JDeN/qEwrX5/Jx/9fPebKPhQzToPREUbj5+hT2fDu1loGOJkIsY dWuhme12B3nujnRsZzDR9YPpF32YNBa6JWwl/QxBNgJzBWSAI3zET8M6vIFSKkwo xjdeluZ5hGii+r34SG70HfM2p5zo/UgnkEHhnfgQkIOc6xlRlRdn9oDWTnCPXrjc HxodJyPWOi4wnuVdbvtBZsPmIXbj02azZfu4/61jGKij5NHQv+JFYGQdUaptCYZg B0QRusvI9v/gXc/ljz0h6JU5gp2QXGlWitw1wh03+dwvJvxGr6V9HbDdEM+8p17k vup4WcfWjUNzjeLhqeVHRvqo6frJAJ+/uJAJwe0CRec2hfcly2Zf8UNkgpk6/3jA fc8j09d5uCWf9kY2XD7i8y4ErOrYKrzKXI05Bq2uPFUXJdRSAss= =Gz1t -----END PGP SIGNATURE----- --i6ygapewcnz2fobg-- --===============3724373187902765211== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3724373187902765211==--