Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2015 13:14:05 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Dimitry Andric <dim@FreeBSD.org>
Cc:        Warner Losh <imp@bsdimp.com>, src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   Re: svn commit: r288121 - projects/clang370-import/contrib/libc++/src/support
Message-ID:  <1442949245.1224.229.camel@freebsd.org>
In-Reply-To: <9B0C3FE9-821B-470E-8AFC-F5B3DCE5B8F4@FreeBSD.org>
References:  <201509221734.t8MHYp0W052286@repo.freebsd.org> <00F42FF7-84D4-4C97-974F-C28DB36D4392@bsdimp.com> <9B0C3FE9-821B-470E-8AFC-F5B3DCE5B8F4@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2015-09-22 at 20:48 +0200, Dimitry Andric wrote:
> On 22 Sep 2015, at 20:37, Warner Losh <imp@bsdimp.com> wrote:
> > 
> >> On Sep 22, 2015, at 11:34 AM, Dimitry Andric <dim@freebsd.org> 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.
> > 
> > I don¢t think you can do that.
> > 
> > arm < v6 is special. The CPUs don¢t have atomic operations. In the kernel,
> > we disable interrupts and do the op. You can¢t 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¢ll have some work to do this properly.
> > 
> > I¢m not entirely sure that your ¡fix¢ makes things actually safe, even if it
> > seems to make them work today. I¢ll have to study it more closely.
> 
> Probably not 100% safe, since the stub functions are just placeholders
> which aren't atomic at all. 

This is confusing.  The fact that these are stubs and aren't atomic at
all is the problem.  There's no reason not to have real implementations
on arm < v6, machine/atomic.h has all the common stuff implemented
already.

-- Ian

>  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.)
> 
> 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?)
> 
> -Dimitry
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1442949245.1224.229.camel>