Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4075366rdb; Thu, 28 Dec 2023 09:13:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8xmhZ+V9GZDpnfc2wFb++9TmPOjEgeXKSzyCJdF3xgACGYjwf3HQv7wZBifHoxXaPQIfE X-Received: by 2002:ad4:5f8c:0:b0:67a:8eae:8904 with SMTP id jp12-20020ad45f8c000000b0067a8eae8904mr13715982qvb.24.1703783610766; Thu, 28 Dec 2023 09:13:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703783610; cv=none; d=google.com; s=arc-20160816; b=hf/TM7/F9o/Y63LVt1DDmocNOrhV8GzmVJyOEzTb9FqKZDBLUBf70Div/4mkKyB3Ea jEJ8qgflPtmY/s8aU58hFI9GoHypvSHi3mcEkjefwMOLMmYLmEQutA8KRGd39Awzb0F3 dBBmeerEFq7MkSOgV5UoeOt5ugk1M9NztVwB863ZLJqwDjbVUs+9GcsFUm/OsCX50EDt 0cd2J/YtE5OZxsGSS/XV1GUETI4NnCTKQ91g568ATiOy7nznxeefOZBPzA4TzTWQQAbv CT0BBoJFeb5SJTDgNs0DXGRoh5+WQKs6tUUouFkbcrbxlXJCK0Big/aPETfcBqNWneMz PC7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Av6IqslQf5eK6UkK0GZEStZMwWsd1UR26mqfBMBGye8=; fh=SxHhTsAdJqr/LLyiPt/hO9HGS2MvCviLtaUdSWFtlDw=; b=p2h44y909PWbeYVpyaC0FJbkUYrV0V84wgO3EgOgRpkqNEzKxMPTogbeTmAx5htuPx chegZkG4zy0TxgpVhMDuCRGGa+OYvbiDoMC58iLYOQpEIqzCLWKm/zIbljoqb+w7kQtg fanJGMlwghWHxX0gFTQ7QpjdIrTKvK5vnhDyPVU1A7XA/HgWIWPXBTjGsQnrMp6VJC8t qBXdNpacC2E6b+8SKaccByh3ZpkjGGFPAfR7ogvmCHjyvtoRKMciMa5LE/3wj8ffYUPi LIM5veKW0WGekqJqXS/VFl2B2jnFRCu2QS7tpvkwoZdCJDFIGhF926ZWIHHquRFJBhFl ZCjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=n5M0W6ni; spf=pass (google.com: domain of linux-kernel+bounces-12806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12806-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w2-20020a0ce102000000b0067f89f0a735si16120163qvk.236.2023.12.28.09.13.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 09:13:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=n5M0W6ni; spf=pass (google.com: domain of linux-kernel+bounces-12806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12806-linux.lists.archive=gmail.com@vger.kernel.org" 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 749141C211EA for ; Thu, 28 Dec 2023 17:13:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFDB3F9E0; Thu, 28 Dec 2023 17:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="n5M0W6ni" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EE86F51F for ; Thu, 28 Dec 2023 17:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-40d3352b525so70489295e9.1 for ; Thu, 28 Dec 2023 09:13:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1703783598; x=1704388398; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Av6IqslQf5eK6UkK0GZEStZMwWsd1UR26mqfBMBGye8=; b=n5M0W6nia4WB2erSBeDDZ8qVV2tqqx0kDLzYaVKzrakcZX5PLrcDT9Hjx7+VKkBpb2 Cok6YB/MdbLiCLET4bADuRZPxkNAbaCqM0CEc3UdsXGj4oR42bWYpClu55i2SqDt6jHy PNq9J0yiDnCa8UiE3JW9NZoBiRRR0FoIpTHYndsZDVDZItaceNBTDBWAe2xlWAj6WqCW O6cZ7v3QygZjDtj4DjbiwwUMBFLV3W+gsqNM79zIN+59w68TkODtQVlC6dl0pSVisK7Z 4GECUgLOb77Bp9sql4hCY85rr5ynCnw+6OaE/94a5IqMq3NgdztAWoj8IN/8zWv0if4i jhBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703783598; x=1704388398; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Av6IqslQf5eK6UkK0GZEStZMwWsd1UR26mqfBMBGye8=; b=tqqmu/Z4MF98lgApTlbzzzzSiO83afJwtGbTo51owp1Gv5ctjtAv4fjGITzXwB4lzm tDYESWWtC4Yv8RyqXRkHz707R91uA7pA9f0YNVuWMUROBTD4uuEkSXoZcFEK23yWtsD8 LeUXVvDidH1C6cpwNqC8xEexsR86B8SwjAiVXc68g0K5x3kmr1oepsQO6gl1N7ietiB1 0ihkw6AOZQcZ3u2HZQJFieeBE8ZqNMMhSvbhX+VUIecW44HMBPAsksFf0ZhNeSNH9nsL zYphV1r0/QZTBvJBXSZEuG/SFa9gYiTH0Kv0pPiFK7rBjdU4eQRQQwaQKYPGaEdF3/C8 lGfA== X-Gm-Message-State: AOJu0YxlgrvKQwuoakbRX4guMp/iK+lmvSwtL9g+qnTYyGx0IvP1/121 vxfsM/ta6LkGnOj/mPm2/0UDKVpSDx5dhg== X-Received: by 2002:a05:600c:12c6:b0:40d:3b25:476d with SMTP id v6-20020a05600c12c600b0040d3b25476dmr5433506wmd.4.1703783597650; Thu, 28 Dec 2023 09:13:17 -0800 (PST) Received: from airbuntu (host109-154-238-212.range109-154.btcentralplus.com. [109.154.238.212]) by smtp.gmail.com with ESMTPSA id v17-20020a05600c471100b0040d5fcaefcesm5497844wmo.19.2023.12.28.09.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 09:13:17 -0800 (PST) Date: Thu, 28 Dec 2023 17:13:15 +0000 From: Qais Yousef To: Lukasz Luba 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 Subject: Re: [PATCH v5 03/23] PM: EM: Find first CPU active while updating OPP efficiency Message-ID: <20231228171315.bmjdo5eztyix5o3r@airbuntu> References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-4-lukasz.luba@arm.com> <20231217175829.a6hqz7mqlvrujsvs@airbuntu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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.