Skip to content

Commit 05ff1ba

Browse files
committed
PM: QoS: Invalidate frequency QoS requests after removal
Switching cpufreq drivers (or switching operation modes of the intel_pstate driver from "active" to "passive" and vice versa) does not work on some x86 systems with ACPI after commit 3000ce3 ("cpufreq: Use per-policy frequency QoS"), because the ACPI _PPC and thermal code uses the same frequency QoS request object for a given CPU every time a cpufreq driver is registered and freq_qos_remove_request() does not invalidate the request after removing it from its QoS list, so freq_qos_add_request() complains and fails when that request is passed to it again. Fix the issue by modifying freq_qos_remove_request() to clear the qos and type fields of the frequency request pointed to by its argument after removing it from its QoS list so as to invalidate it. Fixes: 3000ce3 ("cpufreq: Use per-policy frequency QoS") Reported-and-tested-by: Doug Smythies <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Viresh Kumar <[email protected]>
1 parent af42d34 commit 05ff1ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/power/qos.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,14 +814,20 @@ EXPORT_SYMBOL_GPL(freq_qos_update_request);
814814
*/
815815
int freq_qos_remove_request(struct freq_qos_request *req)
816816
{
817+
int ret;
818+
817819
if (!req)
818820
return -EINVAL;
819821

820822
if (WARN(!freq_qos_request_active(req),
821823
"%s() called for unknown object\n", __func__))
822824
return -EINVAL;
823825

824-
return freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
826+
ret = freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
827+
req->qos = NULL;
828+
req->type = 0;
829+
830+
return ret;
825831
}
826832
EXPORT_SYMBOL_GPL(freq_qos_remove_request);
827833

0 commit comments

Comments
 (0)