Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6240355pxb; Tue, 16 Feb 2021 22:05:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTHUAWiYohNVlMN6B1ZtmLI21IC+gGbl0zdZl28BoWPZc2iIa9uPbcNpUpVGldZx8SGhRq X-Received: by 2002:a17:906:b082:: with SMTP id x2mr23049028ejy.100.1613541958503; Tue, 16 Feb 2021 22:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613541958; cv=none; d=google.com; s=arc-20160816; b=ORtoam4Reaq64kBk1IptQUOvAIQskeAaiAxMnLzrST2KuZWXSWZLjHS+xlsh1m5TiV MkKVPobTpgT4gc8FejhsO1F39aV6U7NnZoOD2migf6dngXT6Ujb3thNzJYMuDOJhSgKf dqRI2Snu6Z8HvMTxWSUp0K9ziV6uMqq3yeodPXH3VAFwYIGWcQEmZLc/RFIu9914uIhc mmE7Q3j4Sap5OoW28FKlR55RNF8hpKazsmHyO9V+VFz7+B6LgWnLePbJCVfwCB6/oT1W MrDl+pB9q/mZzDPRphvEEzjPVXANts2E6zckaKzy27xEF67zFpIXfR6l4pLPEQlIpmw/ Hkng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=emQXPuqsgdPSuXYNHs0efrSNIkqWhGSVKDhTTdUubPU=; b=KxdMJxcJDi9a20njOsyq0k85DkUbzB4wE5z013LdeUEkO/Xd0jnFDAycn9bdQslunz UDzijM0h91Ktn75XDTQMWOj77CpqpzFx+ZUzrSDSF4DRiirNFOmd6iMzk5jbzbid/xLN oW0hp3Mkbplrx2tDerQNvYfpI2lAio5+uNghNTQdE6zdwvw3uKglK0rJMD6OUS9yGCFi 0ZRxDMENN5mt85kKyAySNp/mu1RZfGtbrc1Q96fuoDxQXYK9sOQI6C3Z9XystYQJSZU3 PwsX8IKS+FbNogNyg4pygKwQVUvuj8nOAxDgO3IHW0LkDzpdgUeWPXkd9Qq6xO2GGu/j eb/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UM0W1ERO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si643268edy.569.2021.02.16.22.05.21; Tue, 16 Feb 2021 22:05:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UM0W1ERO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbhBQFtu (ORCPT + 99 others); Wed, 17 Feb 2021 00:49:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbhBQFtq (ORCPT ); Wed, 17 Feb 2021 00:49:46 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1BEEC061756 for ; Tue, 16 Feb 2021 21:49:06 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id f8so5256860plg.5 for ; Tue, 16 Feb 2021 21:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=emQXPuqsgdPSuXYNHs0efrSNIkqWhGSVKDhTTdUubPU=; b=UM0W1EROsKnnez2p5z5LslvgyTFdH1bXFYB4C/W/MIWfs5sSfuIwm/WsNV3THSjkC8 q08/e7CU00IjvLsa0Um4TNuhC2WI35K1v8PDQZoHRiWwA+SQV0hDiY61WRMG5swjNemb vOeuf8GHA0oSeQxmkCgWUXrH7Ow2l3icXf85rNkRJ2gvSk4YQT8IopwzMZBWEbiZnPas V5uampE4auaSsVj3MrM8bO5JzeQhsmJMCgNQuqcG+9gsMSxjap/t3SUBA3+VwonfJXzq 93E9Uq+D0fCW/2rauj5/kmF4o8Ois6HGwreVALPqYGj/fpvET1YZyP8nejLOsnEGBTDb 2MXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=emQXPuqsgdPSuXYNHs0efrSNIkqWhGSVKDhTTdUubPU=; b=eZxrdStWBmSswig3AUzfB3+aKOHuEGEt6D898zC6xyyYcWIU0jUlFdo0RD5PxiSS0i sTl7T18VZ10OjHai4EGlpTNSFn6VK6CWbLbI3hxZGZijhjV+v7BMLXy6dRPpHWtykvEF Xx0ZUWOpfr+zWwpPrClbi5+EymdwuPQkW1QuVoDKDwNP5gi+m+HCyxCdb2YxiGWVWHch YH4ByOSBty0MhI1IJ4YaszxIxNZlz49CLlvd8Y4R58jtABLO4JLJ9O1xkXgZPZ1/TMyF BFzWNEqBwlezgfrKzwS7g4mUpQqP+xiCa26alck+6l+LtgRrzT0u+eUKUza8w9pY0UQy B5jQ== X-Gm-Message-State: AOAM533K2XMCgTV3KQZQgvd9E2rILz8Re7GFD3hdZRgsU7/36za/0uz8 aodYvOan8hM1nU+BgRDRg4NJRg== X-Received: by 2002:a17:90a:ac09:: with SMTP id o9mr7946027pjq.191.1613540946178; Tue, 16 Feb 2021 21:49:06 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id j22sm803460pff.57.2021.02.16.21.49.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Feb 2021 21:49:05 -0800 (PST) From: Viresh Kumar To: Amit Daniel Kachhap , Daniel Lezcano , Viresh Kumar , Javi Merino , Zhang Rui , Amit Kucheria , "Peter Zijlstra (Intel)" , Ingo Molnar , Thara Gopinath Cc: Vincent Guittot , "v5 . 7+" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error Date: Wed, 17 Feb 2021 11:18:58 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org freq_qos_update_request() returns 1 if the effective constraint value has changed, 0 if the effective constraint value has not changed, or a negative error code on failures. The frequency constraints for CPUs can be set by different parts of the kernel. If the maximum frequency constraint set by other parts of the kernel are set at a lower value than the one corresponding to cooling state 0, then we will never be able to cool down the system as freq_qos_update_request() will keep on returning 0 and we will skip updating cpufreq_state and thermal pressure. Fix that by doing the updates even in the case where freq_qos_update_request() returns 0, as we have effectively set the constraint to a new value even if the consolidated value of the actual constraint is unchanged because of external factors. Cc: v5.7+ # v5.7+ Reported-by: Thara Gopinath Fixes: f12e4f66ab6a ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping") Signed-off-by: Viresh Kumar --- Hi Guys, This needs to go in 5.12-rc. Thara, please give this a try and give your tested-by :). drivers/thermal/cpufreq_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c index f5af2571f9b7..10af3341e5ea 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -485,7 +485,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, frequency = get_state_freq(cpufreq_cdev, state); ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); - if (ret > 0) { + if (ret >= 0) { cpufreq_cdev->cpufreq_state = state; cpus = cpufreq_cdev->policy->cpus; max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus)); -- 2.25.0.rc1.19.g042ed3e048af