From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 25 May 2004 08:35:01 -0700 From: Keith M Wesolowski Subject: Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE Message-ID: <20040525153501.GA19465@foobazco.org> References: <1085369393.15315.28.camel@gaston> <1085371988.15281.38.camel@gaston> <1085373839.14969.42.camel@gaston> <20040525034326.GT29378@dualathlon.random> <20040525114437.GC29154@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org Return-Path: To: Linus Torvalds Cc: Matthew Wilcox , Andrea Arcangeli , Benjamin Herrenschmidt , Andrew Morton , Linux Kernel list , Ingo Molnar , Ben LaHaise , linux-mm@kvack.org, Architectures Group List-ID: On Tue, May 25, 2004 at 07:48:24AM -0700, Linus Torvalds wrote: > > > the equivalent. You can always do it with a simple compare-and-exchange > > > loop, something any SMP-capable architecture should have. > > The race is: > - one CPU sets the dirty bit (possibly with a hardware walker, but I > guess on PA it's probably done in sw) > - the other CPU sets the accessed bit in sw as part of the > "handle_pte_fault()" processing. > > Right now we set the accessed bit with a simple "ptep_establish()", which > will use "set_pte()", which is just a regular write. So setting the > accessed bit will basically be a nonatomic sequence of > > - read pte entry > - entry = pte_mkyoung(entry) > - set_pte(entry) > > which is all done under the mm->page_table_lock, but which does NOT > protect against any hardware page-table walkers or any asynchronous sw > walkers (if anybody does them). Some sparc32 CPUs are also vulnerable to this race; in fact the supersparc manual describes it specifically and even outlines the compare-exchange loop using our rotten swap instruction. In our case, the race is with a hardware walker. -- Keith M Wesolowski -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: aart@kvack.org