Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43128
b: refs/heads/master
c: d331e73
h: refs/heads/master
v: v3
  • Loading branch information
Venkatesh Pallipadi authored and Andi Kleen committed Dec 7, 2006
1 parent c5fe47f commit 967a86e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0429d0d7a6116dedcb71d9128da904bf135f189
refs/heads/master: d331e739f5ad2aaa9d8553891ba6ca823bdbce37
19 changes: 17 additions & 2 deletions trunk/arch/x86_64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static void default_idle(void)
*/
static void poll_idle (void)
{
local_irq_enable();
cpu_relax();
}

Expand Down Expand Up @@ -208,6 +209,12 @@ void cpu_idle (void)
idle = default_idle;
if (cpu_is_offline(smp_processor_id()))
play_dead();
/*
* Idle routines should keep interrupts disabled
* from here on, until they go to idle.
* Otherwise, idle callbacks can misfire.
*/
local_irq_disable();
enter_idle();
idle();
/* In many cases the interrupt that ended idle
Expand Down Expand Up @@ -245,8 +252,16 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
/* Default MONITOR/MWAIT with no hints, used for default C1 state */
static void mwait_idle(void)
{
local_irq_enable();
mwait_idle_with_hints(0,0);
if (!need_resched()) {
__monitor((void *)&current_thread_info()->flags, 0, 0);
smp_mb();
if (!need_resched())
__sti_mwait(0, 0);
else
local_irq_enable();
} else {
local_irq_enable();
}
}

void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/asm-x86_64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,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);

#define stack_current() \
Expand Down

0 comments on commit 967a86e

Please sign in to comment.