Return-Path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:54947 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510Ab1AFSB0 (ORCPT ); Thu, 6 Jan 2011 13:01:26 -0500 In-Reply-To: <1294336054.2905.1.camel@heimdal.trondhjem.org> References: <1294254337.16957.13.camel@mulgrave.site> <1294256169.16957.18.camel@mulgrave.site> <20110105200008.GJ8638@n2100.arm.linux.org.uk> <1294259637.16957.25.camel@mulgrave.site> <20110105210448.GM8638@n2100.arm.linux.org.uk> <1294262208.2952.4.camel@heimdal.trondhjem.org> <1294268808.2952.18.camel@heimdal.trondhjem.org> <1294270104.16957.73.camel@mulgrave.site> <1294335614.22825.154.camel@mulgrave.site> <1294336054.2905.1.camel@heimdal.trondhjem.org> From: Linus Torvalds Date: Thu, 6 Jan 2011 09:55:30 -0800 Message-ID: Subject: Re: still nfs problems [Was: Linux 2.6.37-rc8] To: Trond Myklebust Cc: James Bottomley , Russell King - ARM Linux , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Marc Kleine-Budde , =?ISO-8859-1?Q?Uwe_Kleine=2DK=F6nig?= , Marc Kleine-Budde , linux-arm-kernel@lists.infradead.org, Parisc List , linux-arch@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-nfs-owner@vger.kernel.org List-ID: MIME-Version: 1.0 On Thu, Jan 6, 2011 at 9:47 AM, Trond Myklebust wrote: > > Why is this line needed? We're not writing through the virtual mapping. I haven't looked at the sequence of accesses, but you need to be _very_ aware that "write-through" is absolutely NOT sufficient for cache coherency. In cache coherency, you have three options: - true coherency (eg physically indexed/tagged caches) - exclusion (eg virtual caches, but with an exclusion guarantee that guarantees that aliases cannot happen: either by using physical tagging or by not allowing cases that could cause virtual aliases) - write-through AND non-cached reads (ie "no caching at all"). You seem to be forgetting the "no cached reads" part. It's not sufficient to flush after a write - you need to make sure that you also don't have a cached copy of the alias for the read. So "We're not writing through the virtual mapping" is NOT a sufficient excuse. If you're reading through the virtual mapping, you need to make sure that the virtual mapping is flushed _after_ any writes through any other mapping and _before_ any reads through the virtual one. This is why you really really really generally don't want to have aliasing. Purely virtual caches are pure crap. Really. Linus