Skip to content

RFC PAT 64b: PAT support for X86_64

[email protected] lkml 1 version Applied

Status from this message: thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest12 patches 39 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/12PAT 64b: Add cpu_shutdown() supportarch/x86/kernel/reboot_64.c arch/x86/kernel/setup64.c arch/x86/kernel/smp_64.c +1 more+7 -00 replies
2/12PAT 64b: Basic PAT implementationarch/x86/kernel/setup64.c arch/x86/mm/Makefile_64 arch/x86/mm/pat.c +5 more+94 -1112 replies
3/12PAT 64b: drm driver changes for PATdrivers/char/drm/drm_proc.c drivers/char/drm/drm_vm.c drivers/video/gbefb.c +2 more+7 -120 replies
4/12PAT 64b: reserve_mattr and free_mattr for PATarch/x86/mm/ioremap_64.c arch/x86/mm/pat.c include/asm-x86/pat.h+125 -40 replies
5/12PAT 64b: pci mmap conlfict patcharch/x86/pci/i386.c+32 -00 replies
6/12PAT 64b: Add ioremap_wc supportarch/x86/mm/ioremap_64.c include/asm-x86/io_64.h+27 -27 replies
7/12PAT 64b: dev mem chanegs for patarch/x86/mm/pat.c drivers/char/mem.c include/asm-x86/pgtable_64.h+86 -360 replies
8/12PAT 64b: coherent mmap and sysfs bin ioctldrivers/pci/pci-sysfs.c fs/sysfs/bin.c include/asm-x86/pci.h +2 more+84 -115 replies
9/12PAT 64b: map only usable memory in identity mappingarch/x86/kernel/e820_64.c arch/x86/mm/init_64.c arch/x86/mm/ioremap_64.c +2 more+142 -160 replies
10/12PAT 64b: Make acpi use early map instead of assuming identity maparch/x86/kernel/acpi/boot.c arch/x86/kernel/mpparse_64.c arch/x86/mm/init_64.c +2 more+39 -90 replies
11/12PAT 64b: devmem do not read pages not mapped in identity maparch/x86/kernel/e820_64.c include/asm-x86/io_64.h+14 -00 replies
12/12PAT 64b: skip attr tracking for RAMarch/x86/kernel/e820_64.c arch/x86/mm/ioremap_64.c arch/x86/mm/pat.c +1 more+48 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/12] PAT 64b: PAT support for X86_64

Yes. It is that wonderful time of the year again.
No, no. We are not talking about holiday season or new year here.

We are talking about one another rehash of "why we do not support PAT in x86" question and series of patches that implement some PAT support before going into hibernation again. Only difference is that we hope to take this little further this time and may be really get this support into upstream kernel soon.

This series is heavily derived from the PAT patchset by Eric Biederman and Andi Kleen.
http://www.firstfloor.org/pub/ak/x86_64/pat/

We have forwarded ported these patches to latest kernel, addressed some of the race conditions, cut a lot more corners to get this into a working patchset that can be seen as an RFC. Specifically, the chanegs we added include:

* Various bug fixes over original patchset above.
* Change x86_64 identity map to only map non-reserved memory. This helps to handle UC/WC mapping of reserved region in a much simple manner (we don't have to do cpa any more, as such not keep track of the actual reference counts. We still track all the usages to keep the mappings consistent. We just avoid the headache of splitting mattr regions for managing ref counts for every individual usage of the reserved area).
* Modify reserve_mattr and free_mattr to handle various mapping of reserved regions cleanly.

There are many rough edges in the patchset. TBD list below refers to the open issues that we have thought through during this process.

TBD:
* Do we need to allow RAM pages to be mapped as WC? If not, then we don't need to follow the TLB flush mechanism (make pte not present, flush, and set pte with new mapping) mentioned in section 10.12.4 of SDM Vol3a.
* If the above can be assumed, then for a complete solution, handle RAM pages with UC and /dev/mem mapping conflicts.
Can we use the existing page struct to keep track of the /dev/mem mappings (through the page ref count) and not allow
to free the page while the /dev/mem mappings are active. And allow /dev/mem to map only those pages which are marked reserved (which the driver does before doing iomap).
* For X and others, do we need the ioctl interface to sysfs or get the type attribute through a different sysfs file.
* Clean up early table space allocation, avoiding overallocation there.
* Avoid mapping 0 - 1M physical addresses in kernel text mapping.
* Read reserved regions in /dev/mem read() as 0xffff or something, and continue reading across holes, till we reach the high_memory (end of memory).
* For fork(), for every /dev/mem mapping, we have to keep track of the usage by doing reserve_mattr().

There are also many edges completely missing. Lot of things we did not look at all for this first cut. Specifically:

* Only supports x86_64 for now. i386 may not even compile with this patchset.
* We did not look at implication of PAT on Suspend-Resume.
* We did not look at implications of PAT on KEXEC.
* Coding style details.

We expect this can be done easily once we have discussed/resolved the basic PAT problems with this RFC.

Fireaway all comments, complaints, concerns and things we may break while we do this.

Tested with 2.6.24-rc4 and X86_64.

---