Skip to content

Commit 2de8b4c

Browse files
danglin44hdeller
authored andcommitted
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes everwhere, for both user and kernel flushes. However, when I modified flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000 would crash quite early when booting. The PDC returns alias values of 0 for the icache and dcache. This indicates that either the alias boundary is greater than 16MB or equivalent aliasing doesn't work. I modified the tmpalias code to make it easy to try alternate boundaries. I tried boundaries up to 128MB but still kernel tmpalias flushes didn't work on c8000. This led me to conclude that tmpalias flushes don't work on PA8800 and PA8900 machines, and that we needed to flush directly using the virtual address of user and kernel pages. This is likely the major cause of instability on the c8000 and rp34xx machines. Flushing user pages requires doing a temporary context switch as we have to flush pages that don't belong to the current context. Further, we have to deal with pages that aren't present. If a page isn't present, the flush instructions fault on every line. Other code has been rearranged and simplified based on testing. For example, I introduced a flush_cache_dup_mm routine. flush_cache_mm and flush_cache_dup_mm differ in that flush_cache_mm calls purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages. In some implementations, pdc is more efficient than fdc. Based on my testing, I don't believe there's any performance benefit on the c8000. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 67c35a3 commit 2de8b4c

3 files changed

Lines changed: 236 additions & 127 deletions

File tree

arch/parisc/include/asm/cacheflush.h

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,37 +59,20 @@ void flush_dcache_page(struct page *page);
5959
flush_kernel_icache_range_asm(s,e); \
6060
} while (0)
6161

62-
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
63-
do { \
64-
flush_cache_page(vma, vaddr, page_to_pfn(page)); \
65-
memcpy(dst, src, len); \
66-
flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \
67-
} while (0)
68-
69-
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
70-
do { \
71-
flush_cache_page(vma, vaddr, page_to_pfn(page)); \
72-
memcpy(dst, src, len); \
73-
} while (0)
74-
75-
void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn);
62+
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
63+
unsigned long user_vaddr, void *dst, void *src, int len);
64+
void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
65+
unsigned long user_vaddr, void *dst, void *src, int len);
66+
void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
67+
unsigned long pfn);
7668
void flush_cache_range(struct vm_area_struct *vma,
7769
unsigned long start, unsigned long end);
7870

7971
/* defined in pacache.S exported in cache.c used by flush_anon_page */
8072
void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
8173

8274
#define ARCH_HAS_FLUSH_ANON_PAGE
83-
static inline void
84-
flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
85-
{
86-
if (PageAnon(page)) {
87-
flush_tlb_page(vma, vmaddr);
88-
preempt_disable();
89-
flush_dcache_page_asm(page_to_phys(page), vmaddr);
90-
preempt_enable();
91-
}
92-
}
75+
void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr);
9376

9477
#define ARCH_HAS_FLUSH_ON_KUNMAP
9578
static inline void kunmap_flush_on_unmap(void *addr)

arch/parisc/include/asm/page.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
#define copy_page(to, from) copy_page_asm((void *)(to), (void *)(from))
2727

2828
struct page;
29+
struct vm_area_struct;
2930

3031
void clear_page_asm(void *page);
3132
void copy_page_asm(void *to, void *from);
3233
#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
33-
void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
34-
struct page *pg);
34+
void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr,
35+
struct vm_area_struct *vma);
36+
#define __HAVE_ARCH_COPY_USER_HIGHPAGE
3537

3638
/*
3739
* These are used to make use of C type-checking..

0 commit comments

Comments
 (0)