diff options
| author | Mark Gross <mgross@linux.intel.com> | 2010-05-05 19:59:26 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-05-10 17:08:19 -0400 |
| commit | ed77134bfccf5e75b6cbadab268e559dbe6a4ebb (patch) | |
| tree | dae087a617ab3d9af8673d1905dbca3bcd57e89e | |
| parent | 0fef8b1e83c4ab08cf1304dbebcfd749caf4f187 (diff) | |
PM QOS update
This patch changes the string based list management to a handle base
implementation to help with the hot path use of pm-qos, it also renames
much of the API to use "request" as opposed to "requirement" that was
used in the initial implementation. I did this because request more
accurately represents what it actually does.
Also, I added a string based ABI for users wanting to use a string
interface. So if the user writes 0xDDDDDDDD formatted hex it will be
accepted by the interface. (someone asked me for it and I don't think
it hurts anything.)
This patch updates some documentation input I got from Randy.
Signed-off-by: markgross <mgross@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
| -rw-r--r-- | Documentation/power/pm_qos_interface.txt | 48 | ||||
| -rw-r--r-- | drivers/acpi/processor_idle.c | 2 | ||||
| -rw-r--r-- | drivers/cpuidle/governors/ladder.c | 2 | ||||
| -rw-r--r-- | drivers/cpuidle/governors/menu.c | 2 | ||||
| -rw-r--r-- | drivers/net/e1000e/netdev.c | 22 | ||||
| -rw-r--r-- | drivers/net/igbvf/netdev.c | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2x00/ipw2100.c | 11 | ||||
| -rw-r--r-- | include/linux/netdevice.h | 4 | ||||
| -rw-r--r-- | include/linux/pm_qos_params.h | 14 | ||||
| -rw-r--r-- | include/sound/pcm.h | 3 | ||||
| -rw-r--r-- | kernel/pm_qos_params.c | 214 | ||||
| -rw-r--r-- | net/mac80211/mlme.c | 2 | ||||
| -rw-r--r-- | sound/core/pcm.c | 3 | ||||
| -rw-r--r-- | sound/core/pcm_native.c | 14 |
14 files changed, 176 insertions, 171 deletions
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index c40866e8b957..bfed898a03fc 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
| @@ -18,44 +18,46 @@ and pm_qos_params.h. This is done because having the available parameters | |||
| 18 | being runtime configurable or changeable from a driver was seen as too easy to | 18 | being runtime configurable or changeable from a driver was seen as too easy to |
| 19 | abuse. | 19 | abuse. |
| 20 | 20 | ||
| 21 | For each parameter a list of performance requirements is maintained along with | 21 | For each parameter a list of performance requests is maintained along with |
| 22 | an aggregated target value. The aggregated target value is updated with | 22 | an aggregated target value. The aggregated target value is updated with |
| 23 | changes to the requirement list or elements of the list. Typically the | 23 | changes to the request list or elements of the list. Typically the |
| 24 | aggregated target value is simply the max or min of the requirement values held | 24 | aggregated target value is simply the max or min of the request values held |
| 25 | in the parameter list elements. | 25 | in the parameter list elements. |
| 26 | 26 | ||
| 27 | From kernel mode the use of this interface is simple: | 27 | From kernel mode the use of this interface is simple: |
| 28 | pm_qos_add_requirement(param_id, name, target_value): | ||
| 29 | Will insert a named element in the list for that identified PM_QOS parameter | ||
| 30 | with the target value. Upon change to this list the new target is recomputed | ||
| 31 | and any registered notifiers are called only if the target value is now | ||
| 32 | different. | ||
| 33 | 28 | ||
| 34 | pm_qos_update_requirement(param_id, name, new_target_value): | 29 | handle = pm_qos_add_request(param_class, target_value): |
| 35 | Will search the list identified by the param_id for the named list element and | 30 | Will insert an element into the list for that identified PM_QOS class with the |
| 36 | then update its target value, calling the notification tree if the aggregated | 31 | target value. Upon change to this list the new target is recomputed and any |
| 37 | target is changed. with that name is already registered. | 32 | registered notifiers are called only if the target value is now different. |
| 33 | Clients of pm_qos need to save the returned handle. | ||
| 38 | 34 | ||
| 39 | pm_qos_remove_requirement(param_id, name): | 35 | void pm_qos_update_request(handle, new_target_value): |
| 40 | Will search the identified list for the named element and remove it, after | 36 | Will update the list element pointed to by the handle with the new target value |
| 41 | removal it will update the aggregate target and call the notification tree if | 37 | and recompute the new aggregated target, calling the notification tree if the |
| 42 | the target was changed as a result of removing the named requirement. | 38 | target is changed. |
| 39 | |||
| 40 | void pm_qos_remove_request(handle): | ||
| 41 | Will remove the element. After removal it will update the aggregate target and | ||
| 42 | call the notification tree if the target was changed as a result of removing | ||
| 43 | the request. | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | From user mode: | 46 | From user mode: |
| 46 | Only processes can register a pm_qos requirement. To provide for automatic | 47 | Only processes can register a pm_qos request. To provide for automatic |
| 47 | cleanup for process the interface requires the process to register its | 48 | cleanup of a process, the interface requires the process to register its |
| 48 | parameter requirements in the following way: | 49 | parameter requests in the following way: |
| 49 | 50 | ||
| 50 | To register the default pm_qos target for the specific parameter, the process | 51 | To register the default pm_qos target for the specific parameter, the process |
| 51 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] | 52 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] |
| 52 | 53 | ||
| 53 | As long as the device node is held open that process has a registered | 54 | As long as the device node is held open that process has a registered |
| 54 | requirement on the parameter. The name of the requirement is "process_<PID>" | 55 | request on the parameter. |
| 55 | derived from the current->pid from within the open system call. | ||
| 56 | 56 | ||
| 57 | To change the requested target value the process needs to write a s32 value to | 57 | To change the requested target value the process needs to write an s32 value to |
| 58 | the open device node. This translates to a pm_qos_update_requirement call. | 58 | the open device node. Alternatively the user mode program could write a hex |
| 59 | string for the value using 10 char long format e.g. "0x12345678". This | ||
| 60 | translates to a pm_qos_update_request call. | ||
| 59 | 61 | ||
| 60 | To remove the user mode request for a target value simply close the device | 62 | To remove the user mode request for a target value simply close the device |
| 61 | node. | 63 | node. |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5939e7f7d8e9..c3817e1f32c7 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -698,7 +698,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
| 698 | "max_cstate: C%d\n" | 698 | "max_cstate: C%d\n" |
| 699 | "maximum allowed latency: %d usec\n", | 699 | "maximum allowed latency: %d usec\n", |
| 700 | pr->power.state ? pr->power.state - pr->power.states : 0, | 700 | pr->power.state ? pr->power.state - pr->power.states : 0, |
| 701 | max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); | 701 | max_cstate, pm_qos_request(PM_QOS_CPU_DMA_LATENCY)); |
| 702 | 702 | ||
| 703 | seq_puts(seq, "states:\n"); | 703 | seq_puts(seq, "states:\n"); |
| 704 | 704 | ||
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 1c1ceb4f218f..12c98900dcf8 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c | |||
| @@ -67,7 +67,7 @@ static int ladder_select_state(struct cpuidle_device *dev) | |||
| 67 | struct ladder_device *ldev = &__get_cpu_var(ladder_devices); | 67 | struct ladder_device *ldev = &__get_cpu_var(ladder_devices); |
| 68 | struct ladder_device_state *last_state; | 68 | struct ladder_device_state *last_state; |
| 69 | int last_residency, last_idx = ldev->last_state_idx; | 69 | int last_residency, last_idx = ldev->last_state_idx; |
| 70 | int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY); | 70 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); |
| 71 | 71 | ||
| 72 | /* Special case when user has set very strict latency requirement */ | 72 | /* Special case when user has set very strict latency requirement */ |
| 73 | if (unlikely(latency_req == 0)) { | 73 | if (unlikely(latency_req == 0)) { |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index f8e57c6303f2..b81ad9c731ae 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
| @@ -182,7 +182,7 @@ static u64 div_round64(u64 dividend, u32 divisor) | |||
| 182 | static int menu_select(struct cpuidle_device *dev) | 182 | static int menu_select(struct cpuidle_device *dev) |
| 183 | { | 183 | { |
| 184 | struct menu_device *data = &__get_cpu_var(menu_devices); | 184 | struct menu_device *data = &__get_cpu_var(menu_devices); |
| 185 | int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY); | 185 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); |
| 186 | int i; | 186 | int i; |
| 187 | int multiplier; | 187 | int multiplier; |
| 188 | 188 | ||
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index dbf81788bb40..d5d55c6a373f 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
| @@ -2524,12 +2524,12 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
| 2524 | * excessive C-state transition latencies result in | 2524 | * excessive C-state transition latencies result in |
| 2525 | * dropped transactions. | 2525 | * dropped transactions. |
| 2526 | */ | 2526 | */ |
| 2527 | pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, | 2527 | pm_qos_update_request( |
| 2528 | adapter->netdev->name, 55); | 2528 | adapter->netdev->pm_qos_req, 55); |
| 2529 | } else { | 2529 | } else { |
| 2530 | pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, | 2530 | pm_qos_update_request( |
| 2531 | adapter->netdev->name, | 2531 | adapter->netdev->pm_qos_req, |
| 2532 | PM_QOS_DEFAULT_VALUE); | 2532 | PM_QOS_DEFAULT_VALUE); |
| 2533 | } | 2533 | } |
| 2534 | } | 2534 | } |
| 2535 | 2535 | ||
| @@ -2824,8 +2824,8 @@ int e1000e_up(struct e1000_adapter *adapter) | |||
| 2824 | 2824 | ||
| 2825 | /* DMA latency requirement to workaround early-receive/jumbo issue */ | 2825 | /* DMA latency requirement to workaround early-receive/jumbo issue */ |
| 2826 | if (adapter->flags & FLAG_HAS_ERT) | 2826 | if (adapter->flags & FLAG_HAS_ERT) |
| 2827 | pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, | 2827 | adapter->netdev->pm_qos_req = |
| 2828 | adapter->netdev->name, | 2828 | pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY, |
| 2829 | PM_QOS_DEFAULT_VALUE); | 2829 | PM_QOS_DEFAULT_VALUE); |
| 2830 | 2830 | ||
| 2831 | /* hardware has been reset, we need to reload some things */ | 2831 | /* hardware has been reset, we need to reload some things */ |
| @@ -2887,9 +2887,11 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
| 2887 | e1000_clean_tx_ring(adapter); | 2887 | e1000_clean_tx_ring(adapter); |
| 2888 | e1000_clean_rx_ring(adapter); | 2888 | e1000_clean_rx_ring |
