From: NIIBE Y. <gn...@ch...> - 2000-08-16 08:27:03
|
Stuart Menefy wrote: > I've been looking at an odd problem for the last few days, and not > getting anywhere fast, so I was just wondering if anybody else has seen > something similar. I don't see IDE problem. I've been tracking cache problem these days. I don't know if it's related or not. Patch is attached. With the patch, it stabilize for me. (1) When page is released, its cache (I-cache and D-cache) is not flushed. So, when using newly allocated page, we need to flush the caches. (2) When kernel writes to the page, we need to flush the cache. If not, when alias occurs, user space may read stale cached data. People, could you please test the kernel with fewer memory (I'm using mem=4M option) and swap enabled? 2000-08-16 NIIBE Yutaka <gn...@m1...> * fs/buffer.c (end_buffer_io_async): Bug fix. Flush D-cache. When kernel writes to the page, we should flush USER cache so that USER doesn't read stale data. * mm/memory.c (break_cow): Bug fix. We need to flush D-cache. For newly allocated page, D-cache may contain stale USER data. flush_cache_page is not good for physically tagged architecture. (Note that flushing routine is called before setting PTE.) (do_wp_page: case 1): Likewise. (do_swap_page): Likewise. 2000-08-13 NIIBE Yutaka <gn...@m1...> * mm/memory.c (break_cow): Bug fix. We need to flush I-cache. For newly allocated page, I-cache may contain stale USER data. * arch/sh/mm/init.c (mem_init): Flush empty_zero_page. Index: arch/sh/mm/init.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/mm/init.c,v retrieving revision 1.5 diff -u -r1.5 init.c --- arch/sh/mm/init.c 2000/08/09 11:47:49 1.5 +++ arch/sh/mm/init.c 2000/08/16 08:11:41 @@ -241,6 +241,7 @@ /* clear the zero-page */ memset(empty_zero_page, 0, PAGE_SIZE); + flush_page_to_ram(virt_to_page(empty_zero_page)); /* this will put all low memory onto the freelists */ totalram_pages += free_all_bootmem(); Index: fs/buffer.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/fs/buffer.c,v retrieving revision 1.6 diff -u -r1.6 buffer.c --- fs/buffer.c 2000/08/08 08:03:51 1.6 +++ fs/buffer.c 2000/08/16 08:11:51 @@ -770,6 +770,7 @@ /* OK, the async IO on this page is complete. */ spin_unlock_irqrestore(&page_uptodate_lock, flags); + flush_dcache_page(page); /* * if none of the buffers had errors then we can set the * page uptodate: Index: mm/memory.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/mm/memory.c,v retrieving revision 1.5 diff -u -r1.5 memory.c --- mm/memory.c 2000/08/09 12:51:01 1.5 +++ mm/memory.c 2000/08/16 08:12:01 @@ -790,8 +790,8 @@ pte_t *page_table) { copy_cow_page(old_page,new_page,address); - flush_page_to_ram(new_page); - flush_cache_page(vma, address); + flush_icache_page(vma, new_page); + flush_dcache_page(new_page); establish_pte(vma, address, page_table, pte_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot)))); } @@ -849,7 +849,7 @@ UnlockPage(old_page); /* FallThrough */ case 1: - flush_cache_page(vma, address); + flush_dcache_page(old_page); establish_pte(vma, address, page_table, pte_mkyoung(pte_mkdirty(pte_mkwrite(pte)))); spin_unlock(&mm->page_table_lock); return 1; /* Minor fault */ @@ -1060,7 +1060,7 @@ if (!page) return -1; - flush_page_to_ram(page); + flush_dcache_page(page); flush_icache_page(vma, page); } |