From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE From: Benjamin Herrenschmidt In-Reply-To: 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> <20040525153501.GA19465@foobazco.org> <20040525102547.35207879.davem@redhat.com> <20040525105442.2ebdc355.davem@redhat.com> Content-Type: text/plain Message-Id: <1085521251.24948.127.camel@gaston> Mime-Version: 1.0 Date: Wed, 26 May 2004 07:40:53 +1000 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Linus Torvalds Cc: "David S. Miller" , wesolows@foobazco.org, willy@debian.org, Andrea Arcangeli , Andrew Morton , Linux Kernel list , mingo@elte.hu, bcrl@kvack.org, linux-mm@kvack.org, Linux Arch list List-ID: > Oh - btw - my suggested patch was totally broken for ppc64, because that > "ptep_update_dirty_accessed()" thing obviously also needs to that damn > hpte_update() crud etc. > > BenH - I'm leaving that ppc64 code to somebody knows what the hell he is > doing. Ie you or Anton or something. Ok? I can act as a collector the > different architecture things for that "ptep_update_dirty_accessed()" > function. Well, just setting one of those 2 bits doesn't require a hash table invalidate as long as nothing else changes. We do dirty by mapping r/o in the hash table, and accessed on hash faults (our clear_young triggers a flush). So just setting those bits in the linux PTE without touching the hash table is fine, we'll just possibly take an extra fault on the next write or access, but that might not be much slower than going to the hash update the permissions directly The original problem I have with set_pte is that our current implementation of set_pte will overwrite the entire PTE, possibly losing the bits that indicate that there is a copy in the hash and its index in the hash bucket. So if set_pte is called on a PTE that is present, we must flush it properly first as we will lose track of the hash one when overriding. hpte_update() will simply add the old PTE to a batch which is then flushed by either the mmu gather batch end, or by a call to flush_tlb_* Ben. -- 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