Commit 26f8784e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-processor' and 'acpi-pad'

* acpi-processor:
  ACPI / processor: Fix STARTING/DYING action in acpi_cpu_soft_notify()
  ACPI / processor: Check if LAPIC is present during initialization
  ACPI / ia64: introduce variable acpi_lapic into ia64

* acpi-pad:
  ACPI / PAD: Use time_before() for time comparison
  ACPI / PAD: call schedule() when need_resched() is true
...@@ -85,6 +85,7 @@ ia64_acpi_release_global_lock (unsigned int *lock) ...@@ -85,6 +85,7 @@ ia64_acpi_release_global_lock (unsigned int *lock)
((Acq) = ia64_acpi_release_global_lock(&facs->global_lock)) ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
extern int acpi_lapic;
#define acpi_disabled 0 /* ACPI always enabled on IA64 */ #define acpi_disabled 0 /* ACPI always enabled on IA64 */
#define acpi_noirq 0 /* ACPI always enabled on IA64 */ #define acpi_noirq 0 /* ACPI always enabled on IA64 */
#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */ #define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#define PREFIX "ACPI: " #define PREFIX "ACPI: "
int acpi_lapic;
unsigned int acpi_cpei_override; unsigned int acpi_cpei_override;
unsigned int acpi_cpei_phys_cpuid; unsigned int acpi_cpei_phys_cpuid;
...@@ -676,6 +677,8 @@ int __init early_acpi_boot_init(void) ...@@ -676,6 +677,8 @@ int __init early_acpi_boot_init(void)
if (ret < 1) if (ret < 1)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing MADT - no LAPIC entries\n"); "Error parsing MADT - no LAPIC entries\n");
else
acpi_lapic = 1;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (available_cpus == 0) { if (available_cpus == 0) {
......
...@@ -156,12 +156,13 @@ static int power_saving_thread(void *data) ...@@ -156,12 +156,13 @@ static int power_saving_thread(void *data)
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
int cpu; int cpu;
u64 expire_time; unsigned long expire_time;
try_to_freeze(); try_to_freeze();
/* round robin to cpus */ /* round robin to cpus */
if (last_jiffies + round_robin_time * HZ < jiffies) { expire_time = last_jiffies + round_robin_time * HZ;
if (time_before(expire_time, jiffies)) {
last_jiffies = jiffies; last_jiffies = jiffies;
round_robin_cpu(tsk_index); round_robin_cpu(tsk_index);
} }
...@@ -200,7 +201,7 @@ static int power_saving_thread(void *data) ...@@ -200,7 +201,7 @@ static int power_saving_thread(void *data)
CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
local_irq_enable(); local_irq_enable();
if (jiffies > expire_time) { if (time_before(expire_time, jiffies)) {
do_sleep = 1; do_sleep = 1;
break; break;
} }
...@@ -215,8 +216,15 @@ static int power_saving_thread(void *data) ...@@ -215,8 +216,15 @@ static int power_saving_thread(void *data)
* borrow CPU time from this CPU and cause RT task use > 95% * borrow CPU time from this CPU and cause RT task use > 95%
* CPU time. To make 'avoid starvation' work, takes a nap here. * CPU time. To make 'avoid starvation' work, takes a nap here.
*/ */
if (do_sleep) if (unlikely(do_sleep))
schedule_timeout_killable(HZ * idle_pct / 100); schedule_timeout_killable(HZ * idle_pct / 100);
/* If an external event has set the need_resched flag, then
* we need to deal with it, or this loop will continue to
* spin without calling __mwait().
*/
if (unlikely(need_resched()))
schedule();
} }
exit_round_robin(tsk_index); exit_round_robin(tsk_index);
......
...@@ -268,7 +268,7 @@ static int acpi_processor_get_info(struct acpi_device *device) ...@@ -268,7 +268,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
pr->apic_id = apic_id; pr->apic_id = apic_id;
cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
if (!cpu0_initialized) { if (!cpu0_initialized && !acpi_lapic) {
cpu0_initialized = 1; cpu0_initialized = 1;
/* Handle UP system running SMP kernel, with no LAPIC in MADT */ /* Handle UP system running SMP kernel, with no LAPIC in MADT */
if ((cpu_index == -1) && (num_online_cpus() == 1)) if ((cpu_index == -1) && (num_online_cpus() == 1))
......
...@@ -121,6 +121,13 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb, ...@@ -121,6 +121,13 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
struct acpi_processor *pr = per_cpu(processors, cpu); struct acpi_processor *pr = per_cpu(processors, cpu);
struct acpi_device *device; struct acpi_device *device;
/*
* CPU_STARTING and CPU_DYING must not sleep. Return here since
* acpi_bus_get_device() may sleep.
*/
if (action == CPU_STARTING || action == CPU_DYING)
return NOTIFY_DONE;
if (!pr || acpi_bus_get_device(pr->handle, &device)) if (!pr || acpi_bus_get_device(pr->handle, &device))
return NOTIFY_DONE; return NOTIFY_DONE;
......
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