From patchwork Wed Feb 17 05:48:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 383794 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp2531154jao; Tue, 16 Feb 2021 21:49:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJymUzTCOk9CVKR+zsg5LQTQxIUnNNqTmQv+9l6o543sioyZF6kPDCrgC6ohwZQr8u0zBS5b X-Received: by 2002:a05:6402:34c1:: with SMTP id w1mr24975620edc.147.1613540990980; Tue, 16 Feb 2021 21:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613540990; cv=none; d=google.com; s=arc-20160816; b=wnSdsQaYboaH7kSBAtdDsGETJUWFdqB5TdwFSqQTc0F7gRwgFa42CXX/LdP51uS1IR jTm3f/43dDVYPitzg2czjVGTFDW4OKvUNjIVTLIs3YB6cWd0KrBEG7rKrYPLgr+t023t UUR4ybgRSbGRN4W2bTg99fGEpUzYbQux5d71JZqjK0GNQDH5M80DbWU7R9ruxCmrICd0 PUurVpWL5dDJB7UBtNpPdyfiibCfRqx6UbTTljugxXe53/9IpjOl4GEsviUHcxlVLPjM +QdmyHyQXD/42wzBtiBt+WWwMgMHJxpmZbZAqqHAd7tDoFnJk1f310RxKPQgvTuQZWgR P5zQ== 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=upaexaAoXyaGWXIZYzNE37xAjtLEsGCpUFstmNOBcJoET560Z9Ez7iioJgMLu9haFI jbjmEQYC8bixBmxz/DnpCZX3VC7DNlrrQv+cmtWa3x8V0O+jV6yWqAPS00XUkbFTffqu uVskyg/dZ5D8pTm2R/9jxEIfo8k02bvMZ9dCysS80Pd9uXYUjUT75C13PouDopuNIkXi JpMIylZG0KU8Wuz/K28otsdXMTb290oxl0OofrHDYieIaV2kdRoSj5SnQSTcIxxMSLSG aShoGzikDrAi6ZWG/xSuwN2VLh/CXFqt4QR/yuVpqOfkSe50yWl6DdtpEnoVX2lwo7tH NU2Q== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 h15si836006eje.285.2021.02.16.21.49.50; Tue, 16 Feb 2021 21:49:50 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S231150AbhBQFtt (ORCPT + 13 others); Wed, 17 Feb 2021 00:49:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbhBQFtq (ORCPT ); Wed, 17 Feb 2021 00:49:46 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AADBAC061574 for ; Tue, 16 Feb 2021 21:49:06 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id d13so6858789plg.0 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=P5QD9ZzYhSGzyVCri/DxohUn3xB44ZQrXEXVrXKe81nrMIlRmjNqWtM3Ch1XXVIBhK ZYr4LKr7uQchwtNANKjDiWUNuTm3ybQINIdcdq19mHZVkwUiF3sXzHEKTzWesl2FqKsm IWUxwk5sb1fKsHL7DvKwLlHBMpDDtUkDE/RwQtzC51qxuTaJAJ7UPgdqOY2+RpNdohyG vmGND0vWaDbzy4IyxhiGSGUgrf26qX+IjT0s3Wgl0OUvJfIpr/mS9FBIJO0FPOWL/ebq XdBGkpstrHnH8XlQdOL+osCVeIvz19zevWk7zWmIE5xjHdGwcTc8WUPYbTR6sbArLS/2 8rxA== X-Gm-Message-State: AOAM531g1Fzr+7IdskOk8BnulpSJ+ogNUFaV60JZxUS6I5dig5OeuV28 eMEp+WhOlDwXeBhG04nMuCUAWA== 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 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.25.0.rc1.19.g042ed3e048af Reviewed-by: Lukasz Luba Tested-by: Lukasz Luba Reviewed-by: Rafael J. Wysocki Tested-by: Thara Gopinath 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));