Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6374665pxb; Wed, 17 Feb 2021 02:49:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcCR1uzUisTacLVI6a0OBHcDcItvpQUclYCHskp9YRZKN0HTTnD2wAuEuRcM1t2blbAZwQ X-Received: by 2002:a17:906:e284:: with SMTP id gg4mr6692631ejb.546.1613558963912; Wed, 17 Feb 2021 02:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613558963; cv=none; d=google.com; s=arc-20160816; b=WFvSHLbXvD4IDyZw9G32729HI5sHY8HcN5VIKHYvN3btkOh8Iucx9heN7ysH8q3Bp3 uUF9fJ/OiI9DOK31oIP2MlIFA3KZmQ2iu3gnTJ5TVNRO9fx0Tl/WTS7MFiBc8lkpPF+X LrJ2HT0BWQoLSyE8YOQ0DsHXZ3kIEbh6wZ4/khilD3CEvh1WX2bpiTeeyk3AUhewmWZA 5CaXMmcu45/tcrJTIsNWArsVRjIp4ymMLxKmGE5mhsTN0iK0UEEJYD6DnobBzrOh2WBT u6bsescCCO4kZteuzm7R1BOqCapCm+vPMFh+Smw8LDqQXydZR9wDx2msIyMdIcgRIjkD aLvg== 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; bh=CMIuE6+vyDHeDhd0WWUXO7VUdFQ5mj6DIX95X3tdtxQ=; b=x4FQNJGBGBHUkKjxbr0oDg6381R1yxcgTAOYIV0/9oFSkL4Tbj4ywtpWwPVf5q0fbF 2Ss0CZYz1G4j+EG9PaSG089keQIcIbXs/jj1q4mWVlY5cqyLricAmiXJWy648754k0qw 7uoEdB2VjecCTnnyYLGY+rN4Uxst1yuruly3YsYmQ4Y2Ulx4tC4WXFABFlhLVTjwp1cj +eVVclGuXyA70RmGicTHcGupG1US+Qy6KLB3lnm5adhRTYF3nin7F7FVuFgZF6O6/yLD +2hDoisvU+YO1ARFQkuj/6DkknZrIlmeiJKAcfm/3y0/2f406xKrVWChA8rwhMZTouM2 J5Fw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si1193277ede.66.2021.02.17.02.48.59; Wed, 17 Feb 2021 02:49:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbhBQKqt (ORCPT + 99 others); Wed, 17 Feb 2021 05:46:49 -0500 Received: from foss.arm.com ([217.140.110.172]:55806 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbhBQKqo (ORCPT ); Wed, 17 Feb 2021 05:46:44 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 50CF31042; Wed, 17 Feb 2021 02:45:58 -0800 (PST) Received: from [10.57.61.90] (unknown [10.57.61.90]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 96EDF3F73B; Wed, 17 Feb 2021 02:45:55 -0800 (PST) Subject: Re: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error To: Viresh Kumar 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 References: <91749e19-9091-1292-b8aa-c923efa8021d@arm.com> <20210217103911.n34zzjttyso7dlco@vireshk-i7> From: Lukasz Luba Message-ID: <0b276055-e93a-3e08-5eee-662008d8db6c@arm.com> Date: Wed, 17 Feb 2021 10:45:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20210217103911.n34zzjttyso7dlco@vireshk-i7> 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 10:39 AM, Viresh Kumar wrote: > 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. > 'to fix it all' - I agree