Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13931417pxu; Mon, 4 Jan 2021 08:15:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDfJddEtIHPD15DLFGJ0pkJ2lye3bB+cv5IjJ3dxfG/ppbG4V9hcsP3uwVPZsjA/V4zRQT X-Received: by 2002:a05:6402:1646:: with SMTP id s6mr71112129edx.319.1609776939742; Mon, 04 Jan 2021 08:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609776939; cv=none; d=google.com; s=arc-20160816; b=BDziemiOXByDRG2OCDgTz+dzAxOm4Ape/boox02qflVtfh663FizKbHlzNdDXxBjPY GnEC3mv0cmc1zf73yHgFjVhA9iTGFVcUIQgpJkXY/TRHtD3MXfrm8s7+gl6TktS0ZsRF K3Z6tbgnKAfp3SUr9SYib+L57tc9llvl0tYSSjUaXLrkR2wlemO1IunoRrCjQP1hsYkS QQsA/lT5rJA6/1bhQ+GhXUNpZrpynozMvbrmSMx8GN5t/fNUyIcwj+0b98Gh7o//LiI5 YRCEH/OOqTA3uKPqpKqm3Gv6LPQclGzZbWbnVIxUejso5U/jNHT7W1TEICJTiX6/g/Jy 4P8w== 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=qjqB4Uw337lS+7OreHmxEzftppCRhCUbwPvmf14MNB8=; b=nSUN7QR25m/6v94WcSBWJhe6uyB1gbFgoJ2QPRQkWS+gfQnSVFOeE2GfjUJgogrDMU Pr2DolfbnYtZd1VtWLIZYy4GGXOfWe3FZCdUlgn96Tx8nWYXPmxWGkRsK3XuIyKNdxOb EHfNBnUsez0T2eKKCPkAITN5LzOocvwZQnySC2SovIbjRU+muIEyVOw9VvWsT854L9K5 YZXEoHD5XINpbzrVkGWqsR6Jf9rSdRWBpS02iiudtKe10fTg+PEZvQ08MLSGiM+Ju5bE D3ej3QzmTVvpbTjFmt9+PvhpJ3Bh6a4KsJleya0VvHNTkGEh/tgdEnllS6Xi5IIDPSaj N9CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JsXpqkec; 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 hr22si27600580ejc.411.2021.01.04.08.15.15; Mon, 04 Jan 2021 08:15:39 -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=JsXpqkec; 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 S1728179AbhADQAC (ORCPT + 99 others); Mon, 4 Jan 2021 11:00:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:36560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728164AbhADQAB (ORCPT ); Mon, 4 Jan 2021 11:00:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7309322507; Mon, 4 Jan 2021 15:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609775974; bh=wnUQKLxohvRGyTmXR07pj6xB9AmiF50wiB7wPUNxG6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsXpqkeck7BGTAX1dXbGS0vcthLAs227xdVf/Lh3XGM0X434vpmlKyL4+V8hho0vr EE2ILUJ0FIsiWgFnV3bEQ3JcD+dAaKBmLhBrykMB+wHCqDUd3zVsN2EUnsgUhZ4ZWn J/k/6QOl+2AYuvLF2yhUK1BMxsu+jAB78RTrOTJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhuguangqing , Viresh Kumar , Daniel Lezcano Subject: [PATCH 5.4 03/47] thermal/drivers/cpufreq_cooling: Update cpufreq_state only if state has changed Date: Mon, 4 Jan 2021 16:57:02 +0100 Message-Id: <20210104155705.912483575@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210104155705.740576914@linuxfoundation.org> References: <20210104155705.740576914@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: Zhuguangqing commit 236761f19a4f373354f1dcf399b57753f1f4b871 upstream. If state has not changed successfully and we updated cpufreq_state, next time when the new state is equal to cpufreq_state (not changed successfully last time), we will return directly and miss a freq_qos_update_request() that should have been. Fixes: 5130802ddbb1 ("thermal: cpu_cooling: Switch to QoS requests for freq limits") Cc: v5.4+ # v5.4+ Signed-off-by: Zhuguangqing Acked-by: Viresh Kumar Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20201106092243.15574-1-zhuguangqing83@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/cpu_cooling.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -320,6 +320,7 @@ static int cpufreq_set_cur_state(struct unsigned long state) { struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; + int ret; /* Request state should be less than max_level */ if (WARN_ON(state > cpufreq_cdev->max_level)) @@ -329,10 +330,12 @@ static int cpufreq_set_cur_state(struct if (cpufreq_cdev->cpufreq_state == state) return 0; - cpufreq_cdev->cpufreq_state = state; + ret = freq_qos_update_request(&cpufreq_cdev->qos_req, + cpufreq_cdev->freq_table[state].frequency); + if (ret > 0) + cpufreq_cdev->cpufreq_state = state; - return freq_qos_update_request(&cpufreq_cdev->qos_req, - cpufreq_cdev->freq_table[state].frequency); + return ret; } /**