Skip to content

x86, cpa: cpa related changes to be inline with TLB Application note

Suresh Siddha lkml 1 version Applied

Status from this message: applied to tip/x86/pat, thanks Suresh.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7x86, cpa: rename PTE attribute macros for kernel direct mapping in early bootarch/x86/kernel/head_32.S arch/x86/kernel/head_64.S include/asm-x86/pgtable.h+28 -210 replies
2/7x86, cpa: remove USER permission from the very early identity mapping attributeinclude/asm-x86/pgtable.h+2 -20 replies
3/7x86, cpa: make the kernel physical mapping initialization a two pass sequencearch/x86/mm/init_32.c arch/x86/mm/init_64.c+144 -200 replies
4/7x86, cpa: dont use large pages for kernel identity mapping with DEBUG_PAGEALLOCarch/x86/mm/init_32.c arch/x86/mm/init_64.c+34 -100 replies
5/7x86, cpa: fix taking the pgd_lock with interrupts offarch/x86/mm/pageattr.c+16 -150 replies
6/7x86, cpa: remove cpa pool codearch/x86/mm/init_32.c arch/x86/mm/init_64.c arch/x86/mm/pageattr.c +1 more+6 -1560 replies
7/7x86, cpa: global flush tlb after splitting large page and before doing cpaarch/x86/mm/pageattr.c+32 -31 reply

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchArjan van de Ven
SeriesA-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/7] x86, cpa: cpa related changes to be inline with TLB Application note

TLB Application note[1] says:

"The TLBs may contain both ordinary and large-page translations for a 4-KByte
range of linear addresses. This may occur if software modifies the paging structures so that the page size used for the address range changes. If the two translations differ with respect to page frame or attributes (e.g., permissions), processor behavior is undefined and may be implementation specific. The processor may use a page frame or attributes that correspond to neither translation; it may improperly set or fail to set the dirty bit in the appropriate paging-structure entry.

Such undefined behavior is problematic because prefetches and memory accesses that are a result of speculative execution may occur, using the affected range of linear addresses. It is also problematic if software (including the software modifying the paging structures) is accessing data or executing code in the affected range of linear addresses. Software should not write to a paging-structure entry in a way that would change, for any linear address, both the page size and either the page frame or attributes."

Currently we violate this at:

a. kernel identity mapping, where large/small pages setup very early in the
boot will be split up/merged into large pages along with attribute changes during the direct memory mapping init.

b. while doing cpa(), potentially we will split large page and change attribute
both at the same time.

Following patches fixes this behavior.

[1] http://developer.intel.com/design/processor/applnots/317080.pdf