public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: linux-kernel@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>
Cc: jsun@mvista.com
Subject: Re: Properly implement flush_dcache_page in 2.4?  (Or is it possible?)
Date: Fri, 30 May 2003 17:18:53 -0700	[thread overview]
Message-ID: <20030530171853.G1669@mvista.com> (raw)
In-Reply-To: <20030531001458.H9419@flint.arm.linux.org.uk>; from rmk@arm.linux.org.uk on Sat, May 31, 2003 at 12:14:58AM +0100

On Sat, May 31, 2003 at 12:14:58AM +0100, Russell King wrote:
> > In addition, I am not sure if the vma struct will show up in the
> > "shared" list _if_ the page is only mapped in one user process and
> > in kernel (for example, those pages you obtain through get_user_pages()
> > call).
> 
> If a mapping is using MAP_SHARED, my understanding is that the pages should
> appear on the i_mmap_shared list.
>

That is my understanding too.
 
> I don't see a reason to worry about privately mapped pages on the i_mmap
> list since they are private, and therefore shouldn't be updated with
> modifications to other mappings, 

Actually there is, at least in 2.4.  Whenever kernel calls get_user_pages()
it maps a user page into kernel virtual address space.  If kernel modifies
that page, flush_dcache_page() needs to make sure any stale cache data
at user virtual address is flush in order user to see kernel changes.

I have a test case at 

	http://linux.junsun.net/test-programs

(Note, sometimes even if you pass the test, you _may_ still have a wrong
flush_dcache_page() implementation, because stale cache could be flushed 
due to other execution sequences)

I took a brief look of 2.5 code.  It seems this problem should still
exist (of course, assuming the CPU has cache aliasing problem and the
flush_dcache_page() is not properly implemented).  

Actually in 2.5 you may fail the test even if you have a properly implemented
flush_dcache_page().  It appears it lacks another flush_dcache_page()
after the direct_IO is done.  I don't have a working 2.5 on MIPS.  Can't 
verify that. 

Jun

  reply	other threads:[~2003-05-31  0:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-30 17:32 Properly implement flush_dcache_page in 2.4? (Or is it possible?) Jun Sun
2003-05-30 18:09 ` Russell King
2003-05-30 23:00   ` Jun Sun
2003-05-30 23:14     ` Russell King
2003-05-31  0:18       ` Jun Sun [this message]
2003-05-31  7:24       ` Hugh Dickins
2003-05-31  7:52         ` Russell King
2003-05-31  8:33           ` Hugh Dickins
2003-05-31  9:19             ` Russell King
2003-05-31 10:09               ` Hugh Dickins

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=20030530171853.G1669@mvista.com \
    --to=jsun@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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