linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* still nfs problems [Was: Linux 2.6.37-rc8]
@ 2011-01-05 19:05 James Bottomley
  2011-01-05 19:18 ` Linus Torvalds
  0 siblings, 1 reply; 79+ messages in thread
From: James Bottomley @ 2011-01-05 19:05 UTC (permalink / raw)
  To: linux-arm-kernel

[sorry for the unthreaded insertion.  We're seeing this on parisc too]

> On Wed, Jan 05, 2011 at 10:14:17AM -0500, Trond Myklebust wrote:
> > OK. So,the new behaviour in 2.6.37 is that we're writing to a series of
> > pages via the usual kmap_atomic()/kunmap_atomic() and kmap()/kunmap()
> > interfaces, but we can end up reading them via a virtual address range
> > that gets set up via vm_map_ram() (that range gets set up before the
> > write occurs).
> 
> kmap of lowmem pages will always reuses the existing kernel direct
> mapping, so there won't be a problem there.
> 
> > Do we perhaps need an invalidate_kernel_vmap_range() before we can read
> > the data on ARM in this kind of scenario?
> 
> Firstly, vm_map_ram() does no cache maintainence of any sort, nor does
> it take care of page colouring - so any architecture where cache aliasing
> can occur will see this problem.  It should not limited to ARM.
> 
> Secondly, no, invalidate_kernel_vmap_range() probably isn't sufficient.
> There's two problems here:
> 
> 	addr = kmap(lowmem_page);
> 	*addr = stuff;
> 	kunmap(lowmem_page);
> 
> Such lowmem pages are accessed through their kernel direct mapping.
> 
> 	ptr = vm_map_ram(lowmem_page);
> 	read = *ptr;
> 
> This creates a new mapping which can alias with the kernel direct mapping.
> Now, as this is a new mapping, there should be no cache lines associated
> with it.  (Looking at vm_unmap_ram(), it calls free_unmap_vmap_area_addr(),
> free_unmap_vmap_area(), which then calls flush_cache_vunmap() on the
> region.  vb_free() also calls flush_cache_vunmap() too.)
> 
> If the write after kmap() hits an already present cache line, the cache
> line will be updated, but it won't be written back to memory.  So, on
> a subsequent vm_map_ram(), with any kind of aliasing cache, there's
> no guarantee that you'll hit that cache line and read the data just
> written there.
> 
> The kernel direct mapping would need to be flushed.
> 
> I'm really getting to the point of hating the poliferation of RAM
> remapping interfaces - it's going to (and is) causing nothing but lots
> of pain on virtual cache architectures, needing more and more cache
> flushing interfaces to be created.
> 
> Is there any other solution to this?

I think the solution for the kernel direct mapping problem is to take
the expected flushes and invalidates into kmap/kunmap[_atomic].  I think
the original reason for not doing this was efficiency:  the user should
know what they did with the data (i.e. if they're only reading it, it
doesn't need to be flushed on unmap).  However, the difficulty of
getting all this right seems to outweigh the efficiency of only using
the necessary flushing.  At least on some architectures, we can look at
the TLB flags to see if the page was dirtied (and only flush if it was).

James

^ permalink raw reply	[flat|nested] 79+ messages in thread
[parent not found: <AANLkTi=-dNeeDjcSoznKtwcaNyw1mMXSqepFY89R2i+2@mail.gmail.com>]

end of thread, other threads:[~2011-01-14  4:22 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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
     [not found] <AANLkTi=-dNeeDjcSoznKtwcaNyw1mMXSqepFY89R2i+2@mail.gmail.com>
2010-12-30 17:14 ` Uwe Kleine-König
2010-12-30 17:57   ` Linus Torvalds
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
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

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).