From owner-svn-src-projects@freebsd.org Tue Sep 22 19:25:26 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5D1EA07DEA for ; Tue, 22 Sep 2015 19:25:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9ACAD1CB3 for ; Tue, 22 Sep 2015 19:25:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by pablk4 with SMTP id lk4so1693941pab.3 for ; Tue, 22 Sep 2015 12:25:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=2mGb/jFRxGU2cIf78/LLV8gyMPPzJC/JVKod9WyW6IY=; b=DW6CWHcMJAbRGFduc8137RTQdCQUKU5GJgBNPQUn3ugNV+b/sZaRlGZdi3zPEwZYsm HHqLhxPTTqprEo+BL62GLsemhd7ADm5HtTpO43aApuDPKOLsB7AMVb5n4CkYC9wBcbXd CGluLEq+HuFLni5xpZYodNDiNhX6y/1aG1OIDVH9RH6+UGQOJU/fC8jnyjpDr2Hp+Ezz 3rLsWWTdicE7ihrYZCHFceBVeP5u5GkYIL4pAy652sDNAZnNI87Etxxk96DrDKRcOg0p xkCfxlud92OE2804L0FBYozoSGgZip9tMxBOeTmGy85hwIueHdOlF6JoZTBfQTQewFja oWsw== X-Gm-Message-State: ALoCoQmgWgk8i7QP7xgjb4F2yLklyx7Cw4mKuiu+aKcIrPoNTQNkqBpMW91j52qWNCVs5EpZqOKR X-Received: by 10.68.250.98 with SMTP id zb2mr32924649pbc.40.1442949926037; Tue, 22 Sep 2015 12:25:26 -0700 (PDT) Received: from [172.22.24.192] ([40.140.178.190]) by smtp.gmail.com with ESMTPSA id xm9sm3759573pbc.32.2015.09.22.12.25.25 (version=TLS1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Sep 2015 12:25:25 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r288121 - projects/clang370-import/contrib/libc++/src/support Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2AB4924A-A928-45E0-ABD9-0829ACAFAA69"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <9B0C3FE9-821B-470E-8AFC-F5B3DCE5B8F4@FreeBSD.org> Date: Tue, 22 Sep 2015 13:25:22 -0600 Cc: src-committers@freebsd.org, svn-src-projects@freebsd.org Message-Id: References: <201509221734.t8MHYp0W052286@repo.freebsd.org> <00F42FF7-84D4-4C97-974F-C28DB36D4392@bsdimp.com> <9B0C3FE9-821B-470E-8AFC-F5B3DCE5B8F4@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2015 19:25:26 -0000 --Apple-Mail=_2AB4924A-A928-45E0-ABD9-0829ACAFAA69 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 22, 2015, at 12:48 PM, Dimitry Andric wrote: >=20 > On 22 Sep 2015, at 20:37, Warner Losh wrote: >>=20 >>> On Sep 22, 2015, at 11:34 AM, Dimitry Andric = wrote: >>> NOTE: this needs to be fixed properly later on, by supplying library >>> functions implementing atomic operations for arm < v6. We should >>> probably take those from sys/arm/arm/stdatomic.c, and stuff them = into >>> either libgcc or compiler-rt. >>=20 >> I don=E2=80=99t think you can do that. >>=20 >> arm < v6 is special. The CPUs don=E2=80=99t have atomic operations. = In the kernel, >> we disable interrupts and do the op. You can=E2=80=99t do that in = user land. Instead, >> you have to use RAS (Restartable Atomic Sequences) and have the = kernel >> grok the RAS. Thankfully, the RAS support in the kernel is just the R = in that. >> But it does mean that we=E2=80=99ll have some work to do this = properly. >>=20 >> I=E2=80=99m not entirely sure that your =E2=80=98fix=E2=80=99 makes = things actually safe, even if it >> seems to make them work today. I=E2=80=99ll have to study it more = closely. >=20 > Probably not 100% safe, since the stub functions are just placeholders > which aren't atomic at all. Then again, if we insist on this being > correct, we will have no choice as to disable the atomic support in > libc++ somehow. (I'm not sure if this is supported by upstream at = all.) >=20 > As far as I understood on IRC, the functions in stdatomic.c should = work > in userland, unless you are using real SMP? (And does that even exist > for such old ARM architectures?) I think you misunderstand. We can switch threads at any point on armv4 = based on an interrupt coming in. For load and store, this won=E2=80=99t = matter. But for everything else, it won=E2=80=99t work. You don=E2=80=99t need SMP to trigger a = race in user land atomics. We already have most of the bits in arm/include/atomic.h, but they are = for FreeBSD atomic interface not the others. I haven=E2=80=99t pulled the = 3.7 tree to see what=E2=80=99s up there since these files don=E2=80=99t seem to = be present in head. Warner --Apple-Mail=_2AB4924A-A928-45E0-ABD9-0829ACAFAA69 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJWAasjAAoJEGwc0Sh9sBEA01IQAO1J0n8xWI33uD4xKkRIKtq1 lsYuIuDEHiQoT7vIi8LXluLa3YhzA5woOBADVOPkVHFvhXEeURfU2t0Jo8lYD0Ny PsEM4BLHVvDWpFzAwuUfdatncSxauhID61Agj68GFCrsrIUQ0v23PKMQ0zIw9Rc1 dQ3+1qMgTosnfFl4dZlxGPte8toq/Z1UtYZFQKtHZ0xteVpMiYusTUsxJpAW3FFX Ckeyc2tvqHuKZfKGJcA/8+LRdULpoFJLHSbLDPp2Kn5p/LTqPZNWbWnGnLAaxIdc Tta7iqjGx3faqk7X0ZhSY1bqai9dO+ixQWavzHThDmrzOaGy7YGbwEFGANMOOrw6 u2k9I2ijQmRPFO2rHogjwHtOpn4vgBSH4aLtYoguW0ZF3au2SOyfkVydMTMfOloD Y+5T473vFgHnuAzpjgw1YrUh5kiMdHPdou4SqEVW3dd8beqREph3ZUJmDtpBdiY4 DpjTiFsRQLeM9/neCCONWguz4HLQuHZlcVa/gNsc4Ig0Erie4zIIeyMmweWu8KL3 wqaFXiR2CyvY7cSnz72LoEpQfIu3assudZpqWuOyeu0dEH/oyDNOYqnJgvn6wGfb SK8zfmDDe2rTW+TVEsH44Dxy501Le57K+FXX7Lwyb3EOAgQcLuFeevRWbUG/ynmc j2wL0xMNN2H3V3a1dCVL =9LFN -----END PGP SIGNATURE----- --Apple-Mail=_2AB4924A-A928-45E0-ABD9-0829ACAFAA69--