LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Setting Kernel space to non-cacheable on x86_64 using IA_PAT MSR or page table walks (https://www.linuxquestions.org/questions/linux-general-1/setting-kernel-space-to-non-cacheable-on-x86_64-using-ia_pat-msr-or-page-table-walks-4175675152/)

c01ahib 05-13-2020 11:23 AM

Setting Kernel space to non-cacheable on x86_64 using IA_PAT MSR or page table walks
 
I am trying to disable the caching for the Linux operating system only, i.e., Kernel space. I figured out that there are two ways to do this:

1- Using MTRR: This turned out to be infeasible as MTRR allow disabling caching for ranges of physical addresses. I am using a 64bit Tinycore Linux on x86_64, which means that kernel space can be mapped to the whole RAM (unlike 32bit systems where space maps to low physical memory).

2- Using PAT: This seems to be the better option as it works on virtual pages. However I am not sure whether I should use the IA32_PAT register and how? or modify the page table entries for kernel pages and how?


Could anyone provide full code for disabling cache for kernel space only or at least instructions from using IA32_PAT or modifying page table entries?

I found this question:
https://stackoverflow.com/questions/...le-entry-flags
but does not include the full code and it is not answered.

I also found these questions for page table walks:
https://stackoverflow.com/questions/...age-table-walk, and https://stackoverflow.com/questions/...ory-management

Thank you!


All times are GMT -5. The time now is 01:31 AM.