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:   Wed, 8 Jan 2020 09:44:36 +0100
From:   Arnd Bergmann <>
To:     Christophe Leroy <>
Cc:     Krzysztof Kozlowski <>,
        Geert Uytterhoeven <>,
        Rich Felker <>,
        Jiri Slaby <>,
        "Michael S. Tsirkin" <>,
        David Airlie <>,
        Jason Wang <>,
        DRI Development <>,,
        "James E.J. Bottomley" <>,
        netdev <>,
        Paul Mackerras <>,
        Linux-Arch <>,
        Dave Jiang <>,
        Yoshinori Sato <>,
        Helge Deller <>,
        Linux-sh list <>,
        Alexey Brodkin <>,
        Ben Skeggs <>,
        ML nouveau <>,
        Dave Airlie <>,
        Matt Turner <>,
        arcml <>,
        Nick Kossifidis <>,
        Allen Hubbe <>,
        alpha <>,
        Ivan Kokshaysky <>,
        Thomas Gleixner <>,
        Mauro Carvalho Chehab <>,
        Kalle Valo <>,
        Richard Henderson <>,
        Parisc List <>,
        Vineet Gupta <>,
        linux-wireless <>,
        Linux Kernel Mailing List <>,
        Luis Chamberlain <>,
        Daniel Vetter <>, Jon Mason <>,,
        Andrew Morton <>,
        Linux Media Mailing List <>,
        linuxppc-dev <>,
        "David S. Miller" <>
Subject: Re: [RFT 00/13] iomap: Constify ioreadX() iomem argument

On Wed, Jan 8, 2020 at 9:36 AM Christophe Leroy <> wrote:
> Le 08/01/2020 à 09:18, Krzysztof Kozlowski a écrit :
> > On Wed, 8 Jan 2020 at 09:13, Geert Uytterhoeven <> wrote:
> > I'll add to this one also changes to ioreadX_rep() and add another
> > patch for volatile for reads and writes. I guess your review will be
> > appreciated once more because of ioreadX_rep()
> >
> volatile should really only be used where deemed necessary:
> It is said: " ...  accessor functions might use volatile on
> architectures where direct I/O memory access does work. Essentially,
> each accessor call becomes a little critical section on its own and
> ensures that the access happens as expected by the programmer."

The I/O accessors are one of the few places in which 'volatile' generally
makes sense, at least for the implementations that do a plain pointer
dereference (probably none of the ones in question here).

In case of readl/writel, this is what we do in asm-generic:

static inline u32 __raw_readl(const volatile void __iomem *addr)
        return *(const volatile u32 __force *)addr;

The __force-cast that removes the __iomem here also means that
the 'volatile' keyword could be dropped from the argument list,
as it has no real effect any more, but then there are a few drivers
that mark their iomem pointers as either 'volatile void __iomem*' or
(worse) 'volatile void *', so we keep it in the argument list to not
add warnings for those drivers.

It may be time to change these drivers to not use volatile for __iomem
pointers, but that seems out of scope for what Krzysztof is trying
to do. Ideally we would be consistent here though, either using volatile
all the time or never.


Powered by blists - more mailing lists