Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032408AbWLGQv6 (ORCPT ); Thu, 7 Dec 2006 11:51:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1032410AbWLGQv6 (ORCPT ); Thu, 7 Dec 2006 11:51:58 -0500 Received: from ftp.linux-mips.org ([194.74.144.162]:33061 "EHLO ftp.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032408AbWLGQv4 (ORCPT ); Thu, 7 Dec 2006 11:51:56 -0500 Date: Thu, 7 Dec 2006 16:51:42 +0000 From: Ralf Baechle To: Nick Piggin Cc: Russell King , Christoph Lameter , David Howells , torvalds@osdl.org, akpm@osdl.org, linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an arch doesn't support it Message-ID: <20061207165142.GA9006@linux-mips.org> References: <20061206164314.19870.33519.stgit@warthog.cambridge.redhat.com> <20061206190025.GC9959@flint.arm.linux.org.uk> <20061206195820.GA15281@flint.arm.linux.org.uk> <4577DF5C.5070701@yahoo.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4577DF5C.5070701@yahoo.com.au> User-Agent: Mutt/1.4.2.2i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1007 Lines: 22 On Thu, Dec 07, 2006 at 08:31:08PM +1100, Nick Piggin wrote: > Wrong. Your ll/sc implementation with cmpxchg is buggy. The cmpxchg > load_locked is not locked at all, and there can be interleaving writes > between the load and cmpxchg which do not cause the store_conditional > to fail. > > It might be reasonable to implement this watered down version, but: > don't some architectures have restrictions on what instructions can > be issued between the ll and the sc? On MIPS the restriction is no loads or stores or sync instructions between ll/sc. Also there may be at most 2048 bytes between the address of the ll and sc instructions. Which means ll/sc sequences should better be written in assembler or gcc might do a bit too creative things ... Ralf - 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/