linux-mips
[Top] [All Lists]

Re: O_DIRECT file access and cache aliasing...

To: ddaney@avtrex.com
Subject: Re: O_DIRECT file access and cache aliasing...
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Wed, 29 Aug 2007 11:59:49 +0900 (JST)
Cc: linux-mips@linux-mips.org, jschmidt@avtrex.com, sfrancis@avtrex.com
In-reply-to: <46D4C61C.6010008@avtrex.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <46D4C61C.6010008@avtrex.com>
Sender: linux-mips-bounce@linux-mips.org
On Tue, 28 Aug 2007 18:04:28 -0700, David Daney <ddaney@avtrex.com> wrote:
> When we write files that were opened with O_DIRECT set, we observe that 
> there are many 16 byte chunks of data in the files that contain all 
> zeros instead of the correct data.
> 
> My understanding is that the cache is virtually indexed.  So I think 
> what is happening is that when data is written to memory by a user 
> application that does an O_DIRECT write, the IDE driver is given a list 
> of pages to transfer to the disk.  The driver then does a 
> dma_cache_wback() on the KSEG0 address of the pages before initiating 
> the DMA operation.  Since the KSEG0 address and the USEG address of the 
> physical memory are different, the data is never flushed to memory 
> resulting in incorrect data being written to disk.

I think get_user_pages() should flush user data for O_DIRECT.

The get_user_pages() uses flush_anon_page() to do it, and MIPS
flush_anon_page() was added on Mar 2007.  Does your kernel have this
fix?

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>