Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764668AbXJZUjV (ORCPT ); Fri, 26 Oct 2007 16:39:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753819AbXJZUjK (ORCPT ); Fri, 26 Oct 2007 16:39:10 -0400 Received: from mx1.suse.de ([195.135.220.2]:52801 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755608AbXJZUjJ (ORCPT ); Fri, 26 Oct 2007 16:39:09 -0400 To: Alan Cox Cc: "Bart Van Assche" , "Linus Torvalds" , "Linux Kernel Mailing List" , "Andrew Haley" Subject: Re: Is gcc thread-unsafe? From: Andi Kleen References: <20071026190856.18510fc4@the-village.bc.nu> Date: Fri, 26 Oct 2007 22:39:07 +0200 In-Reply-To: <20071026190856.18510fc4@the-village.bc.nu> (Alan Cox's message of "Fri\, 26 Oct 2007 19\:08\:56 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 971 Lines: 22 Alan Cox writes: > > You can stop the compiler but not the CPU - and some processors will > certainly speculatively load across conditionals, reorder writes etc The difference is that the CPU knows how to cancel most[1] side effects of these speculative accesses (e.g. by not issuing exceptions[2] etc.). The compiler doesn't normally (except on some architectures with special support like IA64; but I'm not sure gcc supports it there) [1] In some it can't and we've had problems with that in the past. e.g. in a few cases speculative reads can be a problem. But we generally fix or workaround those cases in the code. [2] Modulo hardware bugs -- see the hall of shame in x86_64 fault.c -Andi - 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/