Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6563056pxb; Wed, 17 Feb 2021 07:41:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc93cSc/6elF4GMzL/xtpRNW6nNcTAo/JdbTQbdOqhvEfptUYd5JAAdU3fsFkUcSC2Nn7Q X-Received: by 2002:a17:906:2803:: with SMTP id r3mr11556590ejc.50.1613576468304; Wed, 17 Feb 2021 07:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613576468; cv=none; d=google.com; s=arc-20160816; b=XATdsWbzIb+7wATByMQeGrvZ0OM7HxMgO+XmvjfUhTCk1G2z1W4SRuyxWpdhdbTeBo FXaL2qk8FsMHyf7eh/gKESjrZWDmZBRiC0Z6zlpVBcUEVrtka6iDQo+66DwWueNERyDB Rwm4Y8BTTnAnjCFAb7JW2+hyFJqO0lt8wLgEKwEmxXLOQL24VH0SvePliV5Y6iZlXiZf wcxz+aYZkFG9/vjMojC5iM6IiKsBe5brI7EGCISCl8furaIh4M0hu9+LK0DyhL/no4QN uaQ+wmwn0sMi86Vtd2SqKC8ZyDem6ChBo8aBtStfmVIEmc5sfbS6mFi8rgQEQ7+uJCkL dsqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=XRJ+49TR+P9xR+Yv/N5YNz5Xe+uRVUn68R2bZSbodzQ=; b=v+p5stBV+BprMFzCfYPKyM4BXKRoddnaNOBaf5T49CHVOdR7PicEWnmxbDs7Kr3532 pnx/GZPIS5ebjz+BEoo7D0gCf5Bv05UJSMKLFgR8f+s5PtRKG/rSDSHofUGExzy/mrtk KM5svm5KwATCni2aJlmmHTRhm6n+tLOc6hgpRcj9K41iP/OKVsLrl8BazOuC49vREnOm yNl97QBCgHGHwsSwyiysbyZDvfryVXbuO4KdWb9WcaaJ+IBxL1SudDEohgVS5z0KT/s3 goUoVqMkuCbji0JwqoiOOjUYPNF91+gBRNcBchYXBFJP/UesFobB6/JpzyndG/syOGFD GBEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+F9VmpO; 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 va17si1832088ejb.2.2021.02.17.07.40.43; Wed, 17 Feb 2021 07:41:08 -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=i+F9VmpO; 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 S233739AbhBQPjZ (ORCPT + 99 others); Wed, 17 Feb 2021 10:39:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233795AbhBQPjT (ORCPT ); Wed, 17 Feb 2021 10:39:19 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77ABDC0613D6 for ; Wed, 17 Feb 2021 07:38:38 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id v206so13128172qkb.3 for ; Wed, 17 Feb 2021 07:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XRJ+49TR+P9xR+Yv/N5YNz5Xe+uRVUn68R2bZSbodzQ=; b=i+F9VmpOBxKQqz8SyUGCrE1A9zkcBw8vEiEfn6bWK2F/JEyUyqpignvI8EhPLwJ/JW fg3mHsoPjP1vUxzi/cmDzUVAuJSOmtpH0AFYIVH7MlrUgtrQlyRQLta/89k7RY/CPfSs 7rUOiMU/nuq+bmaRgBy8v68//dBh4UjBU2BCdpiEuF0r7FuP8A7I7ok8JfooEBjFkpzq 94vn9DmpPXoSK14ONJKHWroDT/QsfvzIkjTK73BBmuObxg3BpzJqsfHuqNgPMy7cIcew OnLW/d5mKw5Ix7aoXY9qCqJkLM0mIlJXdwA1FHnB5UDyHf2bIJSALhhIdyouhuUDUXfH szew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XRJ+49TR+P9xR+Yv/N5YNz5Xe+uRVUn68R2bZSbodzQ=; b=AnuQ0Uhk5nXEJMJKCMlEuZ6c70he6kQYpjSICG4Ptd9NL7APwe4hYZODTUe57BQhS3 OHgWJzJL3b/+dKTEklIAKW6pwARD+JsXZLlUNyum3UW0/sL/AkN8sircvlkCsL2LHVfd eEnkIPF0a0YA82yC+ytL5CtwVkwG77tb0a2KfKbJCSABXyF9i9RXX66NTHNY5Ovqi5iP Ss0J30xTUsOzfE/HST/mhHfDkYmNBEXRUTuVOiWTeIJcMKZSLDkbas3+zEmQWYstY5jr AN2wjsmVezNbsgBNoB7wTMGvaZh3vvgngbIdqf7dBKChvxe4xpeuX76EjXzuf0Ut29ty TQdQ== X-Gm-Message-State: AOAM532i5d3G+ruJjV4Nqf0GuNPUZ5ToWmNU6yMLvkH4cRX8ajxD1JAJ PxE0EAQsr/N44vuU1ixWfjQf7ND0+77krg== X-Received: by 2002:ae9:e90c:: with SMTP id x12mr15897393qkf.498.1613576317376; Wed, 17 Feb 2021 07:38:37 -0800 (PST) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id h186sm1766262qke.129.2021.02.17.07.38.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 07:38:36 -0800 (PST) Subject: Re: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error To: Viresh Kumar , Amit Daniel Kachhap , Daniel Lezcano , Javi Merino , Zhang Rui , Amit Kucheria , "Peter Zijlstra (Intel)" , Ingo Molnar Cc: Vincent Guittot , "v5 . 7+" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Thara Gopinath Message-ID: Date: Wed, 17 Feb 2021 10:38:36 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/21 12:48 AM, Viresh Kumar wrote: > 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 :). It fixes the thermal runaway issue on sdm845 that I had reported. So, Tested-by: Thara Gopinath > > 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)); > -- Warm Regards Thara