Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964801AbVLUUBn (ORCPT ); Wed, 21 Dec 2005 15:01:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964803AbVLUUBn (ORCPT ); Wed, 21 Dec 2005 15:01:43 -0500 Received: from mx3.mail.elte.hu ([157.181.1.138]:39640 "EHLO mx3.mail.elte.hu") by vger.kernel.org with ESMTP id S964801AbVLUUBm (ORCPT ); Wed, 21 Dec 2005 15:01:42 -0500 Date: Wed, 21 Dec 2005 21:01:01 +0100 From: Ingo Molnar To: Linus Torvalds Cc: lkml , Andrew Morton , Arjan van de Ven , Jes Sorensen , Zwane Mwaikambo , Oleg Nesterov , David Howells , Alan Cox , Benjamin LaHaise , Steven Rostedt , Christoph Hellwig , Andi Kleen , Russell King , Nicolas Pitre Subject: Re: [patch 3/8] mutex subsystem, add atomic_*_call_if_*() to i386 Message-ID: <20051221200101.GA18565@elte.hu> References: <20051221155442.GD7243@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-ELTE-SpamScore: 0.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=0.0 required=5.9 tests=AWL autolearn=no SpamAssassin version=3.0.3 0.0 AWL AWL: From: address is in the auto white-list X-ELTE-VirusStatus: clean Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1541 Lines: 37 * Linus Torvalds wrote: > > Umm. This asm is broken. It doesn't mark %eax as changed, so this is only > > reliable if the function you call is > > > > - a "fastcall" one > > - always returns as its return value the pointer to the atomic count > > > > which is not true (you verify that it's a fastcall, but it's of type > > "void"). > > Actually (and re-reading the email I sent that wasn't obvious at all), > my _preferred_ fix is to literally force the use of the above kind of > function: not save/restore %eax at all, but just say that any function > that is called by the magic "atomic_*_call_if()" needs to always > return the argument it gets as its return value too. > > That allows the caller to not even have to care. And the callee > obviously already _has_ that value, so it might as well return it (and > in the best case it's not going to add any cost at all, either to the > caller or the callee). > > So you might opt to keep the asm the same, just change the calling > conventions. ok, i've added this fix, thanks. Right now we dont do anything after those functions (that's probably how the bug never showed up), but at least one interim stage i tried to use the call_if functions at other places too, so the potential is there. Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/