From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjG1E-0004Ys-OL for qemu-devel@nongnu.org; Sun, 11 Sep 2016 21:26:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjG1A-0004eN-Fr for qemu-devel@nongnu.org; Sun, 11 Sep 2016 21:26:44 -0400 Date: Mon, 12 Sep 2016 11:19:12 +1000 From: David Gibson Message-ID: <20160912011912.GC12621@voom.fritz.box> References: <1472797976-24210-1-git-send-email-nikunj@linux.vnet.ibm.com> <1472797976-24210-4-git-send-email-nikunj@linux.vnet.ibm.com> <20160907040252.GJ2780@voom.fritz.box> <87d1kgjoy9.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <20160907053459.GM2780@voom.fritz.box> <87d1kgyyg4.fsf@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JWEK1jqKZ6MHAcjA" Content-Disposition: inline In-Reply-To: <87d1kgyyg4.fsf@linaro.org> Subject: Re: [Qemu-devel] [PATCH RFC 3/4] target-ppc: use atomic_cmpxchg for ld/st reservation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: Nikunj A Dadhania , qemu-ppc@nongnu.org, rth@twiddle.net, qemu-devel@nongnu.org, benh@kernel.crashing.org --JWEK1jqKZ6MHAcjA Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 07, 2016 at 08:13:31AM +0100, Alex Benn=E9e wrote: >=20 > David Gibson writes: >=20 > > On Wed, Sep 07, 2016 at 10:17:42AM +0530, Nikunj A Dadhania wrote: > >> David Gibson writes: > >> > >> > [ Unknown signature status ] > >> > On Fri, Sep 02, 2016 at 12:02:55PM +0530, Nikunj A Dadhania wrote: > >> >> Signed-off-by: Nikunj A Dadhania > >> > > >> > This really needs a comment indicating that this implementation isn't > >> > strictly correct (although probably good enough in practice). > >> > >> Sure. And it also does not help if someone uses any store other than > >> store conditional, that isn't taken care. > >> > >> Assumption here is the locking primitives use load with reservation and > >> store conditional. And no other ld/st variant touch this memory. > > > > So, a) I don't think this really relies on that: an ordinary store > > (assuming it changes the value) will still get picked up the cmpxchg. > > Well.. at least after a suitable memory barrier. Matching memory > > models between emulated and host cpus is a whole other kettle of fish. >=20 > Have you seen Pranith's memory barrier patches? I have not. >=20 > > > > I think this does matter, IIRC a kernel spin unlock on ppc is a > > barrier + plain store, no load locked or store conditional. > > > >> > Specifically a racing store which happens to store the same value > >> > which was already in memory should clobber the reservation, but won't > >> > with this implementation. > >> > > >> > I had a long discussion at KVM Forum with Emilio Costa about this, in > >> > which I discovered just how hard it is to strictly implement > >> > store-conditional semantics in terms of anything else. So, this is > >> > probably a reasonable substitute, but we should note the fact that > >> > it's not 100%. > >> > >> I will update the commit log. > >> > >> Regards, > >> Nikunj > >> >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --JWEK1jqKZ6MHAcjA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX1gKQAAoJEGw4ysog2bOSF5gP/2XkUPbkmp3nuI6FJ0gFBisV G87Oo6n/3M80yjuToP9YVSW9oJs5LHF/LiXPoNLQD1io/lp8Zh4ppTNpvzq7SGYm hnoZ4fQint+iVy672ujiKST9C4NqDw5WZb6MVNsqh4MzSx4uK6dgzBufER1Np97/ npT3CddNlf5SmZnJKaK7n9YG/KI9pUhTWFW6RP9Q2S8seo/bd14jWqgi/mzkliKS j3iy5k99RLQgEFnzpAgmImVpuqdqOiUNkOfKm9VWxWT6mms6Zv3jR5x3Mb650NCx 8sKXE5Ux5c4vmlYIfdytSk44lS3s6qWAes8CzhubPzuRL1F19gop3ZjE+S7ikMXx Px88+mYYhz0FecRrT0k6TnUD8ikdGzfdM1Jp2O2AK2Z5L4hafTrKmQ1jjzLQ2w33 Eyh9J7yD0G4mmWQMkiXjAk/Shk/CJwSAkiidPr+Ygeiu7nwCq55O2zw4KJuagB5B GosQm0mznKOvUmSoNouwOZwIgHq27vOEl1G1grPS4gnfrh7P1z3F5Iuf1+m1P2gS L7zWR8ayCvlLg1FaH1IWGh3WMdPXHRp+NJZEnhklKtbbbGxkR/IuBe1hdNuQrK/C TMGRz/py0CgYJQYF9l5Wdb8rzJFhrURhrYoDT1H90NmaPOddfGsG2p7UI2m/dPwT BkEv9RULhGZpKmmbgmkZ =jjAp -----END PGP SIGNATURE----- --JWEK1jqKZ6MHAcjA--