public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH] i2c: remove use of in_atomic()
Date: Mon, 1 Apr 2019 15:42:24 +0200	[thread overview]
Message-ID: <20190401134224.GD12232@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190401115414.hxrqqjujvwczdafz@ninjato>

On Mon, Apr 01, 2019 at 01:54:14PM +0200, Wolfram Sang wrote:
> 
> > > "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."
> > 
> > Ah, sorry, I missed that.
> > 
> > > And yes, I would never recommend a HW design to use I2C for shutting
> > > down/rebooting. But such HW is out there.
> > 
> > Can we then make the whole thing conditional on:
> > 
> >   system_state > SYSTEM_RUNNING
> > 
> > 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)

Looking at kernel_restart_prepare(), we set SYSTEM_REBOOT in normal
context, specifically it just did a blocking notifier call.

So no, you'll have to combine the two.

  reply	other threads:[~2019-04-01 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 21:12 [RFC PATCH] i2c: remove use of in_atomic() Wolfram Sang
2019-03-28  8:10 ` Geert Uytterhoeven
2019-04-01 10:47 ` Peter Zijlstra
2019-04-01 11:13   ` Wolfram Sang
2019-04-01 11:21     ` Peter Zijlstra
2019-04-01 11:54       ` Wolfram Sang
2019-04-01 13:42         ` Peter Zijlstra [this message]
2019-04-01 15:13           ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401134224.GD12232@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox