MIPS: 64-bit: Fix system lockup.

The address range size calculation inside local_flush_tlb_kernel_range()
is being truncated by a too small size variable holder on 64-bit systems.
The truncated size can result in an erroneous tlbsize check that means we
sit spinning inside a loop trying to flush a hige number of TLB entries.
This is for all intents and purposes a system hang. Fix by using an
appropriately sized valiable to hold the size.

[Ralf: Greg's original patch submission identified the issue and fixed one
instance in tlb-r4k.c but there there were several more. For consistency
I also modified tlb-r3k.c even though that file is only used on 32-bit.]

Signed-off-by: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by Greg Ungerer and committed by Ralf Baechle a5e696e5 195d1a96

+5 -10
+2 -4
arch/mips/mm/tlb-r3k.c
··· 82 int cpu = smp_processor_id(); 83 84 if (cpu_context(cpu, mm) != 0) { 85 - unsigned long flags; 86 - int size; 87 88 #ifdef DEBUG_TLB 89 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", ··· 120 121 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 122 { 123 - unsigned long flags; 124 - int size; 125 126 #ifdef DEBUG_TLB 127 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", start, end);
··· 82 int cpu = smp_processor_id(); 83 84 if (cpu_context(cpu, mm) != 0) { 85 + unsigned long size, flags; 86 87 #ifdef DEBUG_TLB 88 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", ··· 121 122 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 123 { 124 + unsigned long size, flags; 125 126 #ifdef DEBUG_TLB 127 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", start, end);
+2 -4
arch/mips/mm/tlb-r4k.c
··· 117 int cpu = smp_processor_id(); 118 119 if (cpu_context(cpu, mm) != 0) { 120 - unsigned long flags; 121 - int size; 122 123 ENTER_CRITICAL(flags); 124 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; ··· 159 160 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 161 { 162 - unsigned long flags; 163 - int size; 164 165 ENTER_CRITICAL(flags); 166 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
··· 117 int cpu = smp_processor_id(); 118 119 if (cpu_context(cpu, mm) != 0) { 120 + unsigned long size, flags; 121 122 ENTER_CRITICAL(flags); 123 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; ··· 160 161 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 162 { 163 + unsigned long size, flags; 164 165 ENTER_CRITICAL(flags); 166 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+1 -2
arch/mips/mm/tlb-r8k.c
··· 111 /* Usable for KV1 addresses only! */ 112 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 113 { 114 - unsigned long flags; 115 - int size; 116 117 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 118 size = (size + 1) >> 1;
··· 111 /* Usable for KV1 addresses only! */ 112 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) 113 { 114 + unsigned long size, flags; 115 116 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 117 size = (size + 1) >> 1;