Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753387Ab1EDUt4 (ORCPT ); Wed, 4 May 2011 16:49:56 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:59007 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214Ab1EDUtz (ORCPT ); Wed, 4 May 2011 16:49:55 -0400 Date: Wed, 4 May 2011 22:49:36 +0200 From: Ingo Molnar To: Christoph Lameter Cc: Valdis.Kletnieks@vt.edu, Linus Torvalds , Pekka Enberg , Thomas Gleixner , Tejun Heo , Jens Axboe , Andrew Morton , werner , "H. Peter Anvin" , Linux Kernel Mailing List Subject: Re: [block IO crash] Re: 2.6.39-rc5-git2 boot crashs Message-ID: <20110504204936.GA18594@elte.hu> References: <19422.1304540499@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -2.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.0 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.3.1 -2.0 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1414 Lines: 38 * Christoph Lameter wrote: > > Calling it a cmpxchg when it doesn't have the primary distinguishing > > property of a hardware cmpxchg is just loading a bullet in the chamber and > > inviting kernel hackers to point it at their feet... > > It does have most of the distinguishing characterstics but the > lock-prefixless cmpxchg8b/16b (which is quite fast) [...] 6 cycles for CMPXCHG8B versus 19 cycles for LOCK CMPXCHG8B, on Nehalem. And note that it's not really true that the LOCK prefix-less CMPXCHG8B is not atomic: the write is atomic if the target word is naturally aligned, on i586 and upwards ... So in practice, unless the SLUB variables are misaligned, the lock prefix-less CMPXCHG8B *IS* atomic. Non-atomicity is a special case of a weird special case. > [...] is used in a unique way here in a percpu fastdpath. Thats why we have > the strange naming this_cpu_cmpxchg_double etc. Furthermore, we never used cmpxchg in the kernel without expecting atomicity. Uniquely strange, unintuitive naming == invitation for strange bugs. And guess what, we had a strange bug here. Can you possibly see any connection? Thanks, 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/