From owner-freebsd-arch@FreeBSD.ORG Wed Jul 31 20:03:16 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by hub.freebsd.org (Postfix) with ESMTP id C639BD19; Wed, 31 Jul 2013 20:03:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <51F96D2C.6030109@FreeBSD.org> Date: Wed, 31 Jul 2013 16:01:48 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130715 Thunderbird/17.0.7 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: [PATCH] Atomic swap and test-and-set References: <51F81A74.4030009@FreeBSD.org> <20130731173247.GK4972@kib.kiev.ua> In-Reply-To: <20130731173247.GK4972@kib.kiev.ua> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: dumbbell@FreeBSD.org, freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2013 20:03:16 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-07-31 13:32:47 -0400, Konstantin Belousov wrote: > On Tue, Jul 30, 2013 at 03:56:36PM -0400, Jung-uk Kim wrote: >> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> >> The attached patch implements atomic_swap_() and >> atomic_testandset_() for x86. is int or long ATM. >> >> The semantics of each operation (in atomic(9) style): >> >> atomic_swap(p, v) r = *p; *p = v; return (r); >> >> atomic_testandset(p, s) v = ()1 << s % (sizeof() * >> NBBY); r = (*p & v) != 0; *p |= v; return (r); >> >> Note atomic_readandclear_() is now obsolete and implemented >> as a macro around atomic_swap_() where the new value v is >> 0. >> >> Please let me know if you have any objection. > I think that the atomic.diff is fine. > > You did not documented swap and testandset, which would be good to > have in the manpage. Sure. > I think that constraints for all added inlines contradict the > explicit requirement in the gcc documentation, which states that > rmw operands should be specified using the 'same location' output > operand for the input operand (hopefully this can be parsed). It > just happens so that for "m" compiler cannot do anything else then > passing the address. > > The problem is not specific to the new functions, it seems to be > present in other functions as well, e.g. cmpset. This probably can > be postponed. What a coincidence! I was cleaning up the constraints before I read your e-mail. Also, I am implementing 64-bit versions for i386 and moving atomic_cmpset_64 from pmap.h to atomic.h. I'll post new patches when I am done. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJR+W0sAAoJECXpabHZMqHOaVsH/1CzPZiPfpWXQefh08wOPSMV bF/M0UrevFKE72QnRTiB00D6aY9vfNRmpYf3oceyMoZl3iYytRfqmNCawCUwMt+E suUrIsLNF+Kzjq5EcuZRDztAaphRUbr3CcFQFiE82nD6HE1gcsYmdj8i5e93OPgS B9MH7mgJGbct5q5eyM6BdJJSMltbKg2JPEWTlcMIly1P5FrHablQd53iqhHIIkwx JHWJNxcMJsv+EEd8cCHepNSODEI7XoCuiOpkm4Y7k4Ezy/82pWUVG7/WcBvzSNt1 Yxq66TxloJzPzT67bOSvqohTx+9mWX+blPBRJGhZzOloo9KG7sF9IdGoUkwcoqg= =C2G6 -----END PGP SIGNATURE-----