Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Merge branches 'acpi-processor' and 'acpi-pad'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rafaeljw committed Jun 3, 2014
3 parents 4db367f + 8da8373 + 4ff248f commit 26f8784
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions arch/ia64/include/asm/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ia64_acpi_release_global_lock (unsigned int *lock)
((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))

#ifdef CONFIG_ACPI
extern int acpi_lapic;
#define acpi_disabled 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 */
Expand Down
3 changes: 3 additions & 0 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

#define PREFIX "ACPI: "

int acpi_lapic;
unsigned int acpi_cpei_override;
unsigned int acpi_cpei_phys_cpuid;

Expand Down Expand Up @@ -676,6 +677,8 @@ int __init early_acpi_boot_init(void)
if (ret < 1)
printk(KERN_ERR PREFIX
"Error parsing MADT - no LAPIC entries\n");
else
acpi_lapic = 1;

#ifdef CONFIG_SMP
if (available_cpus == 0) {
Expand Down
16 changes: 12 additions & 4 deletions drivers/acpi/acpi_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ static int power_saving_thread(void *data)

while (!kthread_should_stop()) {
int cpu;
u64 expire_time;
unsigned long expire_time;

try_to_freeze();

/* 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;
round_robin_cpu(tsk_index);
}
Expand Down Expand Up @@ -200,7 +201,7 @@ static int power_saving_thread(void *data)
CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
local_irq_enable();

if (jiffies > expire_time) {
if (time_before(expire_time, jiffies)) {
do_sleep = 1;
break;
}
Expand All @@ -215,8 +216,15 @@ static int power_saving_thread(void *data)
* borrow CPU time from this CPU and cause RT task use > 95%
* 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);

/* 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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
pr->apic_id = apic_id;

cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
if (!cpu0_initialized) {
if (!cpu0_initialized && !acpi_lapic) {
cpu0_initialized = 1;
/* Handle UP system running SMP kernel, with no LAPIC in MADT */
if ((cpu_index == -1) && (num_online_cpus() == 1))
Expand Down
7 changes: 7 additions & 0 deletions drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
struct acpi_processor *pr = per_cpu(processors, cpu);
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))
return NOTIFY_DONE;

Expand Down

0 comments on commit 26f8784

Please sign in to comment.