Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14937
b: refs/heads/master
c: 2a298a3
h: refs/heads/master
i:
  14935: 4f8a571
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Dec 2, 2005
1 parent 8f7897a commit 65e7933
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 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: deda498710e190c7922c2634ed630ee64ce86c05
refs/heads/master: 2a298a35ebe060a6f2b06b20c2a34ea188ddfd37
21 changes: 14 additions & 7 deletions trunk/drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,11 @@ acpi_processor_power_activate(struct acpi_processor *pr,

static void acpi_safe_halt(void)
{
int polling = test_thread_flag(TIF_POLLING_NRFLAG);
if (polling) {
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb__after_clear_bit();
}
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb__after_clear_bit();
if (!need_resched())
safe_halt();
if (polling)
set_thread_flag(TIF_POLLING_NRFLAG);
set_thread_flag(TIF_POLLING_NRFLAG);
}

static atomic_t c3_cpu_count;
Expand Down Expand Up @@ -295,6 +291,15 @@ static void acpi_processor_idle(void)
* ------
* Invoke the current Cx state to put the processor to sleep.
*/
if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb__after_clear_bit();
if (need_resched()) {
set_thread_flag(TIF_POLLING_NRFLAG);
return;
}
}

switch (cx->type) {

case ACPI_STATE_C1:
Expand Down Expand Up @@ -327,6 +332,7 @@ static void acpi_processor_idle(void)
t2 = inl(acpi_fadt.xpm_tmr_blk.address);
/* Re-enable interrupts */
local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG);
/* Compute time (ticks) that we were actually asleep */
sleep_ticks =
ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
Expand Down Expand Up @@ -366,6 +372,7 @@ static void acpi_processor_idle(void)

/* Re-enable interrupts */
local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG);
/* Compute time (ticks) that we were actually asleep */
sleep_ticks =
ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
Expand Down

0 comments on commit 65e7933

Please sign in to comment.