lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231113154826.2856145-1-bbara93@gmail.com>
Date:   Mon, 13 Nov 2023 16:48:26 +0100
From:   Benjamin Bara <bbara93@...il.com>
To:     macroalpha82@...il.com
Cc:     bbara93@...il.com, benjamin.bara@...data.com,
        dmitry.osipenko@...labora.com, heiko@...ech.de,
        jonathanh@...dia.com, lee@...nel.org, linux-i2c@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
        max.schwarz@...ine.de, nm@...com, peterz@...radead.org,
        rafael.j.wysocki@...el.com, richard.leitner@...ux.dev,
        stable@...r.kernel.org, treding@...dia.com,
        wsa+renesas@...g-engineering.com, wsa@...nel.org
Subject: Re: [PATCH v7 2/5] i2c: core: run atomic i2c xfer when !preemptible

Hi!

Thanks for testing and the feedback!

On Mon, 13 Nov 2023 at 15:54, Chris Morgan <macroalpha82@...il.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);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ