Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230928
b: refs/heads/master
c: 5a344a5
h: refs/heads/master
v: v3
  • Loading branch information
Zhao Yakui authored and Len Brown committed Jan 10, 2011
1 parent 088ee41 commit cd9ce95
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: daef1f35ea1e2cca125eecd5f078f40b55eb9105
refs/heads/master: 5a344a505093dd65f82f338ffdb7208321b3630e
5 changes: 5 additions & 0 deletions trunk/drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,13 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
if (action == CPU_ONLINE && pr) {
acpi_processor_ppc_has_changed(pr, 0);
acpi_processor_cst_has_changed(pr);
acpi_processor_reevaluate_tstate(pr, action);
acpi_processor_tstate_has_changed(pr);
}
if (action == CPU_DEAD && pr) {
/* invalidate the flag.throttling after one CPU is offline */
acpi_processor_reevaluate_tstate(pr, action);
}
return NOTIFY_OK;
}

Expand Down
52 changes: 52 additions & 0 deletions trunk/drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,58 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
return acpi_processor_set_throttling(pr, target_state, false);
}

/*
* This function is used to reevaluate whether the T-state is valid
* after one CPU is onlined/offlined.
* It is noted that it won't reevaluate the following properties for
* the T-state.
* 1. Control method.
* 2. the number of supported T-state
* 3. TSD domain
*/
void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
unsigned long action)
{
int result = 0;

if (action == CPU_DEAD) {
/* When one CPU is offline, the T-state throttling
* will be invalidated.
*/
pr->flags.throttling = 0;
return;
}
/* the following is to recheck whether the T-state is valid for
* the online CPU
*/
if (!pr->throttling.state_count) {
/* If the number of T-state is invalid, it is
* invalidated.
*/
pr->flags.throttling = 0;
return;
}
pr->flags.throttling = 1;

/* Disable throttling (if enabled). We'll let subsequent
* policy (e.g.thermal) decide to lower performance if it
* so chooses, but for now we'll crank up the speed.
*/

result = acpi_processor_get_throttling(pr);
if (result)
goto end;

if (pr->throttling.state) {
result = acpi_processor_set_throttling(pr, 0, false);
if (result)
goto end;
}

end:
if (result)
pr->flags.throttling = 0;
}
/*
* _PTC - Processor Throttling Control (and status) register location
*/
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/acpi/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
int acpi_processor_get_throttling_info(struct acpi_processor *pr);
extern int acpi_processor_set_throttling(struct acpi_processor *pr,
int state, bool force);
/*
* Reevaluate whether the T-state is invalid after one cpu is
* onlined/offlined. In such case the flags.throttling will be updated.
*/
extern void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
unsigned long action);
extern const struct file_operations acpi_processor_throttling_fops;
extern void acpi_processor_throttling_init(void);
/* in processor_idle.c */
Expand Down

0 comments on commit cd9ce95

Please sign in to comment.