Skip to content

Commit 29daf86

Browse files
chleroympe
authored andcommitted
powerpc/8xx: Always fault when _PAGE_ACCESSED is not set
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: [email protected] Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/af834e8a0f1fa97bfae65664950f0984a70c4750.1602492856.git.christophe.leroy@csgroup.eu
1 parent 0540b0d commit 29daf86

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

arch/powerpc/kernel/head_8xx.S

+2-12
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ SystemCall:
202202

203203
InstructionTLBMiss:
204204
mtspr SPRN_SPRG_SCRATCH0, r10
205-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
206205
mtspr SPRN_SPRG_SCRATCH1, r11
207-
#endif
208206

209207
/* If we are faulting a kernel address, we have to use the
210208
* kernel page tables.
@@ -238,11 +236,9 @@ InstructionTLBMiss:
238236
rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K
239237
mtspr SPRN_MI_TWC, r11
240238
#endif
241-
#ifdef CONFIG_SWAP
242-
rlwinm r11, r10, 32-5, _PAGE_PRESENT
239+
rlwinm r11, r10, 32-7, _PAGE_PRESENT
243240
and r11, r11, r10
244241
rlwimi r10, r11, 0, _PAGE_PRESENT
245-
#endif
246242
/* The Linux PTE won't go exactly into the MMU TLB.
247243
* Software indicator bits 20 and 23 must be clear.
248244
* Software indicator bits 22, 24, 25, 26, and 27 must be
@@ -256,9 +252,7 @@ InstructionTLBMiss:
256252

257253
/* Restore registers */
258254
0: mfspr r10, SPRN_SPRG_SCRATCH0
259-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
260255
mfspr r11, SPRN_SPRG_SCRATCH1
261-
#endif
262256
rfi
263257
patch_site 0b, patch__itlbmiss_exit_1
264258

@@ -268,9 +262,7 @@ InstructionTLBMiss:
268262
addi r10, r10, 1
269263
stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0)
270264
mfspr r10, SPRN_SPRG_SCRATCH0
271-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
272265
mfspr r11, SPRN_SPRG_SCRATCH1
273-
#endif
274266
rfi
275267
#endif
276268

@@ -316,11 +308,9 @@ DataStoreTLBMiss:
316308
* r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
317309
* r10 = (r10 & ~PRESENT) | r11;
318310
*/
319-
#ifdef CONFIG_SWAP
320-
rlwinm r11, r10, 32-5, _PAGE_PRESENT
311+
rlwinm r11, r10, 32-7, _PAGE_PRESENT
321312
and r11, r11, r10
322313
rlwimi r10, r11, 0, _PAGE_PRESENT
323-
#endif
324314
/* The Linux PTE won't go exactly into the MMU TLB.
325315
* Software indicator bits 24, 25, 26, and 27 must be
326316
* set. All other Linux PTE bits control the behavior

0 commit comments

Comments
 (0)