Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2823272pxv; Mon, 12 Jul 2021 02:49:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzE2vJWeFEyWibnY9mV3rOZc4R3d7KYoPfvTynepNm+PQMuaolyKywEd1196LDyxNmE7cW X-Received: by 2002:a05:6638:148e:: with SMTP id j14mr2417476jak.136.1626083341603; Mon, 12 Jul 2021 02:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626083341; cv=none; d=google.com; s=arc-20160816; b=HPhYEcdxkriuIivmi0W56wIwrrgcU41sGo5G5/E+UcurRke3njBsFfUIpISwE/Xsfr +Ibe/gG0SHLGjZ2w53JAhO+a/7gZB7/cjrVR63YdRRaMEGnpjJfzHKnBgetxs7oCjGs6 nlUsDV/oXWZjwbmGNXl/iLWjsvaeAq/Qj/POHhM3qGmDOuS0XM+aMau9QeDy3qP+iRL9 ADHHAjlWaENw2W/b4g1zfDZf55fPkv9cz3s686N14xoVRTl1nJUoU7kO/hkHrB4/6E8f 3JREti4x5cMsflUlGfoR8bAFpcHV0Gl4dgDK8Zhrq1um1ktX/R890bVtC1xiAhIOAgF/ g4eg== 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=bsK6haDeE0qr4EPdW+lcXYcRj05y3XKqv2epHY96Sks=; b=PNXDy3HusAYXRqqS5TWaIEmm8pl7RM0JlSnO5cxZqWczJlNs6g2psrqPGYYXorStyt aHjBMaFn28YSZIkIc3OY1kOu29BS55+ctbKAEgPf4yYixHX4BjF9R3xLuUL+FUAgN6le 1WPLSVvSg13UmdOjWoknJoMMm06lBWqbcFopS1pxPWGjhh6ZC/ur4l8SYPZoQ2CHRb16 LJN1RbeFZZ9BCN9PRbGtZcu3tzIrW5HHSBPpuwVH2O8m4eNjvYoCQZhpWJwmBht8PEhn v4OScixFmn79XZ6WFxjm7zqjaFcQY5pvFdnzNGUQGgmJcK18buq3JUZewYQaM/m6ZWjq SBug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PqVxmR4S; 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 p31si19418384jac.95.2021.07.12.02.48.50; Mon, 12 Jul 2021 02:49:01 -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=PqVxmR4S; 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 S238911AbhGLGo2 (ORCPT + 99 others); Mon, 12 Jul 2021 02:44:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237852AbhGLGez (ORCPT ); Mon, 12 Jul 2021 02:34:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01E316112D; Mon, 12 Jul 2021 06:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071508; bh=bzbaR6zHyOg6xGHCETQ8JeXmpT3Bz2gN55FB7i7Rvsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqVxmR4SVx6/KHa+6U1YqF2Cplkj4Fuc1BoxDD/LOxBhKcEUKGVmfdiyJm8MFk2fu SbiXwjPJeSrPfVw574ZHQ0yegqv99yVKTLiITmZ84QkeKVieRl7H3OjvpofepRdHqe AB0LfCNwwKifpG6iC8WCZ3P5OR4Mj6kmstiyp5X4= 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.10 099/593] thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure Date: Mon, 12 Jul 2021 08:04:19 +0200 Message-Id: <20210712060854.110003059@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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 3f6a69ccc173..6e1d6a31ee4f 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -443,7 +443,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