WSL2-Linux-Kernel/arch
Marcelo Tosatti eb07d964b4 [PATCH] ppc32 8xx: update_mmu_cache() needs unconditional tlbie
Currently 8xx fails to boot due to endless pagefaults.

Seems the bug is exposed by the change which avoids flushing the
TLB when not necessary (in case the pte has not changed), introduced
recently:

__handle_mm_fault():

        entry = pte_mkyoung(entry);
        if (!pte_same(old_entry, entry)) {
                ptep_set_access_flags(vma, address, pte, entry, write_access);
                update_mmu_cache(vma, address, entry);
                lazy_mmu_prot_update(entry);
        } else {
                /*
                 * This is needed only for protection faults but the arch code
                 * is not yet telling us if this is a protection fault or not.
                 * This still avoids useless tlb flushes for .text page faults
                 * with threads.
                 */
                if (write_access)
                        flush_tlb_page(vma, address);
        }

The "update_mmu_cache()" call was unconditional before, which caused the TLB
to be flushed by:

        if (pfn_valid(pfn)) {
                struct page *page = pfn_to_page(pfn);
                if (!PageReserved(page)
                    && !test_bit(PG_arch_1, &page->flags)) {
                        if (vma->vm_mm == current->active_mm) {
#ifdef CONFIG_8xx
                        /* On 8xx, cache control instructions (particularly 
                         * "dcbst" from flush_dcache_icache) fault as write 
                         * operation if there is an unpopulated TLB entry 
                         * for the address in question. To workaround that, 
                         * we invalidate the TLB here, thus avoiding dcbst 
                         * misbehaviour.
                         */
                                _tlbie(address);
#endif
                                __flush_dcache_icache((void *) address);
                        } else
                                flush_dcache_icache_page(page);
                        set_bit(PG_arch_1, &page->flags);
                }

Which worked to due to pure luck: PG_arch_1 was always unset before, but
now it isnt.

The root of the problem are the changes against the 8xx TLB handlers introduced
during v2.6. What happens is the TLBMiss handlers load the zeroed pte into
the TLB, causing the TLBError handler to be invoked (thats two TLB faults per 
pagefault), which then jumps to the generic MM code to setup the pte.

The bug is that the zeroed TLB is not invalidated (the same reason
for the "dcbst" misbehaviour), resulting in infinite TLBError faults.

The "two exception" approach requires a TLB flush (to nuke the zeroed TLB)
at each PTE update for correct behaviour:

Signed-off-by: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-16 13:28:22 +11:00
..
alpha [PATCH] sched: resched and cpu_idle rework 2005-11-09 07:56:33 -08:00
arm [ARM] Initialise SA1111 core before SA1111 PCMCIA 2005-11-15 19:04:22 +00:00
arm26 [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
cris [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
frv [PATCH] move pm_register/etc. to CONFIG_PM_LEGACY, pm_legacy.h 2005-11-13 18:14:10 -08:00
h8300 [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
i386 [PATCH] drop "[PATCH] i386 kexec-on-panic: Don't shutdown the apics" 2005-11-15 08:59:18 -08:00
ia64 [PATCH] ia64: cpu_idle performance bug fix 2005-11-15 15:50:51 -08:00
m32r [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
m68k [PATCH] m68k: convert thread flags to use bit fields 2005-11-13 18:14:14 -08:00
m68knommu [PATCH] m68knommu: move some platform irq support out of irq.h 2005-11-07 08:00:47 -08:00
mips [PATCH] arch/mips/au1000/common/usbdev.c: don't concatenate __FUNCTION__ with strings 2005-11-13 18:14:16 -08:00
parisc [PATCH] sched: resched and cpu_idle rework 2005-11-09 07:56:33 -08:00
powerpc [PATCH] Add missing EXPORT_SYMBOLS() for __ide_mm_* functions on powerpc 2005-11-15 08:59:19 -08:00
ppc [PATCH] ppc32 8xx: update_mmu_cache() needs unconditional tlbie 2005-11-16 13:28:22 +11:00
ppc64 powerpc: Move most remaining ppc64 files over to arch/powerpc 2005-11-14 17:30:17 +11:00
s390 [PATCH] sched: resched and cpu_idle rework 2005-11-09 07:56:33 -08:00
sh [PATCH] sched: resched and cpu_idle rework 2005-11-09 07:56:33 -08:00
sh64 [PATCH] sched: resched and cpu_idle rework 2005-11-09 07:56:33 -08:00
sparc [PATCH] atomic: inc_not_zero 2005-11-13 18:14:16 -08:00
sparc64 [SBUSFB]: implement ->compat_ioctl 2005-11-12 12:11:12 -08:00
um [PATCH] uml: fix daemon transport exit path bug 2005-11-13 18:14:15 -08:00
v850 [PATCH] v850: use generic hardirq code 2005-11-15 08:59:20 -08:00
x86_64 Merge x86-64 update from Andi 2005-11-14 19:56:02 -08:00
xtensa Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel 2005-11-11 09:24:26 -08:00