Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759967AbYAYSJK (ORCPT ); Fri, 25 Jan 2008 13:09:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759110AbYAYSIo (ORCPT ); Fri, 25 Jan 2008 13:08:44 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:39437 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759854AbYAYSIn (ORCPT ); Fri, 25 Jan 2008 13:08:43 -0500 Date: Fri, 25 Jan 2008 19:08:28 +0100 From: Ingo Molnar To: Jeremy Fitzhardinge Cc: Harvey Harrison , Linux Kernel Mailing List , Andi Kleen Subject: Re: [PATCH UPDATE] x86: ignore spurious faults Message-ID: <20080125180828.GB10993@elte.hu> References: <4797D64D.1060105@goop.org> <1201133916.16972.124.camel@brick> <4797DBA0.5020909@goop.org> <20080125153032.GE11846@elte.hu> <479A0632.9090205@goop.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <479A0632.9090205@goop.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian 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: 1463 Lines: 38 * Jeremy Fitzhardinge wrote: > Ingo Molnar wrote: >> thanks, applied. >> >> it would be nice to expose this ability of the architecture to the core >> Linux kernel mprotect code as well, and let it skip on a TLB flush when >> doing a RO->RW transition. > > The usermode fault handler already effectively does this; this patch > just does it for kernel mode as well. I don't know if mprotect takes > advantage of this. spurious faults happen all the time on SMP, in the native kernel. And what i mean is that Linux mprotect currently does not take advantage of x86's ability to just change the ptes, because there's no structured way to tell mm/mprotect.c that "it's safe to skip the TLB flush here". The flush happens in mm/mprotect.c's change_protection() function: flush_tlb_range(vma, start, end); and that is unnecessary when we increase the protection rights, such as in a RO->RW change. (all that is needed is an smp_wmb() instead, to make sure all the pte modifications are visible when the syscall returns.) and it's a really rare case these days that you can find an area where Linux does not make use of a hardware MMU feature - so we should fix this ;-) 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/