• Jan Beulich's avatar
    x86: Adjust asm constraints in atomic64 wrappers · 819165fb
    Jan Beulich authored
    Eric pointed out overly restrictive constraints in atomic64_set(), but
    there are issues throughout the file. In the cited case, %ebx and %ecx
    are inputs only (don't get changed by either of the two low level
    implementations). This was also the case elsewhere.
    
    Further in many cases early-clobber indicators were missing.
    
    Finally, the previous implementation rolled a custom alternative
    instruction macro from scratch, rather than using alternative_call()
    (which was introduced with the commit that the description of the
    change in question actually refers to). Adjusting has the benefit of
    not hiding referenced symbols from the compiler, which however requires
    them to be declared not just in the exporting source file (which, as a
    desirable side effect, in turn allows that exporting file to become a
    real 5-line stub).
    
    This patch does not eliminate the overly restrictive memory clobbers,
    however: Doing so would occasionally make the compiler set up a second
    register for accessing the memory object (to satisfy the added "m"
    constraint), and it's not clear which of the two non-optimal
    alternatives is better.
    
    v2: Re-do the declaration and exporting of the internal symbols.
    Reported-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
    Link: http://lkml.kernel.org/r/4F19A2A5020000780006E0D9@nat28.tlf.novell.com
    Cc: Luca Barbieri <luca@luca-barbieri.com>
    Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    819165fb
atomic64_32.c 91 Bytes