Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2833328pxv; Mon, 12 Jul 2021 03:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXEqMZxT4p5r+oHinAgbZxMDvQyOt7frOk12AzFzAgWWV9xM0qr4eewgcJvWEtGRIRLBgv X-Received: by 2002:a6b:f41a:: with SMTP id i26mr38555847iog.162.1626084296827; Mon, 12 Jul 2021 03:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084296; cv=none; d=google.com; s=arc-20160816; b=ECazBsSdXHMn34fN4GmMQXeI2q9AirvvHJEvNLDOvSK6wkqjoI1DmKXWYW1wvqIppQ zF7KLr8PjGQxFmIF7jBvM6beTeddJbx6LcLA2I+xuYoLTOXwAT3u8aVYIXKXfAaAOVZU Vgsl9DB+bbp/21e4iBCAcinLP58JKl1PpwCgSHdATfZHJgpVQGildlQ9m+MGV98RDhmg 5OOEcTyEXlfX6JBkwKyXsCXy2AYHAumqYGsHcKp86d3owzd+gI7ZvV1slJ9zvk3ODNWg 63a+H20x9kkwJXVGeODyfEP4IXE14iTFwRrc9beSSB95q+UdMb2oYB860NEmJ4rcxBRm 0YxA== 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=4g99KoynKx1g5JQkODrWnF9ikljzY592Hcagc6aji+0=; b=wDRe9gYDi5fMU40r5skj5QPp/PaOR9ou8YyW0HmwDq1DecklqKiFcqBIgs8kP7gjpJ W56xFq296fVqhUpaxy+DLVbiDTobBrsO7j2K4NhgIrHnVM9Fgnc77HCMKDV1A+EN0wAx +UD59mwHfZaUEz4HqfvA36mfLZehny0tQ0gg5KlC8cT9N9GaKarG50J/JvAwyu0BhFjJ eUvjOVduKnJFH/lH/gHDghkKrbjuqcA5XQvNmi9c4X3M74KK04bhh1/bSty2ZzZIYwHq yvyxphGvWKMLVyJ8KTmF4EbNtKugp7TQ26NYsjjnTEukhxMTbd+Ctol0pzdGHpk2M2Jt WzOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VuLEvR2q; 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 t10si16085172ilp.101.2021.07.12.03.04.44; Mon, 12 Jul 2021 03:04:56 -0700 (PDT) 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=VuLEvR2q; 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 S239977AbhGLH1y (ORCPT + 99 others); Mon, 12 Jul 2021 03:27:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:35486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241958AbhGLHAs (ORCPT ); Mon, 12 Jul 2021 03:00:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD1D5611C2; Mon, 12 Jul 2021 06:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626073080; bh=G3HkHgxYvSNq/jgCvcqsDicGxcTj7bqjdex/ftaUcKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuLEvR2q/WVm8ntIH3jST4ONcIyEKrSDIqX+41PRa6e8J285u399dlv5nRj12YZZx +4pb2OOtE7lGw2wJfEqkYYZefbIetk96AtwyJtN2cljT48tMm9BcQWxIpIl0h+s8Wc /3FVCQxnMvYMFQ51Cle/djy2JUZcxExsRekbVOAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukasz Luba , "Peter Zijlstra (Intel)" , Viresh Kumar , Sasha Levin Subject: [PATCH 5.12 118/700] thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure Date: Mon, 12 Jul 2021 08:03:21 +0200 Message-Id: <20210712060941.622648144@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@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: Lukasz Luba [ Upstream commit 2ad8ccc17d1e4270cf65a3f2a07a7534aa23e3fb ] The thermal pressure signal gives information to the scheduler about reduced CPU capacity due to thermal. It is based on a value stored in a per-cpu 'thermal_pressure' variable. The online CPUs will get the new value there, while the offline won't. Unfortunately, when the CPU is back online, the value read from per-cpu variable might be wrong (stale data). This might affect the scheduler decisions, since it sees the CPU capacity differently than what is actually available. Fix it by making sure that all online+offline CPUs would get the proper value in their per-cpu variable when thermal framework sets capping. Fixes: f12e4f66ab6a3 ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping") Signed-off-by: Lukasz Luba Signed-off-by: Peter Zijlstra (Intel) Acked-by: Viresh Kumar Link: https://lore.kernel.org/r/20210614191030.22241-1-lukasz.luba@arm.com Signed-off-by: Sasha Levin --- 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 6956581ed7a4..b8ded3aef371 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -487,7 +487,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); if (ret >= 0) { cpufreq_cdev->cpufreq_state = state; - cpus = cpufreq_cdev->policy->cpus; + cpus = cpufreq_cdev->policy->related_cpus; max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus)); capacity = frequency * max_capacity; capacity /= cpufreq_cdev->policy->cpuinfo.max_freq; -- 2.30.2