Skip to content

Commit f839e5f

Browse files
danglin44hdeller
authored andcommitted
parisc: Fix non-access data TLB cache flush faults
When a page is not present, we get non-access data TLB faults from the fdc and fic instructions in flush_user_dcache_range_asm and flush_user_icache_range_asm. When these occur, the cache line is not invalidated and potentially we get memory corruption. The problem was hidden by the nullification of the flush instructions. These faults also affect performance. With pa8800/pa8900 processors, there will be 32 faults per 4 KB page since the cache line is 128 bytes. There will be more faults with earlier processors. The problem is fixed by using flush_cache_pages(). It does the flush using a tmp alias mapping. The flush_cache_pages() call in flush_cache_range() flushed too large a range. V2: Remove unnecessary preempt_disable() and preempt_enable() calls. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent ffb217a commit f839e5f

1 file changed

Lines changed: 1 addition & 27 deletions

File tree

arch/parisc/kernel/cache.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,6 @@ static void flush_cache_pages(struct vm_area_struct *vma, struct mm_struct *mm,
558558
}
559559
}
560560

561-
static void flush_user_cache_tlb(struct vm_area_struct *vma,
562-
unsigned long start, unsigned long end)
563-
{
564-
flush_user_dcache_range_asm(start, end);
565-
if (vma->vm_flags & VM_EXEC)
566-
flush_user_icache_range_asm(start, end);
567-
flush_tlb_range(vma, start, end);
568-
}
569-
570561
void flush_cache_mm(struct mm_struct *mm)
571562
{
572563
struct vm_area_struct *vma;
@@ -581,17 +572,8 @@ void flush_cache_mm(struct mm_struct *mm)
581572
return;
582573
}
583574

584-
preempt_disable();
585-
if (mm->context == mfsp(3)) {
586-
for (vma = mm->mmap; vma; vma = vma->vm_next)
587-
flush_user_cache_tlb(vma, vma->vm_start, vma->vm_end);
588-
preempt_enable();
589-
return;
590-
}
591-
592575
for (vma = mm->mmap; vma; vma = vma->vm_next)
593576
flush_cache_pages(vma, mm, vma->vm_start, vma->vm_end);
594-
preempt_enable();
595577
}
596578

597579
void flush_cache_range(struct vm_area_struct *vma,
@@ -605,15 +587,7 @@ void flush_cache_range(struct vm_area_struct *vma,
605587
return;
606588
}
607589

608-
preempt_disable();
609-
if (vma->vm_mm->context == mfsp(3)) {
610-
flush_user_cache_tlb(vma, start, end);
611-
preempt_enable();
612-
return;
613-
}
614-
615-
flush_cache_pages(vma, vma->vm_mm, vma->vm_start, vma->vm_end);
616-
preempt_enable();
590+
flush_cache_pages(vma, vma->vm_mm, start, end);
617591
}
618592

619593
void

0 commit comments

Comments
 (0)