Disable cache through /proc/mtrr

Hi,

I tried to disable caching by adding an uncachable region in /proc/mtrr but iit cannot work. I have to readd the whole region again, it works, for ex:

My add:

reg00: base=0x000000000 ( 0MB), size= 16384MB, count=1: write-back
reg01: base=0x400000000 (16384MB), size= 8192MB, count=1: write-back
reg03: base=0x020000000 ( 8192MB), size= 512MB, count=1: uncachable

The region from 0x020000000 is set as uncachable but it does not work as uncachable.

I have to disable reg00 and then add again the region base from 0x000000000 as uncachable region:

reg00: base=0x000000000 ( 0MB), size= 16384MB, count=1: uncachable
reg01: base=0x400000000 (16384MB), size= 8192MB, count=1: write-back

Now it can work. I do not know why we add a sub uncachable region in the write-back region as in the first case but it does not work.

As I know on arm architecture, Linux supports a configuration CONFIG_CPU_DCACHE_DISABLE to support cache disable but I do not find the same on x86.

Would you please let me know the reason in the first case and any other option that can disable cache in x86?

Hi naruto_uzu,

that is a pretty kernel-specific, in-depth question that might get a better response if asked on the LKML (Linux kernel mailing list) and for sure needs you to include the version of the kernel you’re working with.

Regards,
Jens