Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp478509pxb; Wed, 3 Mar 2021 07:55:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHoD3haZnsVAiINUTxKUuE0c0f00RPJKbc1id8LopV0WedRmh5Oj697y5lfxSvkmfmh/dR X-Received: by 2002:a05:6402:57:: with SMTP id f23mr26008402edu.319.1614786902375; Wed, 03 Mar 2021 07:55:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614786902; cv=none; d=google.com; s=arc-20160816; b=noMWkrqb02loKi87cHBVeJtXYn05MQcjEaHOmd4HMJINF7gSMD20b1gobF+qHJyT18 eZ2aZ/jX0p2xXrO4RjjnZR56AWAZyVmYfIe0S7vLQLA8sl7K1giln0tSPD+OGSF9MyAJ 2e0/R3AFW+ba3wVteoJjoVmwNJsKKBYpGSNm+HgJBNcAEHB/DR4UjkalwXgw46HuC+Y4 aUFzV9qAwVECFAYKJ13TYiRtuCKddVMEea0zDsySuke5qo8TwC/OXzzj/DjjOyMl0H/l T6YNY+1dFfNxkZsNHyu+If9XBTZtM4sGEFrrUQas0uJTZNe+NE7rKV5wtMJkiirwGici j9FQ== 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=BU2qgmuz4W5Rr0g8yQIAhwbB6wWHsZxX1+1zGckFmKFewwQqcr9wFy3FUI0YTJSL/M 5MaWU3UDx/yKzO8pjekXAm3/XzmzPxg62LaFpmNPhaughJYU96KCgXAcuTPmAgvpxqBX zXMV1V7dMPafmsAgkp+/H2LhGJuNVRy4YumtBH45TMsGXjiNGrto0Y9px1s82+lqL7F+ HFXbEDNTX9ReW/1iPjODxlIo1De7/KvEjaJv+umfXJFtsHNZ/cl4AffAeTSaM977IGCZ D/6j9wXKRtGmcSaoWCNDZTM//WrpYjsHY4TuYMou5Km1/+cdhOSgrL0yDipdCKZVimLs 5Ebg== 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 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c13si1170878eje.45.2021.03.03.07.54.19; Wed, 03 Mar 2021 07:55:02 -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=@linuxfoundation.org header.s=korg header.b=Xd6nmHHd; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344230AbhCAXZC (ORCPT + 99 others); Mon, 1 Mar 2021 18:25:02 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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));