Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6439386rdb; Tue, 2 Jan 2024 01:40:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVIkhy1U/0KDqKIzEzJ5FIXLpHscsIZmzTttO3D/I2KAu0SdGpnI5kqf9JSFo6H+F5ZqHW X-Received: by 2002:a05:6808:2e4c:b0:3bb:c0ec:7552 with SMTP id gp12-20020a0568082e4c00b003bbc0ec7552mr15415185oib.22.1704188458117; Tue, 02 Jan 2024 01:40:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704188458; cv=none; d=google.com; s=arc-20160816; b=iF5kmJI1tQuyX0RhZYj9kkzecLHC/rPUuke+Up3Bs8haiSJ7PJWjqdFhv8ajmt/yni YjX1gpgT4UT8YUaZa4pV+rvLx/tVQAc7YppGuf2/LidOkeWtjTjhb0O31jXGfYBrM280 coAkq9RKwFoi/D/bW4Tq9QwZatk6Akyzh55Q+JAubCTLUR+58DwVvmqMlaRnm8pOZaCH RQ+8D8E3NdDHbUPlEsU7rIr2EGKTC2HKJQuoxz7WpZoxZJwI9dq72j2PJ/DdlC1mlXUQ R5bj5CxiHPPeHsRNdjHJw2SCu5Dj3s1X7E5OkJPEB9hlD9ixsL2B+5cTPEp64QZiNaf6 dURw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=3sWnuda9TfPeTiS9Sn1gX1rOZJbqwQkt2tJXxONWpdA=; fh=YmW56Jjlaak1EaOYEIddWG8QfZwpR67Ad7p8iQIhC54=; b=vzE4H49GdrPEFmppoojopOh0AG4od5Kd3AWoNJwbO+Z9cpDgm+v0G4NjAzgX2h7Bky 3h0lr+fPqa0Kh9St6mke17SRBySZjwu1q8WUHKArRxW5i2qnjA27Tp9gcfiUP41tgBDX 1zGlcyTHpTyQlElIEo0P6pmPxbnhHCPD45A9TH6MjTqtTJM2J1QWCIj38NiRC/6JcHUL eDTEJP42LPH8U1kzYrgol5TU+yu5Ah/SkhxVyewz+uva9mzvK02Lz37mHDZrYwVnKFAK glwAjTX2Ld67AVK/nQ8WpBrXJD/U8ffwWh52rZzsqnuLg/TvFxURss285s5TrGgse3Om dAJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bj8-20020a05620a190800b007811da98aa3si27241230qkb.661.2024.01.02.01.40.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 01:40:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14198-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 862A41C21437 for ; Tue, 2 Jan 2024 09:40:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CC8779ED; Tue, 2 Jan 2024 09:40:49 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7215F6AD7; Tue, 2 Jan 2024 09:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 34A55C15; Tue, 2 Jan 2024 01:41:33 -0800 (PST) Received: from [10.57.86.61] (unknown [10.57.86.61]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 495B93F7A6; Tue, 2 Jan 2024 01:40:43 -0800 (PST) Message-ID: <2c091ba8-4d5c-46d4-bf27-453ef96b1aa2@arm.com> Date: Tue, 2 Jan 2024 09:42:02 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 03/23] PM: EM: Find first CPU active while updating OPP efficiency Content-Language: en-US To: Qais Yousef Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org, dietmar.eggemann@arm.com, rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, wvw@google.com References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-4-lukasz.luba@arm.com> <20231217175829.a6hqz7mqlvrujsvs@airbuntu> <20231228171315.bmjdo5eztyix5o3r@airbuntu> From: Lukasz Luba In-Reply-To: <20231228171315.bmjdo5eztyix5o3r@airbuntu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/28/23 17:13, Qais Yousef wrote: > On 12/19/23 10:53, Lukasz Luba wrote: >> >> >> On 12/17/23 17:58, Qais Yousef wrote: >>> On 11/29/23 11:08, Lukasz Luba wrote: >>>> The Energy Model might be updated at runtime and the energy efficiency >>>> for each OPP may change. Thus, there is a need to update also the >>>> cpufreq framework and make it aligned to the new values. In order to >>>> do that, use a first active CPU from the Performance Domain. This is >>>> needed since the first CPU in the cpumask might be offline when we >>>> run this code path. >>> >>> I didn't understand the problem here. It seems you're fixing a race, but the >>> description is not clear to me what the race is. >> >> I have explained that in v1, v4 comments for this patch. >> When the EM is registered the fist CPU is always online. No problem >> for the old code, but for new code with runtime modification at >> later time, potentially from different subsystems - it it (e.g. thermal, >> drivers, etc). The fist CPU might be offline, but still such EM >> update for this domain shouldn'y fail. Although, when the CPU is offline >> we cannot get the valid policy... >> >> We can get it for next cpu in the cpumask, that's what the code is >> doing. > > Okay, I can see now that cpufreq_cpu_get_raw() ignores offline CPUs > intentionally. > > A new variant seems better to me. But the experts know better. So LGTM. Thanks. Yes, I will gently ask Viresh to have a look at those places cpufreq related places.