From patchwork Mon Mar 1 16:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388745 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3676972jap; Mon, 1 Mar 2021 12:39:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzO2w+wsj/BxNkQXot1amCWjOOzD2yNxQSgL3YFLPVeyKlMsDT35BF2ChkxaIHiLsN1kTZ8 X-Received: by 2002:a05:6402:1d33:: with SMTP id dh19mr11573259edb.362.1614631174614; Mon, 01 Mar 2021 12:39:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614631174; cv=none; d=google.com; s=arc-20160816; b=kM2j22uHzRhHu5ULtK1XOrzdbhzBqBkgdfOlyXWqxDSmRQRJvsnh/SmnMYf2D47903 Ld3W9ZvGpcIPwYsUd67X0rrF275V9OOJaSoQbvR3YKkM13TAjFdj0lEWSAk7d+N7Fa1t wTPninvzX6pp4cdVTMkb7lgrTBv+vGpGeeqH5d1Q4D2ITTk8WBep/u8NiBfVRlAVmX1i 4P2Okj7VZkaq2sNGb0H3bmovznrFgyeDMkcjuoIzGRMELkxLrOuFVMU/ZaKN/fRW8HtK 3HJ8gLgKzjW/nPPmvFOW3mpq0zjv+4Us9SsMPGRQR96z8zGfBQ4K+nIPoClD3u43i/+1 dB8Q== 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=cmhuAQuMSA1ifZHqGgyG7Q9YFZHwbok8HlYuZj2f0k8dZRVSSpASWLFq9iG4jw9+Lk HT6c1cm2wJFfD691TbP9qPx9lW+QzA4dr66VGclR2D5DZc3JOvzflOjgMXx5vaEAcKe1 fpq+pBNw0QTYDeiJPLJxWRwuT2EDQgXjzjUZMKssRkXuyhKOdlFDiFuLP6NNnz4F2p6Q s2bODfudU0hMA2aZzi0CEHxQ5z6xEySBIL9NXWKCEHJDahpEJ8dD6JOcta5qd4h5pAnj H0u2+e1MhfdeEHdeHBs62OK94VtMe8YBw+/uI43uRJqBxR1EXLSlRg/H1/sDMEwC/GD2 G3XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gNKSuVio; 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 c10si2534507edv.12.2021.03.01.12.39.34; Mon, 01 Mar 2021 12:39:34 -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=gNKSuVio; 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 S241932AbhCAUhS (ORCPT + 13 others); Mon, 1 Mar 2021 15:37:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243483AbhCAUal (ORCPT ); Mon, 1 Mar 2021 15:30:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4CD6C65092; Mon, 1 Mar 2021 18:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614622093; bh=mWvpmEL7DxDByYBaP5gm30CGnZOnrdofibzdWQCDiNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNKSuVio/k60KRN6e7JoiPJ9rOy5aq4ohW/49pCaH28nbhgmMvFX0AHlNN8KRmLIC UIJOpJAxQ64ExCUAD7FgqwXnB7F225+Gqs5EPKlY54/4LbNBL7hP8ABueYROMc7mEj MH5oj2d+mEF9Wc9AD4Q/vM5xJoZtOlXU6ltYphoE= 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.11 727/775] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error Date: Mon, 1 Mar 2021 17:14:55 +0100 Message-Id: <20210301161237.257182737@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@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));