Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2625943pxj; Mon, 14 Jun 2021 03:23:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwogogjZNdLz9bjsz1rXxlY7jKBu3FzjWoDEwqZsbvpGu4UKvMUBxCPA6e2IicEbsUWcba5 X-Received: by 2002:a05:6402:5207:: with SMTP id s7mr16381475edd.363.1623666188401; Mon, 14 Jun 2021 03:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666188; cv=none; d=google.com; s=arc-20160816; b=CZ5EMwpn/V5Sf/GeVINOxhDztrpSqJGdCIJzlg4wAxLlm3uXxqPTmL9mN3z+L4cODl 5DUKDtxxqaUF/Pd14jwTxG0oFrOdK/rb64j8MrwA7megWw52nZmPYi7a2rCKsWgIPsQP zI2bECKaiaI9wCJVgGCM5NfZ60Ux5eJpzZnICHteoIgPulECI0U1myTk8n0zwuoYaiIn Sa+HKGASon6PcBmmJpFwH2oB6d1bXtYb/SFbugdWCWPwWPgjTlMWbh9O+rPPaK8REhrW Sa10BGUNm8RIZedgdBW4wApuGinwHCC2adudOuvmBHYXss6RKLDAVlcGUxhhdIs2Ko3r o8Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=aOBa/AVPMJ935DolIz1JyD6s2l8gWf8WZ3hNU/xHbjQ=; b=IA3tO9mS4Lf6F1wCV9+EqrrUeukhLjBZ+MhBVJz3pJg8Brjk3hmkOv687rnS9+v1k+ HQ4oeIz4xDTWqN7vcw0wN/07UF4ebDKmU8XGwtZRgly0JiJB46PMZ7QFuuA5E8S2l3mb +tmBRXkaRHXiesF4bOpGJemSijDuozgLKhpgvSatt93a194MKc7/hwK7TTOFdSyOlvsI 4726J0W5l8EvGzfbIrwuxVnpmDCj9ljutmOTxzsgIAwBfkuIYiEDXOhW9Wmlbs14Scn8 V8OHqGGi9jK8UMKzUAvqFfkwN7CJyyGRs3Cc5Hpu3Ecy8ZQ5lGbJ9xKXclR+X5oTwqwR hNfg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si11614835edy.178.2021.06.14.03.22.46; Mon, 14 Jun 2021 03:23:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232808AbhFNKX1 (ORCPT + 99 others); Mon, 14 Jun 2021 06:23:27 -0400 Received: from foss.arm.com ([217.140.110.172]:59676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbhFNKXY (ORCPT ); Mon, 14 Jun 2021 06:23:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 628391FB; Mon, 14 Jun 2021 03:21:21 -0700 (PDT) Received: from [10.57.5.127] (unknown [10.57.5.127]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF17A3F694; Mon, 14 Jun 2021 03:21:17 -0700 (PDT) Subject: Re: [PATCH v3 1/3] thermal: cpufreq_cooling: Update also offline CPUs per-cpu thermal_pressure To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, rjw@rjwysocki.net, vincent.guittot@linaro.org, qperret@google.com, dietmar.eggemann@arm.com, vincent.donnefort@arm.com, Beata.Michalska@arm.com, mingo@redhat.com, juri.lelli@redhat.com, rostedt@goodmis.org, segall@google.com, mgorman@suse.de, bristot@redhat.com, thara.gopinath@linaro.org, amit.kachhap@gmail.com, amitk@kernel.org, rui.zhang@intel.com, daniel.lezcano@linaro.org References: <20210610150324.22919-1-lukasz.luba@arm.com> <20210610150324.22919-2-lukasz.luba@arm.com> <20210614101213.enhmoyupag5d556r@vireshk-i7> From: Lukasz Luba Message-ID: <7c807ba7-5fb5-d6e0-0af5-cc68e085947a@arm.com> Date: Mon, 14 Jun 2021 11:21:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20210614101213.enhmoyupag5d556r@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/14/21 11:12 AM, Viresh Kumar wrote: > On 10-06-21, 16:03, Lukasz Luba wrote: >> 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 >> --- >> 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 eeb4e4b76c0b..43b1ae8a7789 100644 >> --- a/drivers/thermal/cpufreq_cooling.c >> +++ b/drivers/thermal/cpufreq_cooling.c >> @@ -478,7 +478,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; > > Acked-by: Viresh Kumar > Thank you Viresh! Regards, Lukasz