From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3254 invoked by alias); 2 Aug 2013 17:56:03 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 3177 invoked by uid 48); 2 Aug 2013 17:56:00 -0000 From: "dtemirbulatov at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug nptl/15640] The ARM port of lll_unlock uses atomic compare and swap to release a lock Date: Fri, 02 Aug 2013 17:56:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dtemirbulatov at gmail dot com X-Bugzilla-Status: REOPENED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00004.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15640 --- Comment #7 from Dinar Temirbulatov --- (In reply to Abhishek Deb from comment #6) > Since the preprocessor macro atomic_exchange_rel was not explicity defined, > it gets defined to atomic_compare_and_exhange_*, which is defined using > gcc's atomic built-in __sync_val_compare_and_swap. > > But I think atomic exchange is not the same as atomic compare and exchange. > An atomic exchange should be defined as ldex, stex, bne, whereas atomic > compare and exchange is defined as ldex, cmp, bne, stex, bne. > > Doesn't look like gcc's atomic builtin in provides an explicit function to > do that http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Atomic-Builtins.html. > > However, gcc's atomic built in provides __sync_fetch_and_* . Can it be used > to build an atomic exchange. yes, All correct, except I think that it needs cmp after stex. -- You are receiving this mail because: You are on the CC list for the bug.