Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933565AbXHLKgS (ORCPT ); Sun, 12 Aug 2007 06:36:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933199AbXHLKf7 (ORCPT ); Sun, 12 Aug 2007 06:35:59 -0400 Received: from gate.crashing.org ([63.228.1.57]:56490 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932751AbXHLKf5 (ORCPT ); Sun, 12 Aug 2007 06:35:57 -0400 In-Reply-To: <1186912053.3852.9.camel@localhost> References: <20070808230733.GA17270@shell.boston.redhat.com> <46BAC2BE.1090106@redhat.com> <46BB508B.7050601@redhat.com> <1186683646.9669.20.camel@localhost> <1186912053.3852.9.camel@localhost> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <914eee40a2967ca153c28da4705722c4@kernel.crashing.org> Content-Transfer-Encoding: 7bit Cc: wjiang@resilience.com, Linus Torvalds , wensong@linux-vs.org, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, ak@suse.de, cfriesen@nortel.com, netdev@vger.kernel.org, horms@verge.net.au, akpm@linux-foundation.org, Chuck Ebbert , davem@davemloft.net, zlynx@acm.org, Chris Snook From: Segher Boessenkool Subject: Re: [PATCH] make atomic_t volatile on all architectures Date: Sun, 12 Aug 2007 12:35:27 +0200 To: schwidefsky@de.ibm.com X-Mailer: Apple Mail (2.623) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2052 Lines: 55 >>> Yes, though I would use "=m" on the output list and "m" on the input >>> list. The reason is that I've seen gcc fall on its face with an ICE >>> on >>> s390 due to "+m". The explanation I've got from our compiler people >>> was >>> quite esoteric, as far as I remember gcc splits "+m" to an input >>> operand >>> and an output operand. Now it can happen that the compiler chooses >>> two >>> different registers to access the same memory location. "+m" requires >>> that the two memory references are identical which causes the ICE if >>> they are not. >> >> The problem is very nicely described here, last paragraph: >> >> >> It's not a problem anymore in (very) recent GCC, although >> that of course won't help you in the kernel (yet). > > So you are saying that gcc 3.x still has this problem ? Yes. A warning ("read-write constraint does not allow a register") was added for GCC-3.4, but the fix/workaround is more recent (4.2 I believe, perhaps it was backported to the 4.1 branch). >>> I do not know if the current compilers still do this. Has >>> anyone else seen this happen ? >> >> In recent GCC, it's actually documented: >> >> The ordinary output operands must be write-only; GCC will assume >> that >> the values in these operands before the instruction are dead and need >> not be generated. Extended asm supports input-output or read-write >> operands. Use the constraint character `+' to indicate such an >> operand >> and list it with the output operands. You should only use read-write >> operands when the constraints for the operand (or the operand in >> which >> only some of the bits are to be changed) allow a register. >> >> Note that last line. > > I see, thanks for the info. My pleasure. Segher - 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/