[PATCH] i386: add idle notifier
Add a notifier mechanism to the low level idle loop. You can register a callback function which gets invoked on entry and exit from the low level idle loop. The low level idle loop is defined as the polling loop, low-power call, or the mwait instruction. Interrupts processed by the idle thread are not considered part of the low level loop. The notifier can be used to measure precisely how much is spent in useless execution (or low power mode). The perfmon subsystem uses it to turn on/off monitoring. Signed-off-by: stephane eranian <eranian@hpl.hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Andi Kleen <ak@suse.de>
This commit is contained in:
committed by
Andi Kleen
parent
86a978837c
commit
2ff2d3d747
@@ -257,6 +257,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
|
||||
: :"a" (eax), "c" (ecx));
|
||||
}
|
||||
|
||||
static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
|
||||
{
|
||||
/* "mwait %eax,%ecx;" */
|
||||
asm volatile(
|
||||
"sti; .byte 0x0f,0x01,0xc9;"
|
||||
: :"a" (eax), "c" (ecx));
|
||||
}
|
||||
|
||||
extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
|
||||
|
||||
/* from system description table in BIOS. Mostly for MCA use, but
|
||||
|
||||
Reference in New Issue
Block a user