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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230905230821.h7a7thjgm2do3w64@zenone.zhora.eu>
Date:   Wed, 6 Sep 2023 01:08:21 +0200
From:   Andi Shyti <andi.shyti@...nel.org>
To:     Sean Nyekjaer <sean@...nix.com>
Cc:     Pierre-Yves MORDRET <pierre-yves.mordret@...s.st.com>,
        Alain Volmat <alain.volmat@...s.st.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        linux-i2c@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] i2c: stm32f7: Add atomic_xfer method to driver

Hi Sean,

On Mon, Sep 04, 2023 at 07:29:59AM +0200, Sean Nyekjaer wrote:
> Hi Andy,
> 
> > On 3 Sep 2023, at 14.46, Andi Shyti <andi.shyti@...nel.org> wrote:
> > 
> > Hi Pierre-Yves, Alain,
> > 
> > mind taking a look here?
> > 
> > [...]
> > 
> >> @@ -357,6 +357,7 @@ struct stm32f7_i2c_dev {
> >> u32 dnf_dt;
> >> u32 dnf;
> >> struct stm32f7_i2c_alert *alert;
> >> + bool atomic;
> > 
> > this smells a bit racy here, this works only if the xfer's are
> > always sequential.
> > 
> > What happens when we receive at the same time two xfer's, one
> > atomic and one non atomic?
> 
> From the include/i2c.h:
>  * @master_xfer_atomic: same as @master_xfer. Yet, only using atomic context
>  *   so e.g. PMICs can be accessed very late before shutdown. Optional.
> 
> So it’s only used very late in the shutdown.
> 
> It’s implemented the same way as in:
> drivers/i2c/busses/i2c-imx.c
> drivers/i2c/busses/i2c-meson.c
> drivers/i2c/busses/i2c-mv64xxx.c
> drivers/i2c/busses/i2c-tegra.c
> … etc…
> 
> 
> In drivers/i2c/i2c-core.h it’s determined whether it’s atomic transfer or not:
> 
> /*
>  * We only allow atomic transfers for very late communication, e.g. to access a
>  * PMIC when powering down. Atomic transfers are a corner case and not for
>  * generic use!
>  */
> static inline bool i2c_in_atomic_xfer_mode(void)
> {
>         return system_state > SYSTEM_RUNNING && irqs_disabled();
> }
> 
> So you would not have an atomic transfer and later an non atomic.

What about the opposite? I.e. a non atomic and later an atomic,
for very late tardive communications :)

Andi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ