Welcome to the Linux Foundation Forum!

can I safely run "invd" instruction?



I'm trying to invalidate all the modified cache lines after performing an operation. I know I can run "wbinvd" to invalidate the modified cache line, however, as far I know running "wbinvd" will flush all the modified cache line into memory then it will invalidate the cache line. That is not what I'm trying to achieve. My goal is to remove all the changes without flushing them to the memory. I know that running "invd" instruction will achieve that. However, while I try to run the "invd" instruction I'm getting "general protection fault". I wrote a simple Linux kernel module just to check if I can run the "invd" instruction, Here is the code https://pastebin.com/K5NYPzWP

The output from dmesg shows,

[25737.058676] Loading hello module...
[25737.059001] running wbinvd
[25737.059015] general protection fault: 0000 [#1] SMP

Here, to maintain memory consistency I run "wbinvd" first and then run "invd". But no luck. Still getting "general protection error". Any help, what I'm doing wrong? Or how can run "invd" to clear the modified caheline without flushing the changes to the memory?


Upcoming Training