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  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]
Date:   Tue, 5 May 2020 17:52:28 +0200
From:   Wolfram Sang <wsa@...-dreams.de>
To:     Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:     Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Dmitry Osipenko <digetx@...il.com>,
        Stefan Lengfeld <contact@...fanchrist.eu>,
        Marco Felsch <m.felsch@...gutronix.de>,
        linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] i2c: at91: support atomic write xfer

Hi,

> I don't expect this to be used for much more than a simple write to PMIC
> to kill the power. So this patch is tailor made for exactly this purpose.

Frankly, I don't like it much. The atomic callbacks are supposed to be
drop-in replacements of the non-atomic contexts. There may be a need to
read a PMIC register before writing something. I considered checking in
the core if we can fall back to non-atomic calls if the the atomic ones
return -EOPNOTSUPP, though,  but I still don't like the idea. I expect
that people send me minimal versions then which are extended over time
by very personal use cases. Having a proper implementation
once-and-for-all (despite bugfixes) sounds much more maintainable to me.

> Though, if you would go for full support of atomic transfers, then
> I would suggest to hack the non-atomic path to be usable in atomic mode
> instead (some I2C drivers do just that, eg. i2c-tegra).

Yes, that is what I am aiming for.

> BTW, I found this comment in i2c-core.h:
> 
>  * We only allow atomic transfers for very late communication, e.g. to send
>  * the powerdown command to a PMIC. Atomic transfers are a corner case and not
>  * for generic use! 
> 
> I think this covers the idea.

Well, since I implemented the atomic_xfer mechanism, I think I am the
primary authority of what "covers the idea", so I will fix the comment
above :) Note, there is also this comment in the way more user-visible
include/linux/i2c.h:

 509  * @master_xfer_atomic: same as @master_xfer. Yet, only using atomic context
 510  *   so e.g. PMICs can be accessed very late before shutdown. Optional.

All the best,

   Wolfram


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists