Commit 8aa4b14e authored by Chen Gong's avatar Chen Gong Committed by Len Brown

ACPI: acpi_pad: Don't needlessly mark LAPIC unstable

As suggested in Venki's suggestion in the commit 0dc698b9,
add LAPIC unstable detection in the acpi_pad drvier too.
Signed-off-by: default avatarChen Gong <gong.chen@linux.intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 67a3e12b
...@@ -46,6 +46,8 @@ static unsigned long power_saving_mwait_eax; ...@@ -46,6 +46,8 @@ static unsigned long power_saving_mwait_eax;
static unsigned char tsc_detected_unstable; static unsigned char tsc_detected_unstable;
static unsigned char tsc_marked_unstable; static unsigned char tsc_marked_unstable;
static unsigned char lapic_detected_unstable;
static unsigned char lapic_marked_unstable;
static void power_saving_mwait_init(void) static void power_saving_mwait_init(void)
{ {
...@@ -75,9 +77,6 @@ static void power_saving_mwait_init(void) ...@@ -75,9 +77,6 @@ static void power_saving_mwait_init(void)
power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
(highest_subcstate - 1); (highest_subcstate - 1);
for_each_online_cpu(i)
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &i);
#if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) #if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86)
switch (boot_cpu_data.x86_vendor) { switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_AMD: case X86_VENDOR_AMD:
...@@ -86,13 +85,15 @@ static void power_saving_mwait_init(void) ...@@ -86,13 +85,15 @@ static void power_saving_mwait_init(void)
* AMD Fam10h TSC will tick in all * AMD Fam10h TSC will tick in all
* C/P/S0/S1 states when this bit is set. * C/P/S0/S1 states when this bit is set.
*/ */
if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
return; tsc_detected_unstable = 1;
if (!boot_cpu_has(X86_FEATURE_ARAT))
/*FALL THROUGH*/ lapic_detected_unstable = 1;
break;
default: default:
/* TSC could halt in idle */ /* TSC & LAPIC could halt in idle */
tsc_detected_unstable = 1; tsc_detected_unstable = 1;
lapic_detected_unstable = 1;
} }
#endif #endif
} }
...@@ -180,10 +181,20 @@ static int power_saving_thread(void *data) ...@@ -180,10 +181,20 @@ static int power_saving_thread(void *data)
mark_tsc_unstable("TSC halts in idle"); mark_tsc_unstable("TSC halts in idle");
tsc_marked_unstable = 1; tsc_marked_unstable = 1;
} }
if (lapic_detected_unstable && !lapic_marked_unstable) {
int i;
/* LAPIC could halt in idle, so notify users */
for_each_online_cpu(i)
clockevents_notify(
CLOCK_EVT_NOTIFY_BROADCAST_ON,
&i);
lapic_marked_unstable = 1;
}
local_irq_disable(); local_irq_disable();
cpu = smp_processor_id(); cpu = smp_processor_id();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, if (lapic_marked_unstable)
&cpu); clockevents_notify(
CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
stop_critical_timings(); stop_critical_timings();
__monitor((void *)&current_thread_info()->flags, 0, 0); __monitor((void *)&current_thread_info()->flags, 0, 0);
...@@ -192,8 +203,9 @@ static int power_saving_thread(void *data) ...@@ -192,8 +203,9 @@ static int power_saving_thread(void *data)
__mwait(power_saving_mwait_eax, 1); __mwait(power_saving_mwait_eax, 1);
start_critical_timings(); start_critical_timings();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, if (lapic_marked_unstable)
&cpu); clockevents_notify(
CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
local_irq_enable(); local_irq_enable();
if (jiffies > expire_time) { if (jiffies > expire_time) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment