linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	"James Bottomley" <James.Bottomley@hansenpartnership.com>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Marc Kleine-Budde" <m.kleine-budde@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	"Parisc List" <linux-parisc@vger.kernel.org>,
	linux-arch@vger.kernel.org
Subject: Re: still nfs problems [Was: Linux 2.6.37-rc8]
Date: Wed, 05 Jan 2011 18:06:48 -0500	[thread overview]
Message-ID: <1294268808.2952.18.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <AANLkTi=3Gu-rz=-OdNtUXn4qw60Df6=YePnzvB=s-+Ov@mail.gmail.com>

On Wed, 2011-01-05 at 13:30 -0800, Linus Torvalds wrote: 
> On Wed, Jan 5, 2011 at 1:16 PM, Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
> >
> > So what should be the preferred way to ensure data gets flushed when
> > you've written directly to a page, and then want to read through the
> > vm_map_ram() virtual range? Should we be adding new semantics to
> > flush_kernel_dcache_page()?
> 
> The "preferred way" is actually simple: "don't do that". IOW, if some
> page is accessed through a virtual mapping you've set up, then
> _always_ access it through that virtual mapping.
> 
> Now, when that is impossible (and yes, it sometimes is), then you
> should flush after doing all writes. And if you do the write through
> the regular kernel mapping, you should use flush_dcache_page(). And if
> you did it through the virtual mapping, you should use
> "flush_kernel_vmap_range()" or whatever.
> 
> NOTE! I really didn't look those up very closely, and if the accesses
> can happen concurrently you are basically screwed, so you do need to
> do locking or something else to guarantee that there is some nice
> sequential order.  And maybe I forgot something.  Which is why I do
> suggest "don't do that" as a primary approach to the problem if at all
> possible.
> 
> Oh, and you may need to flush before reading too (and many writes do
> end up being "read-modify-write" cycles) in case it's possible that
> you have stale data from a previous read that was then invalidated by
> a write to the aliasing address. Even if that write was flushed out,
> the stale read data may exist at the virtual address. I forget what
> all we required - in the end the only sane model is "virtual caches
> suck so bad that anybody who does them should be laughed at for being
> a retard".

Yes. The fix I sent out was a call to invalidate_kernel_vmap_range(),
which takes care of invalidating the cache prior to a virtual address
read.

My question was specifically about the write through the regular kernel
mapping: according to Russell and my reading of the cachetlb.txt
documentation, flush_dcache_page() is only guaranteed to have an effect
on page cache pages.
flush_kernel_dcache_page() (not to be confused with flush_dcache_page)
would appear to be the closest fit according to my reading of the
documentation, however the ARM implementation appears to be a no-op...

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


  reply	other threads:[~2011-01-05 23:07 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 19:05 still nfs problems [Was: Linux 2.6.37-rc8] James Bottomley
2011-01-05 19:18 ` Linus Torvalds
2011-01-05 19:36   ` James Bottomley
2011-01-05 19:49     ` Linus Torvalds
2011-01-05 20:35       ` James Bottomley
2011-01-05 20:00     ` Russell King - ARM Linux
2011-01-05 20:33       ` James Bottomley
2011-01-05 20:48         ` Linus Torvalds
2011-01-05 21:04           ` Russell King - ARM Linux
2011-01-05 21:08             ` Linus Torvalds
2011-01-05 21:16               ` Trond Myklebust
2011-01-05 21:30                 ` Linus Torvalds
2011-01-05 23:06                   ` Trond Myklebust [this message]
2011-01-05 23:28                     ` James Bottomley
2011-01-06 17:40                       ` James Bottomley
2011-01-06 17:47                         ` Trond Myklebust
2011-01-06 17:51                           ` James Bottomley
2011-01-06 17:55                           ` Linus Torvalds
2011-01-07 18:53                             ` Trond Myklebust
2011-01-07 19:02                               ` Russell King - ARM Linux
2011-01-07 19:11                                 ` James Bottomley
2011-01-08 16:49                                   ` Trond Myklebust
2011-01-08 23:15                                     ` Trond Myklebust
2011-01-10 10:50                                       ` Uwe Kleine-König
2011-01-10 16:25                                         ` Trond Myklebust
2011-01-10 17:08                                           ` Marc Kleine-Budde
2011-01-10 17:20                                             ` Trond Myklebust
     [not found]                                               ` <1294680035.3349.19.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2011-01-10 17:26                                                 ` Marc Kleine-Budde
2011-01-10 19:25                                               ` Uwe Kleine-König
2011-01-10 19:29                                                 ` Trond Myklebust
2011-01-10 19:31                                                   ` James Bottomley
2011-01-10 19:34                                                   ` Linus Torvalds
2011-01-10 20:15                                                     ` Trond Myklebust
2011-01-10 12:44                                       ` Marc Kleine-Budde
2011-01-07 19:13                                 ` Trond Myklebust
2011-01-07 19:05                               ` James Bottomley
2011-01-06 18:05                         ` Russell King - ARM Linux
2011-01-06 18:14                           ` James Bottomley
2011-01-06 18:25                             ` James Bottomley
2011-01-06 21:07                               ` James Bottomley
2011-01-06 20:19                         ` John Stoffel
2011-01-05 23:28                     ` Linus Torvalds
2011-01-05 23:59                       ` Russell King - ARM Linux
2011-01-05 21:16           ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2010-12-31  3:17 George Spelvin
2010-12-31  4:32 ` Trond Myklebust
2011-01-01  1:03   ` George Spelvin
2011-01-01  1:18     ` Trond Myklebust
2011-01-01  5:44       ` George Spelvin
     [not found] <AANLkTi=-dNeeDjcSoznKtwcaNyw1mMXSqepFY89R2i+2@mail.gmail.com>
     [not found] ` <20101230171453.GA5787@pengutronix.de>
2010-12-30 17:59   ` Trond Myklebust
2010-12-30 19:18     ` Uwe Kleine-König
2011-01-03 21:38       ` Uwe Kleine-König
2011-01-04  0:22         ` Trond Myklebust
2011-01-05  8:40           ` Uwe Kleine-König
2011-01-05 11:05             ` Uwe Kleine-König
2011-01-05 11:27               ` Russell King - ARM Linux
2011-01-05 12:14                 ` Marc Kleine-Budde
2011-01-05 13:02                   ` Nori, Sekhar
2011-01-05 15:34                     ` Russell King - ARM Linux
2011-01-05 13:40                 ` Uwe Kleine-König
2011-01-05 14:29                   ` Jim Rees
2011-01-05 14:42                     ` Marc Kleine-Budde
2011-01-05 15:38                       ` Jim Rees
2011-01-05 14:53                   ` Trond Myklebust
2011-01-05 15:01                     ` Marc Kleine-Budde
2011-01-05 15:14                       ` Trond Myklebust
2011-01-05 15:29                         ` Trond Myklebust
2011-01-05 15:39                           ` Marc Kleine-Budde
2011-01-05 15:52                         ` Russell King - ARM Linux
2011-01-05 17:17                           ` Trond Myklebust
2011-01-05 17:26                             ` Russell King - ARM Linux
2011-01-05 18:12                               ` Trond Myklebust
2011-01-05 18:27                                 ` Russell King - ARM Linux
2011-01-05 18:55                                   ` Trond Myklebust
2011-01-05 19:07                                     ` Russell King - ARM Linux
2011-01-14  2:25                     ` Andy Isaacson
2011-01-14  2:40                       ` Trond Myklebust
2011-01-14  4:22                         ` Andy Isaacson
     [not found]   ` <AANLkTikvZF6Q1k0rETLHUffkUT3grxAh3FoB_0vs96B8@mail.gmail.com>
2010-12-30 18:24     ` Trond Myklebust
2010-12-30 18:50       ` Linus Torvalds
2010-12-30 19:25         ` Trond Myklebust
2010-12-30 20:02           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294268808.2952.18.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.kleine-budde@pengutronix.de \
    --cc=mkl@pengutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).