Re: How to disable the CPU cache?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good morning folks,

Yang Huang wrote:
Hi list,

finally I "steal" a piece of code from memtest86 3.2, named
cache_off(), invoke it in a module and insmod. I feel immediately the
system is slowed down!
Good work Yang! :-)
What is Memtest86 3.2 ?
I believe this will definitely disable the cache, though not yet sure
whether both L1 and L2 cache are disabled. Any suggestions?

here is the code below:

static inline void cache_off(void)
{
        asm(
		"push %eax\n\t"
		"movl %cr0,%eax\n\t"
                "orl $0x40000000,%eax\n\t"  /* Set CD */
                "movl %eax,%cr0\n\t"
		"wbinvd\n\t"
		"pop  %eax\n\t");
}
What are we doing here ? I am not familiar with 'wbinvd' and 'cr0'
I googled up 'wbinvd'
Flushes internal cache, then signals the external cache to write
back current data followed by a signal to flush the external cache.
So this flushes both the Internal as well as External Cache. Now, here is my question: What do we mean by 'write back current data' ? where does the External Cache write it back ? How does writing back help ?

Manav

have fun with it...

Yang

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux