lkml.org 
[lkml]   [2011]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH RFC 0/7] x86: convert ticketlocks to C and remove duplicate code
    On 06/22/2011 01:19 PM, H. Peter Anvin wrote:
    > On 06/22/2011 12:21 PM, Jeremy Fitzhardinge wrote:
    >> A friend just pointed out that gcc has a "__sync_fetch_and_add()"
    >> intrinsic, which compiles to xadd when used in this context. What's the
    >> general feeling about using these kinds of gcc features?
    >>
    > In general they are good, IF:
    >
    > a) they cover all versions of gcc we care about (or we have a fallback),

    What is the supported range for these days?

    > and
    > b) they have the right semantics.

    My main concern was making sure that its a strong enough barrier, but
    the documentation is pretty explicit about that.

    > Using gcc intrinsics can generate better code than we can in inline
    > assembly.

    It does seem to do a pretty good job; it generates a plain locked add if
    you never look at the returned value, for example.

    > However, (b) is a killer since gcc doesn't have a way to generate our
    > lock prefix annotations, and so it isn't really useful here.

    Yeah, I thought about that. Its a bit unfortunate we're getting into
    spinlock code at all on a UP system, but we don't have a mechanism to
    stomp locking at a higher level. (Ignoring all the insane stuff that
    happens when the system becomes UP transiently just because all the
    other CPUs have been unplugged for suspend, etc; we just shouldn't
    bother in that case.)

    J


    \
     
     \ /
      Last update: 2011-06-22 23:01    [W:0.043 / U:1.204 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site