* How can do to disable the L1 cache in linux ?
@ 2001-05-02 3:04 Alex Huang
2001-05-02 16:30 ` Eric W. Biederman
0 siblings, 1 reply; 4+ messages in thread
From: Alex Huang @ 2001-05-02 3:04 UTC (permalink / raw)
To: linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="big5", Size: 288 bytes --]
Dear All,
How can do to disable the L1 cache in linux ?
Are there some commands or directives to disable it ??
Thanks
Alex
ý:.˱Êâmçë¢kaÉb²ßìzwm
ébïî˱Êâmébìÿêçz_âØ^nr¡ö¦zË\x1aëh¨èÚ&£ûàz¿äz¹Þú+Ê+zf£¢·h§~Ûiÿÿïêÿêçz_è®\x0fæj:+v¨þ)ߣømSåy«\x1eæ¶\x17
\x01\x06ÛiÿÿðÃ\x0fí»\x1fè®\x0fåi\x7f
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How can do to disable the L1 cache in linux ?
2001-05-02 3:04 How can do to disable the L1 cache in linux ? Alex Huang
@ 2001-05-02 16:30 ` Eric W. Biederman
0 siblings, 0 replies; 4+ messages in thread
From: Eric W. Biederman @ 2001-05-02 16:30 UTC (permalink / raw)
To: Alex Huang; +Cc: linux-kernel
"Alex Huang" <alexjoy@sis.com.tw> writes:
> Dear All,
> How can do to disable the L1 cache in linux ?
> Are there some commands or directives to disable it ??
Play with the MTRR's and disable caching on memory.
Stupid but it should get what you want.
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How can do to disable the L1 cache in linux ?
2001-05-02 3:32 Alex Huang
@ 2001-05-02 18:32 ` Mikulas Patocka
0 siblings, 0 replies; 4+ messages in thread
From: Mikulas Patocka @ 2001-05-02 18:32 UTC (permalink / raw)
To: Alex Huang; +Cc: linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 427 bytes --]
> Dear All,
> How can do to disable the L1 cache in linux ?
> Are there some commands or directives to disable it ??
I wrote this some times ago when playing with caches. Compile cctlmod.c as
a module, insert it to kernel, and use con and coff to enable and disable
caches.
Note that the code is quite old, maybe it doesn't work with 2.4 kernels,
and I don't want support it. If it doesn't work, fix it yourself.
Mikulas
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-chdr; name="cctl.h", Size: 414 bytes --]
#include <errno.h>
#include <asm/unistd.h>
#define __NR_disable_cache 250
#define __NR_enable_cache 251
#define __NR_disable_cache_wt 252
#define __NR_disable_page_cache 253
#define __NR_enable_page_cache 254
_syscall0(int, disable_cache)
_syscall0(int, enable_cache)
_syscall0(int, disable_cache_wt)
_syscall1(int, disable_page_cache, void *, page)
_syscall1(int, enable_page_cache, void *, page)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Type: TEXT/x-csrc; name="cctlmod.c", Size: 1754 bytes --]
#define MODULE
#define __KERNEL__
#include <linux/autoconf.h>
#include <linux/module.h>
#include <linux/modversions.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <asm/pgtable.h>
extern void *sys_call_table[];
flush_t()
{
__asm__ __volatile__ (
"movl %%cr3, %%eax\n\t"
"movl %%eax, %%cr3\n\t"
:::"ax", "cc");
}
disable_cache()
{
__asm__ __volatile__ (
"cli\n\t"
"movl %%cr0, %%eax\n\t"
"orl $0x60000000, %%eax\n\t"
"movl %%eax, %%cr0\n\t"
"wbinvd\n\t"
"sti\n\t"
:::"ax", "cc");
return 0;
}
enable_cache()
{
__asm__ __volatile__ (
"cli\n\t"
"movl %%cr0, %%eax\n\t"
"andl $0x9fffffff, %%eax\n\t"
"movl %%eax, %%cr0\n\t"
"wbinvd\n\t"
"sti\n\t"
:::"ax", "cc");
return 0;
}
disable_cache_wt()
{
__asm__ __volatile__ (
"cli\n\t"
"movl %%cr0, %%eax\n\t"
"andl $0xdfffffff, %%eax\n\t"
"orl $0x40000000, %%eax\n\t"
"movl %%eax, %%cr0\n\t"
"wbinvd\n\t"
"sti\n\t"
:::"ax", "cc");
return 0;
}
disable_page_cache(unsigned long pg)
{
pte_t *pte = pte_offset(pmd_offset(pgd_offset(current->mm, pg), pg), pg);
*(unsigned *)pte |= 0x18;
flush_t();
return 0;
}
enable_page_cache(unsigned long pg)
{
pte_t *pte = pte_offset(pmd_offset(pgd_offset(current->mm, pg), pg), pg);
*(unsigned *)pte &= ~0x18;
flush_t();
return 0;
}
init_module()
{
sys_call_table[250] = disable_cache;
sys_call_table[251] = enable_cache;
sys_call_table[252] = disable_cache_wt;
sys_call_table[253] = disable_page_cache;
sys_call_table[254] = enable_page_cache;
return 0;
}
cleanup_module()
{
sys_call_table[250] = sys_call_table[251] = sys_call_table[252] = 0;
sys_call_table[253] = sys_call_table[254] = 0;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Type: TEXT/x-csrc; name="con.c", Size: 102 bytes --]
#include "cctl.h"
main()
{
if (enable_cache()) perror("enable_cache"), exit(1);
return 0;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: Type: TEXT/x-csrc; name="coff.c", Size: 104 bytes --]
#include "cctl.h"
main()
{
if (disable_cache()) perror("disable_cache"), exit(1);
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* How can do to disable the L1 cache in linux ?
@ 2001-05-02 3:32 Alex Huang
2001-05-02 18:32 ` Mikulas Patocka
0 siblings, 1 reply; 4+ messages in thread
From: Alex Huang @ 2001-05-02 3:32 UTC (permalink / raw)
To: linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="big5", Size: 289 bytes --]
Dear All,
How can do to disable the L1 cache in linux ?
Are there some commands or directives to disable it ??
Thanks
Alex
ý:.˱Êâmçë¢kaÉb²ßìzwm
ébïî˱Êâmébìÿêçz_âØ^nr¡ö¦zË\x1aëh¨èÚ&£ûàz¿äz¹Þú+Ê+zf£¢·h§~Ûiÿÿïêÿêçz_è®\x0fæj:+v¨þ)ߣømSåy«\x1eæ¶\x17
\x01\x06ÛiÿÿðÃ\x0fí»\x1fè®\x0fåi\x7f
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-05-02 18:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-02 3:04 How can do to disable the L1 cache in linux ? Alex Huang
2001-05-02 16:30 ` Eric W. Biederman
2001-05-02 3:32 Alex Huang
2001-05-02 18:32 ` Mikulas Patocka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).