Re: fuse, get_user_pages, flush_anon_page, aliasing caches and allthat again

From: James Bottomley
Date: Mon Jan 01 2007 - 11:45:24 EST


On Sun, 2006-12-31 at 13:12 -0800, David Miller wrote:
> From: Linus Torvalds <torvalds@xxxxxxxx>
> Date: Sun, 31 Dec 2006 12:58:45 -0800 (PST)
>
> > So there really is two different cases here:
> >
> > - flush the cache as seen by A PARTICULAR virtual mapping.
> >
> > This is ptrace, but it's other things like "unmap page from this VM"
> > too.
> >
> > - flush the cache for all possible virtual mappings - simply because we
> > don't even know who has it mapped dirty.
> >
> > And the thing is, the more I think about it, the more I end up
> > wondering:
> >
> > I'm not even sure how valid this is. Whatever path needs to do this is
> > likely doing something wrong anyway. If there are multiple possible
> > sources of cache conflicts, the thing is a disaster and the end result
> > depends on our ordering anyway, so I'd argue that it is just about as
> > correct to flush as it is to NOT flush.
> >
> > So I have this nagging suspicion that "flush_dcache_page()" is always a
> > bug when it is about "virtual caches". It should NEVER flush any virtual
> > caches, since that whole operations is by necessity something where you
> > should be talking about _which_ virtual cache you should flush.
>
> It's the aliasing between the _1_ valid user mapping and the kernel's
> virtual mapping, that's the problem and that's very valid and that's
> why we have flush_dcache_page() to begin with.
>
> > So "flush_dcache_page()" is - I think - more validtly thought about as
> > just DMA coherency (in a system where DMA does not participate in
> > _physical_ cache coherency). Not about virtual caches at all.
>
> And I guess that's what you're trying to say here.
>
> I'm beginning to think that Ralf Baechle had the best idea here,
> where he recently made it such that platforms could override
> kmap() and friends even on non-HIGHMEM configurations.
>
> In theory it's the perfect interface to handle this problem,
> you flush exactly where the physical page is made visible to
> the kernel for a cpu load/store. All the locations where that
> happens are perfectly annotated already with kmap() calls.

Actually, this was proposed here:

http://marc.theaimsgroup.com/?t=115409754100003

When I updated the interface to work for the combined VIPT/PIPT cache on
the latest pariscs. However, there were no takers for the idea.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/