Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751076AbdGLMoN (ORCPT ); Wed, 12 Jul 2017 08:44:13 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32838 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbdGLMoM (ORCPT ); Wed, 12 Jul 2017 08:44:12 -0400 Date: Wed, 12 Jul 2017 20:44:06 +0800 From: Boqun Feng To: Palmer Dabbelt Cc: Olof Johansson , Arnd Bergmann , akpm@linux-foundation.org, albert@sifive.com, yamada.masahiro@socionext.com, mmarek@suse.com, will.deacon@arm.com, peterz@infradead.org, mingo@redhat.com, daniel.lezcano@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, gregkh@linuxfoundation.org, jslaby@suse.com, davem@davemloft.net, mchehab@kernel.org, sfr@canb.auug.org.au, fweisbec@gmail.com, viro@zeniv.linux.org.uk, mcgrof@kernel.org, dledford@redhat.com, bart.vanassche@sandisk.com, sstabellini@kernel.org, daniel.vetter@ffwll.ch, mpe@ellerman.id.au, msalter@redhat.com, nicolas.dichtel@6wind.com, james.hogan@imgtec.com, paul.gortmaker@windriver.com, linux@roeck-us.net, heiko.carstens@de.ibm.com, schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org, patches@groups.riscv.org Subject: Re: [PATCH 10/17] RISC-V: Atomic and Locking Code Message-ID: <20170712124406.jectd7nj4wfx5ign@tardis> References: <20170712013130.14792-1-palmer@dabbelt.com> <20170712013130.14792-11-palmer@dabbelt.com> <20170712124049.i7taml22aat2bcgt@tardis> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="acrf3uqdnw62mkfl" Content-Disposition: inline In-Reply-To: <20170712124049.i7taml22aat2bcgt@tardis> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1709 Lines: 52 --acrf3uqdnw62mkfl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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() >=20 > 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. >=20 > > + * if you do not require the atomic guarantees. > > + * > > + * Note: there are no guarantees that this function will not be reorde= red > > + * 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 --acrf3uqdnw62mkfl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAllmGZIACgkQSXnow7UH +riXowf8DRCnojaC4UFY+gCqoRunNBGYG8ln/9XtoyRVWKZU96g3YiBR6vSjUf7a QLQ1gU75kZCwRrKpdfV3W0JWKRBTv9uEncCt12q5o3DNw8iWa1kTRJihDDUZSXE7 FrT1wApiOG81dwQEgoGoAgPtEo0FesGdbMzUpDvq6t6a2QPGC6lzEjPCphQY6xq5 5iTJLO4wMCzRjLPeloXtzFAMsACkH+wQxmO4/SOQz+gcnD8O/4r1pdkYxrHybm+f m74uoyFUcXEh/KEYSiVPkRQBMamFzLRWeEh+vknwnOTBygny47nZwevHSyuZxqLY brfrwycW0SeSS2++mNFojzE3ULAJrw== =x+fq -----END PGP SIGNATURE----- --acrf3uqdnw62mkfl--