From patchwork Mon Mar 1 16:14:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 388677 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3572676jap; Mon, 1 Mar 2021 10:09:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl9QSflqKz9/nJHkmIj3RwYbzDbX1PnDiUUH7dReaLd9xy185nz9wJ6MiuuwThUfq4+fkf X-Received: by 2002:a05:6402:1b1a:: with SMTP id by26mr17858706edb.3.1614622148086; Mon, 01 Mar 2021 10:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614622148; cv=none; d=google.com; s=arc-20160816; b=LgoNy4B9vczCFtx2JfvPdn2tDwLc3dnje0H/6q5QXAqRLccWrzteN04AUhI9q5vDXb E+i6d8mUhM1/IACJ2BwGbaZH0DFmgvoEUAqwQ1t0ikIVXE/uL4XRY8cv60gJPhZqm4gF q/ORmQ18uTvqR23cjJvVgT1GoBmxJl3+iLecIG9mM0C7mOLGT3kAXKLPVtUdNtn9JLiz hZ2AR6F+HAvxik8QebA4FNetyxN9MhCC7x01USGAJyXBnr3GNkCcpHesivBpL7NFuoVF ySCWQT/8/pkOfnK99fwWzwBGQ7VdrZIZAs6BUBwQa323Hd0bUqIU5nMeY2nQMxjqjG4m CfGA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AXTQOD5E/0EJb1tyu0sm2JJZGYyd20EpwqWAeWWJRY0=; b=krNDEHa0SmzenrE5cZCKpRsqhURJPVLmi9GIYApkdIp0hhgtVjQ3ZZVUemSQqS5G7w hKc70u0ZcetP0LbbPJLFzR0R4CVL/oSMHxos6PEdV4O8uvyPFSAkiXWkrSPsZZGNQ4v0 ZQyT5S8v6wOKbm2YbneMg+FKnZ88VxPEg02u2uomid/UnReNC53A1kvdsfvE51KA4oXh 3IxPFkACFJkndNMLfBqTYT7fCeXokRtwDCqpGqYdPAnF+21v0DflX/r0IQL1n3vPx+I9 xvwsauMg9TYEIWgC2SgbEh0J4qKcHscunPkcb0DD2Hl+2xHN1V+yFqUIkkikJ3pWgH9L BgKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xd6nmHHd; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si11647180edn.100.2021.03.01.10.09.07; Mon, 01 Mar 2021 10:09:08 -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=@linuxfoundation.org header.s=korg header.b=Xd6nmHHd; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237563AbhCASHg (ORCPT + 13 others); Mon, 1 Mar 2021 13:07:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:52490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238288AbhCASBi (ORCPT ); Mon, 1 Mar 2021 13:01:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4526B65291; Mon, 1 Mar 2021 17:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619946; bh=mWvpmEL7DxDByYBaP5gm30CGnZOnrdofibzdWQCDiNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xd6nmHHdRxcRCj/6Qxke7s3/BrvW27BotJWa8QU8dg9tuFZETb7C9jeCvk4IgVWDk cC6DUxZfaVyt4Co4McmOE2nmlTcLUNzQ2AW6nq/nV03pzMoeAwLGKkKFonhpm6EGTz ptptrLulcf3Ke9xjJebMx2eprYP0k7RzMyVmQEoQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thara Gopinath , Viresh Kumar , Lukasz Luba , "Rafael J. Wysocki" , Daniel Lezcano Subject: [PATCH 5.10 621/663] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error Date: Mon, 1 Mar 2021 17:14:29 +0100 Message-Id: <20210301161212.571384170@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Viresh Kumar commit a51afb13311cd85b2f638c691b2734622277d8f5 upstream. 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: Lukasz Luba Tested-by: Lukasz Luba Reviewed-by: Rafael J. Wysocki Tested-by: Thara Gopinath Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/b2b7e84944937390256669df5a48ce5abba0c1ef.1613540713.git.viresh.kumar@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/cpufreq_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -441,7 +441,7 @@ static int cpufreq_set_cur_state(struct 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));