Skip to content

Commit 8cad37e

Browse files
chleroygregkh
authored andcommitted
powerpc/8xx: Always fault when _PAGE_ACCESSED is not set
commit 29daf86 upstream. The kernel expects pte_young() to work regardless of CONFIG_SWAP. Make sure a minor fault is taken to set _PAGE_ACCESSED when it is not already set, regardless of the selection of CONFIG_SWAP. This adds at least 3 instructions to the TLB miss exception handlers fast path. Following patch will reduce this overhead. Also update the rotation instruction to the correct number of bits to reflect all changes done to _PAGE_ACCESSED over time. Fixes: d069cb4 ("powerpc/8xx: Don't touch ACCESSED when no SWAP.") Fixes: 5f35649 ("powerpc/8xx: remove unused _PAGE_WRITETHRU") Fixes: e0a8e0d ("powerpc/8xx: Handle PAGE_USER via APG bits") Fixes: 5b2753f ("powerpc/8xx: Implementation of PAGE_EXEC") Fixes: a891c43 ("powerpc/8xx: Prepare handlers for _PAGE_HUGE for 512k pages.") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/af834e8a0f1fa97bfae65664950f0984a70c4750.1602492856.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b57c759 commit 8cad37e

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

arch/powerpc/kernel/head_8xx.S

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ SystemCall:
229229

230230
InstructionTLBMiss:
231231
mtspr SPRN_SPRG_SCRATCH0, r10
232-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
233232
mtspr SPRN_SPRG_SCRATCH1, r11
234-
#endif
235233

236234
/* If we are faulting a kernel address, we have to use the
237235
* kernel page tables.
@@ -278,11 +276,9 @@ InstructionTLBMiss:
278276
#ifdef ITLB_MISS_KERNEL
279277
mtcr r11
280278
#endif
281-
#ifdef CONFIG_SWAP
282-
rlwinm r11, r10, 32-5, _PAGE_PRESENT
279+
rlwinm r11, r10, 32-7, _PAGE_PRESENT
283280
and r11, r11, r10
284281
rlwimi r10, r11, 0, _PAGE_PRESENT
285-
#endif
286282
/* The Linux PTE won't go exactly into the MMU TLB.
287283
* Software indicator bits 20 and 23 must be clear.
288284
* Software indicator bits 22, 24, 25, 26, and 27 must be
@@ -296,9 +292,7 @@ InstructionTLBMiss:
296292

297293
/* Restore registers */
298294
0: mfspr r10, SPRN_SPRG_SCRATCH0
299-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
300295
mfspr r11, SPRN_SPRG_SCRATCH1
301-
#endif
302296
rfi
303297
patch_site 0b, patch__itlbmiss_exit_1
304298

@@ -308,9 +302,7 @@ InstructionTLBMiss:
308302
addi r10, r10, 1
309303
stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0)
310304
mfspr r10, SPRN_SPRG_SCRATCH0
311-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
312305
mfspr r11, SPRN_SPRG_SCRATCH1
313-
#endif
314306
rfi
315307
#endif
316308

@@ -394,11 +386,9 @@ DataStoreTLBMiss:
394386
* r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
395387
* r10 = (r10 & ~PRESENT) | r11;
396388
*/
397-
#ifdef CONFIG_SWAP
398-
rlwinm r11, r10, 32-5, _PAGE_PRESENT
389+
rlwinm r11, r10, 32-7, _PAGE_PRESENT
399390
and r11, r11, r10
400391
rlwimi r10, r11, 0, _PAGE_PRESENT
401-
#endif
402392
/* The Linux PTE won't go exactly into the MMU TLB.
403393
* Software indicator bits 24, 25, 26, and 27 must be
404394
* set. All other Linux PTE bits control the behavior

0 commit comments

Comments
 (0)