[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170712124406.jectd7nj4wfx5ign@tardis>
Date: Wed, 12 Jul 2017 20:44:06 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Palmer Dabbelt <palmer@...belt.com>
Cc: Olof Johansson <olof@...om.net>, Arnd Bergmann <arnd@...db.de>,
akpm@...ux-foundation.org, albert@...ive.com,
yamada.masahiro@...ionext.com, mmarek@...e.com,
will.deacon@....com, peterz@...radead.org, mingo@...hat.com,
daniel.lezcano@...aro.org, tglx@...utronix.de,
jason@...edaemon.net, marc.zyngier@....com,
gregkh@...uxfoundation.org, jslaby@...e.com, davem@...emloft.net,
mchehab@...nel.org, sfr@...b.auug.org.au, fweisbec@...il.com,
viro@...iv.linux.org.uk, mcgrof@...nel.org, dledford@...hat.com,
bart.vanassche@...disk.com, sstabellini@...nel.org,
daniel.vetter@...ll.ch, mpe@...erman.id.au, msalter@...hat.com,
nicolas.dichtel@...nd.com, james.hogan@...tec.com,
paul.gortmaker@...driver.com, linux@...ck-us.net,
heiko.carstens@...ibm.com, schwidefsky@...ibm.com,
linux-kernel@...r.kernel.org, patches@...ups.riscv.org
Subject: Re: [PATCH 10/17] RISC-V: Atomic and Locking Code
On Wed, Jul 12, 2017 at 08:40:49PM +0800, Boqun Feng wrote:
[...]
> > +/**
> > + * set_bit - Atomically set a bit in memory
> > + * @nr: the bit to set
> > + * @addr: the address to start counting from
> > + *
> > + * This function is atomic and may not be reordered. See __set_bit()
>
> This is incorrect, {set,change,clear}_bit() can be reordered, see
> Documentation/memory-barriers.txt, they are just relaxed atomics. But I
> think you just copy this from x86 code, so maybe x86 code needs help
> too, at least claim that's only x86-specific guarantee.
>
> > + * if you do not require the atomic guarantees.
> > + *
> > + * Note: there are no guarantees that this function will not be reordered
> > + * on non x86 architectures, so if you are writing portable code,
> > + * make sure not to rely on its reordering guarantees.
> > + *
Hmmm.. the claim is right here ;-/
As your implementation is relax semantics, you'd better rewrite the
comment ;-)
Regards,
Boqun
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists