Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to disable the level 1 and level 2 caches of my CPU. I wrote a kernel module to set the 30th bit of the control register cr0. But when I try to insert the module with insmod, the system freezes. I am using a Thinkpad X41 with a Pentium M and kernel 2.6.32-40-generic #87-Ubuntu SMP. What can I do to determine the reason for the freeze?
As I just found out, the syntax for the mov instruction with control registers is not as I expected: in Intel syntax, the destination register comes first in cases where control registers are involved. I adopted the code of the module in the first post.
However, the overall result stays the same, the system freezes when the module is inserted. I found out that the module runs without problems with this line commented out:
Code:
"or eax,(1 << 30)\n\t"
(But it also has no effect because cr0 is not altered.)
Disabling cpu caches gives you a pentium I like processor!!!
The addition of Cache on CPU was one of the best upgrades to cpu architecture and is used to retain temporal data / instructions. as nini09 have said, you cannot disable it at fly, but certain BIOS would give you the option at boot time. Is there any special requirement, or is only homework / test?
Thank you for your answers. I want to disable the caches for a research project where we want to measure execution times and want to be sure they are not influenced by the internal caches.
@whizje: I tried your suggestion and apparently, it is working. But I have to investigate it further tomorrow when I will have more time.
After some investigation, I found out that the module runs fine (with the corrections from my second post). I just didn't wait long enough after fixing the mov cr0, eax bug, misinterpreating the slow behavior of the system with disabled caches as a complete freeze. My apologies for that.
The code posted by whizje is also working, of course. I didn't find an option for cache disabling in the BIOS of my machine.
@hga Run make and insmod. Source code, makefile and argument for insmod is given in the first post. If you have problems, please ask more specific questions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.