diff options
Diffstat (limited to 'drivers/acpi/acpi_pad.c')
| -rw-r--r-- | drivers/acpi/acpi_pad.c | 48 | 
1 files changed, 19 insertions, 29 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index fc6008fbce3..f148a0580e0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -28,8 +28,7 @@  #include <linux/cpu.h>  #include <linux/clockchips.h>  #include <linux/slab.h> -#include <acpi/acpi_bus.h> -#include <acpi/acpi_drivers.h> +#include <linux/acpi.h>  #include <asm/mwait.h>  #define ACPI_PROCESSOR_AGGREGATOR_CLASS	"acpi_pad" @@ -157,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);  		} @@ -193,10 +193,7 @@ static int power_saving_thread(void *data)  					CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);  			stop_critical_timings(); -			__monitor((void *)¤t_thread_info()->flags, 0, 0); -			smp_mb(); -			if (!need_resched()) -				__mwait(power_saving_mwait_eax, 1); +			mwait_idle_with_hints(power_saving_mwait_eax, 1);  			start_critical_timings();  			if (lapic_marked_unstable) @@ -204,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;  			} @@ -219,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); @@ -412,28 +416,14 @@ static int acpi_pad_pur(acpi_handle handle)  	return num;  } -/* Notify firmware how many CPUs are idle */ -static void acpi_pad_ost(acpi_handle handle, int stat, -	uint32_t idle_cpus) -{ -	union acpi_object params[3] = { -		{.type = ACPI_TYPE_INTEGER,}, -		{.type = ACPI_TYPE_INTEGER,}, -		{.type = ACPI_TYPE_BUFFER,}, -	}; -	struct acpi_object_list arg_list = {3, params}; - -	params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY; -	params[1].integer.value =  stat; -	params[2].buffer.length = 4; -	params[2].buffer.pointer = (void *)&idle_cpus; -	acpi_evaluate_object(handle, "_OST", &arg_list, NULL); -} -  static void acpi_pad_handle_notify(acpi_handle handle)  {  	int num_cpus;  	uint32_t idle_cpus; +	struct acpi_buffer param = { +		.length = 4, +		.pointer = (void *)&idle_cpus, +	};  	mutex_lock(&isolated_cpus_lock);  	num_cpus = acpi_pad_pur(handle); @@ -443,7 +433,7 @@ static void acpi_pad_handle_notify(acpi_handle handle)  	}  	acpi_pad_idle_cpus(num_cpus);  	idle_cpus = acpi_pad_idle_cpus_num(); -	acpi_pad_ost(handle, 0, idle_cpus); +	acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, ¶m);  	mutex_unlock(&isolated_cpus_lock);  }  | 
