Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6371264pxb; Wed, 17 Feb 2021 02:42:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbEIUqL5ZgL4tzQqWXKziJDXGjpF2OZBprD7d5VNwBiFP8UKVVOG58z2EecYhEztc3n2v7 X-Received: by 2002:a17:907:9495:: with SMTP id dm21mr24872986ejc.462.1613558525810; Wed, 17 Feb 2021 02:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613558525; cv=none; d=google.com; s=arc-20160816; b=wahltDnvghzlWLDDzEJhWT00W5doe7pZvcVoKqtHLVihrIbhts2+rHvDxRitWHGFOh Mrw0Y0x2fCONBbomleNB08IsklN0zaHGObPj1KwVzPuesLWPHAOZReeBC+5Z/JgirX0H HfrHSKsxaBfOCmC62zig/dwPMWbUnAnhL6167a42QvJB7WOIVseFEWu1CEPPKbjaBEIR Z3rcu03a7iA96/WgHPF3lxjzZuVl9jvTOsQh4RIUpTUwIaQlgMKc4+/9ICispUml6JfB qeNlt4+wgO/h1RT/0my67e27FRsi8UHWvsagbYi3mM3uJe3LtIC/7MpqSwxw0L9JYUiJ Pt3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=hZFcwR5BRWH+3EYg5+obcKKhiEoxlBBTkBhbZP7VP0Q=; b=lzzRH81/68cgiB1UxHQjHGw4tUKeSSDMSdcRWXwT3Ce/ZwGB2u9zBBXsyzHyT84SkU lJtthukZAZbX6JfOBz2++umiYsqmMVat5SNtEISFwuh5Wc8Duj3g9Gw6xqJJ6+HpC3ND esP0wVY5k9udodpiRfUoWsjUNYfYwa7hs70Tc7I2rSzr/s+MPfklcPu9EsZ7gu9hdeYH /Z4lghZcYjC3p7cYJDD2MtOWCjdk08zzC52/sdKAWVDNGCPAB1g96zhWxt4Zss8qc4rm cMJUhYR/uF6whg//kwpMLjglIEdGsSa/jDG+Hees4F8pySr7WhWLtj4LG27N452DFXkq GuKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E2O+q3qU; 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 dk7si1442785ejb.223.2021.02.17.02.41.42; Wed, 17 Feb 2021 02:42:05 -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=E2O+q3qU; 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 S229722AbhBQKj5 (ORCPT + 99 others); Wed, 17 Feb 2021 05:39:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbhBQKjz (ORCPT ); Wed, 17 Feb 2021 05:39:55 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AB0DC0613D6 for ; Wed, 17 Feb 2021 02:39:14 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id g20so7211941plo.2 for ; Wed, 17 Feb 2021 02:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hZFcwR5BRWH+3EYg5+obcKKhiEoxlBBTkBhbZP7VP0Q=; b=E2O+q3qUGv/vnR2egym99EOzyONntxOQSfwgCiA3Oj3rP579WSkfBMvSI3Ek31ajNn K7nIt5+3YSRFI3Zj+wcL2AdTp7RSz22KlJoNwtDyE8R5E11/zUhoD5Q4B4hwTep4NqqO pTj/qCOyqVy6HfPaYVKR/9oOI0uiRk7UypHtMqPqA43gLFE6zKVudWrpxwetjFs1Kguv /87sPB7Xl/YqYl24I9wOaF1FY91cBOAqbVtZszUnwdUYr+NQH9uOEtvAGDzLAtTX7Yq2 130hgYhljzG4a7C1kpFsbf45vzl92uoXSJ3NbbNRN3Xlbp0tH/mPMYaEBk/G+HKPjsxX 1l7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hZFcwR5BRWH+3EYg5+obcKKhiEoxlBBTkBhbZP7VP0Q=; b=BmfPoNNKic31Fu+TiT1s7o0MDpCiSTBULcT+5eD9fgWz7vxulnhTldpngaASE0ZsB0 uOsqaD1tvc5TKG54b7jq44V9VNdUiaQeI5w94nBF4QiodTWjs9owUlHYR7UkEAbSQl8o h8keLd/urdYMaXzlpMhUaed1eHkCZlaeZ+6KjTCbhuKdy1j6+ZX99PdofZyOUBgI3SJj nmeY5xRp7kS2tNW9vo7g7Rhx0UNmkitwEuNcN7uCsIldQ+nTVfAZNYF5ZNlOo+yivFhE kIRC34UXfFjZyel73j5vLIiRHgyOa7XDpaDzoyX/t3Movm+Gg82ADj6MJfHNoKw/cCVM /evQ== X-Gm-Message-State: AOAM531NqFnEalLxkzRmyNt0nfS9Y2OrZ+RKzczh+FrBw4G2p7BsUT0A honTJdP9BoSYkHJQe0s0MbFoyg== X-Received: by 2002:a17:90b:3907:: with SMTP id ob7mr8673581pjb.18.1613558353955; Wed, 17 Feb 2021 02:39:13 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id u129sm1996908pfu.219.2021.02.17.02.39.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Feb 2021 02:39:13 -0800 (PST) Date: Wed, 17 Feb 2021 16:09:11 +0530 From: Viresh Kumar To: Lukasz Luba Cc: Amit Kucheria , Amit Daniel Kachhap , Daniel Lezcano , Javi Merino , Zhang Rui , "Peter Zijlstra (Intel)" , Ingo Molnar , Thara Gopinath , Vincent Guittot , "v5 . 7+" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error Message-ID: <20210217103911.n34zzjttyso7dlco@vireshk-i7> References: <91749e19-9091-1292-b8aa-c923efa8021d@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91749e19-9091-1292-b8aa-c923efa8021d@arm.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-02-21, 10:29, Lukasz Luba wrote: > On 2/17/21 5: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. > > To be precised, thermal pressure signal is not so important in this > mechanism and the 'cpufreq_state' has changed recently: Right, I wasn't concerned only about no thermal cooling, but both thermal cooling and pressure. > 236761f19a4f373354 thermal/drivers/cpufreq_cooling: Update cpufreq_state > only if state has changed This moved the assignment to a more logical place for me, i.e. not to do that on errors, just that the block in which it landed may not get called at all :( > > 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") > > I'm not sure if that f12e4f is the root cause. Hmm, depends on how we define the problem :) If this was just about thermal-cooling not happening, then may be yes, but to me it is rather about mishandled return value of freq_qos_update_request() which has more than one side effects and so I went for the main commit. This is also important as f12e4f66ab6a got merged in 5.7 and 236761f19 merged in 5.11 and this patch needs to get applied in stable kernels since 5.7 to fix it all. > > 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(-) > > > Anyway, the fix LGTM. I will have to make sure that I'm CC'ed for these > topic, so I can have a look (I missed somehow 236761f19) > > Reviewed-by: Lukasz Luba > Tested-by: Lukasz Luba Thanks. -- viresh