Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6504834pxb; Wed, 17 Feb 2021 06:24:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6TPINyGIpwSVaVS7TIU/mhiWu1n5pZGblUmYSeK/r2jNcGXT40GRgoU/6nlrWtDiD7/nd X-Received: by 2002:aa7:de82:: with SMTP id j2mr26572005edv.313.1613571898750; Wed, 17 Feb 2021 06:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613571898; cv=none; d=google.com; s=arc-20160816; b=ozxRG4nR6N9kgNvL3SIDdMHsyWvKvDwN3C73SV/82u5BKEEXFle135vGQ6MDwLQVZQ r+trhceKkeHvypw3OibKp2+z9SzErEUkFKrhPOnrISuMHaNCIjexvq/uYmy51aVsWXkU j+svMByegbNEfm/7lkhJbP7lNWmeGuPUz6XJX5G6IsRpcBv9OHRZx88IAx/jbiGdZd1S 2gXmuT00ldonEEJVdIaYKNQ0Lfg62TQCipqObdb9dB6+jynmtJTlbKNgZ07sz1tx6/Uj jE2e8eHEm+0MLwr68M+f/UNAQ66JhV9isd/+Xn/ASqSwDHnaLCijtuvuDCTXcl2/1LvC JBUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=b+TzfADeGi3HDQ8XGZOMO0js+fOojwy6Y8D60U3mdPI=; b=N1Sr4SbPufSaOMghb7ufiFZil73dBwoTH6uu/zj2VOYBHBzDu4jnkiwGKi28MLyYiz UfdGOB/0sGlCvwFAPojXkw9aTnXr0Fijv1ERrsOqG5XRc44quEHx1evruU4qUf/8jCh4 ih1tBjzB50QSHf64PZMmsdTKYkBMouJRDihtemdvny5E3mUX6ONS4w4I0QJ09KhLLN7h 4JOySyRxX0ygzJ32ofzeurL/dwi2MxOYc5wBUDkAoGK5TmMtROFewExsseq/e9Qy92yt MpyjFrZmVKsLBEZyubFKfi61L9qHi9/GpdPEapludSguMKqGk7uoH0S6jAC8e15qQgrI u5ww== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si2061908ejs.186.2021.02.17.06.24.35; Wed, 17 Feb 2021 06:24: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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233449AbhBQOWl (ORCPT + 99 others); Wed, 17 Feb 2021 09:22:41 -0500 Received: from mail-ot1-f48.google.com ([209.85.210.48]:41530 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbhBQOWc (ORCPT ); Wed, 17 Feb 2021 09:22:32 -0500 Received: by mail-ot1-f48.google.com with SMTP id s107so12115712otb.8; Wed, 17 Feb 2021 06:22:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b+TzfADeGi3HDQ8XGZOMO0js+fOojwy6Y8D60U3mdPI=; b=DUL7DGX736FaDP5vw+LcsluyxQSliH9tqNKOasWTmZzWyOLv10bFy60OerFosq3n3j WW+iE3yJS3LG6XVpG00jAZCwlF0tUNhNzMo5TJME4iwYvKw52xKy60MyPGp4B/djBjaZ 6+gI7jEZU8TGaT+/2QoYnGSjqwXCLYZAXD2qSWqhvg3PQc18vTSUBhYOu7dM2T0itEMG n3Td7VNrH+8mFAYNbDNBxBHMEpo3c+MDrjA+YDb1mW65fBs+wcBf8S5quWNGoso4mfHC xflYfGz5HDpni01Zqt+0em+c9Hpm9z5kECkL31MBo7Z01CIfgtVHY4HnC82JQFfmaRxd lyAA== X-Gm-Message-State: AOAM532qAGzQyOnBJAERRtkP1I2iE8b3OdGne3Uf1Q94fQvlaBmpWx+J LjlbZ4OYkzD/vO1rxKT/MHlyreJzU8CR4f6swZw= X-Received: by 2002:a05:6830:2106:: with SMTP id i6mr17665831otc.260.1613571711364; Wed, 17 Feb 2021 06:21:51 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 17 Feb 2021 15:21:38 +0100 Message-ID: Subject: Re: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error To: Viresh Kumar Cc: Amit Daniel Kachhap , Daniel Lezcano , Javi Merino , Zhang Rui , Amit Kucheria , "Peter Zijlstra (Intel)" , Ingo Molnar , Thara Gopinath , Vincent Guittot , "v5 . 7+" , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2021 at 6:50 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 Reviewed-by: Rafael J. Wysocki > --- > 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 >