Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230877
b: refs/heads/master
c: 2a2d31c
h: refs/heads/master
i:
  230875: 984e956
v: v3
  • Loading branch information
Shaohua Li authored and Len Brown committed Jan 12, 2011
1 parent 69c282b commit 631aa2f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 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: 5392083748a340f68052c0b83a7ce28b10324972
refs/heads/master: 2a2d31c8dc6f1ebcf5eab1d93a0cb0fb4ed57c7c
47 changes: 46 additions & 1 deletion trunk/drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#include <linux/hrtimer.h> /* ktime_get_real() */
#include <trace/events/power.h>
#include <linux/sched.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <asm/mwait.h>

#define INTEL_IDLE_VERSION "0.4"
Expand All @@ -73,6 +75,7 @@ static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;

static unsigned int mwait_substates;

#define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF
/* Reliable LAPIC Timer States, bit 1 for C1 etc. */
static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */

Expand Down Expand Up @@ -252,6 +255,39 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state)
return usec_delta;
}

static void __setup_broadcast_timer(void *arg)
{
unsigned long reason = (unsigned long)arg;
int cpu = smp_processor_id();

reason = reason ?
CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF;

clockevents_notify(reason, &cpu);
}

static int __cpuinit setup_broadcast_cpuhp_notify(struct notifier_block *n,
unsigned long action, void *hcpu)
{
int hotcpu = (unsigned long)hcpu;

switch (action & 0xf) {
case CPU_ONLINE:
smp_call_function_single(hotcpu, __setup_broadcast_timer,
(void *)true, 1);
break;
case CPU_DOWN_PREPARE:
smp_call_function_single(hotcpu, __setup_broadcast_timer,
(void *)false, 1);
break;
}
return NOTIFY_OK;
}

static struct notifier_block __cpuinitdata setup_broadcast_notifier = {
.notifier_call = setup_broadcast_cpuhp_notify,
};

/*
* intel_idle_probe()
*/
Expand Down Expand Up @@ -314,7 +350,11 @@ static int intel_idle_probe(void)
}

if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
lapic_timer_reliable_states = 0xFFFFFFFF;
lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
else {
smp_call_function(__setup_broadcast_timer, (void *)true, 1);
register_cpu_notifier(&setup_broadcast_notifier);
}

pr_debug(PREFIX "v" INTEL_IDLE_VERSION
" model 0x%X\n", boot_cpu_data.x86_model);
Expand Down Expand Up @@ -441,6 +481,11 @@ static void __exit intel_idle_exit(void)
intel_idle_cpuidle_devices_uninit();
cpuidle_unregister_driver(&intel_idle_driver);

if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
smp_call_function(__setup_broadcast_timer, (void *)false, 1);
unregister_cpu_notifier(&setup_broadcast_notifier);
}

return;
}

Expand Down

0 comments on commit 631aa2f

Please sign in to comment.