linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Morgan <macroalpha82@gmail.com>
To: Benjamin Bara <bbara93@gmail.com>
Cc: benjamin.bara@skidata.com, dmitry.osipenko@collabora.com,
	heiko@sntech.de, jonathanh@nvidia.com, lee@kernel.org,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org, max.schwarz@online.de, nm@ti.com,
	peterz@infradead.org, rafael.j.wysocki@intel.com,
	richard.leitner@linux.dev, stable@vger.kernel.org,
	treding@nvidia.com, wsa+renesas@sang-engineering.com,
	wsa@kernel.org
Subject: Re: [PATCH v7 2/5] i2c: core: run atomic i2c xfer when !preemptible
Date: Tue, 14 Nov 2023 12:43:37 -0600	[thread overview]
Message-ID: <6553bfda.050a0220.b2675.7cce@mx.google.com> (raw)
In-Reply-To: <20231113154826.2856145-1-bbara93@gmail.com>

On Mon, Nov 13, 2023 at 04:48:26PM +0100, Benjamin Bara wrote:
> Hi!
> 
> Thanks for testing and the feedback!
> 
> On Mon, 13 Nov 2023 at 15:54, Chris Morgan <macroalpha82@gmail.com> wrote:
> > I can confirm I no longer get any of the errors with this patch. Tested
> > on both an Anbernic RG353P (RK3566 with an RK817 PMIC) and an Odroid
> > Go Advance (RK3326 with an RK817 PMIC). The device appears to shut
> > down consistently again and I no longer see these messages in my dmesg
> > log when I shut down.
> 
> Just to make sure: Are you compiling with CONFIG_PREEMPTION (and
> therefore CONFIG_PREEMPT_COUNT)?
> 
> If yes, could you please also test the following patch? Because I am not
> sure yet how polling can be false in a "polling required" situation,
> meaning .master_xfer() is called instead of .master_xfer_atomic() (while
> your test shows that irq_disabled() is true, which is basically done
> with !preemptible()). The patch should test the other way round: if the
> situation is found, force an atomic transfer instead.
> 
> Thank you!
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index a044ca0c35a1..6e3e8433018f 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -1131,6 +1131,10 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap,
>  static int rk3x_i2c_xfer(struct i2c_adapter *adap,
>                          struct i2c_msg *msgs, int num)
>  {
> +       if (irqs_disabled()) {
> +               WARN_ONCE(1, "Landed in non-atomic handler with disabled IRQs");
> +               return rk3x_i2c_xfer_common(adap, msgs, num, true);
> +       }
>         return rk3x_i2c_xfer_common(adap, msgs, num, false);
>  }
> 

I have CONFIG_PREEMPT_VOLUNTARY=y but CONFIG_PREEMPTION is not set.

Thank you.

  reply	other threads:[~2023-11-14 18:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15  7:53 [PATCH v7 0/5] mfd: tps6586x: register restart handler Benjamin Bara
2023-07-15  7:53 ` [PATCH v7 1/5] kernel/reboot: emergency_restart: set correct system_state Benjamin Bara
2023-07-15  7:53 ` [PATCH v7 2/5] i2c: core: run atomic i2c xfer when !preemptible Benjamin Bara
2023-11-13  1:12   ` Chris Morgan
2023-11-13  3:46     ` Dmitry Osipenko
2023-11-13 14:54       ` Chris Morgan
2023-11-13 15:48         ` Benjamin Bara
2023-11-14 18:43           ` Chris Morgan [this message]
2023-11-15  6:00         ` Dmitry Osipenko
2024-01-02 15:03   ` [PATCH v7 2/5] " Michael Walle
2024-01-02 21:02     ` Benjamin Bara
2024-01-03  9:20       ` Michael Walle
2024-01-03 12:49         ` Benjamin Bara
2024-01-03 15:07           ` Michael Walle
2023-07-15  7:53 ` [PATCH v7 3/5] kernel/reboot: add device to sys_off_handler Benjamin Bara
2023-07-15  7:53 ` [PATCH v7 4/5] mfd: tps6586x: use devm-based power off handler Benjamin Bara
2023-07-15  7:53 ` [PATCH v7 5/5] mfd: tps6586x: register restart handler Benjamin Bara
2023-07-18  4:46   ` Dmitry Osipenko
2023-07-19  8:22     ` Benjamin Bara
2023-07-19  8:44       ` Lee Jones
2023-07-19 18:22       ` Konstantin Ryabitsev
2023-07-28 10:33 ` [PATCH v7 0/5] " Lee Jones
2023-07-28 10:34   ` Lee Jones
2023-09-07  8:20     ` Benjamin Bara
2023-09-14 10:17       ` Lee Jones
2023-09-19 14:46 ` [GIT PULL] Immutable branch between MFD, I2C and Reboot due for the v6.7 merge window Lee Jones
2023-09-19 14:58   ` 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=6553bfda.050a0220.b2675.7cce@mx.google.com \
    --to=macroalpha82@gmail.com \
    --cc=bbara93@gmail.com \
    --cc=benjamin.bara@skidata.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=heiko@sntech.de \
    --cc=jonathanh@nvidia.com \
    --cc=lee@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=max.schwarz@online.de \
    --cc=nm@ti.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=richard.leitner@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=treding@nvidia.com \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).