Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp706380rdb; Fri, 2 Feb 2024 01:06:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWsJ6Rrggu+D6iuEfBtILMmS6mnUWFNf83w8oifp1u6qC2Vbu4TgY/amKHLJ2fzWWKVlBv X-Received: by 2002:aa7:d510:0:b0:55f:e2de:a73c with SMTP id y16-20020aa7d510000000b0055fe2dea73cmr788567edq.30.1706864761563; Fri, 02 Feb 2024 01:06:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706864761; cv=pass; d=google.com; s=arc-20160816; b=RF/RQlOWTF/YlX6T7HBGvFJHvNGIZK9wiVRl4mDSxSSdDIy+oaD9QQ3ICxqG/I8VFX Wmin69LeO2WdtNINkIQtC4QYXWCCPUNBSAczQNavJWMz5li+ZIH0WZpGjEUot8p5yiUW iq+CJv16ylPCpKrcpDG/XnJbu5kfkx8Gn+fnZsi3nWSB7A1ymnWg2qX3V7KSBJXzB9z7 zgMmQA65euQq7+JiSLyVqaQYhLVK89YYB6Py7vqam0I9+MDjHD5lGE42G//qU2TuMcfL uPtwkadhR+d8QF7DJjXQOVxpxjTGAR4yDqZrtAlFOY1RHa9uvtJ7doS/JKIBI1w/BMgr Sc+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=xFU8HyN7z+YJXQdLuIXV+8zybJ25ENIg1ngk7G5WQj4=; fh=j36tZJRX49wATF/snukVSGWNWAHFEljhNhAvdqF0ZlA=; b=ZB3/U36T8iKMB2DfHTI5hEjR6zvM77ScL2ORRyMTYI1hnSAGf1AWRtKyA/oMforV2Q ZjY4a1BOGCF6uXUs0ev+/fsqtWRQoT6JmAqSFrUPH9GVczWx2k1djS2GK25sATqxNf5a rFq7pEgFqlMF1Q122yuxSZRR47Dg9+3bM4YAIPDSi2ZU32tmfs27M5DhDiQjFPUAJEES NQ3CaUYpldMrPyfsWSpZQgqu330pF7y4RpraZuCYDVJp9bBoLODM6+brhC5bc4KYWRoU AdIQTX2XmNY+RKARUzCNVnRhsKaJ0L/kH+E93Revjglzixg8z6dDIrx17CL3W2x/hBj7 1x1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCXZDsySEDGjx96owPQxwZ2AXfaG/upTiC0V43vjK/FvHFs//VqOMhIOzbQQUvJk2/GoBiiwDw0WR1emsHJo/HkZyNjlpZinrUHYRnkJlA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f3-20020a056402160300b0055ff6c5bed5si287281edv.414.2024.02.02.01.06.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:06:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49531-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4B3C11F2A159 for ; Fri, 2 Feb 2024 09:06:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E74774299; Fri, 2 Feb 2024 09:05:51 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 991766087A; Fri, 2 Feb 2024 09:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706864751; cv=none; b=BO/lOa15XpwKGcuxUUOCrR4RJ34oOC7ZAcEUPvPNNlZR8zkmnwe3QtT4kQinKQZI2snAbiMESlhMukmL5bSFp2MsM4eBCqI+vhXYPD3KYqgwvajPoZZJWiAjegOyE966NAmmirEzpvVG73A7Yb6J4AvJFetI+8KFE9fwO0lMuJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706864751; c=relaxed/simple; bh=IKxvwNSUt3agfDzeeYKFG24bjgt9QnYU/2DpLutNLhM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V1MRGygqHam3URTJ0CqPtOrtnW7YYFH1CcL6LELr3jBc2zFgQ/3sNE3Q6SopyNuo6ppAa2tvfPWVMTNEnoUIhWQDO1mesJJgQJXr4Orai8tQ/VkqS2pJoiZdCWDPj2PAqsxlWs5hkz165lsWXkOUzIpoGv/d3RXhH9TN45va7lc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 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 5F9EADA7; Fri, 2 Feb 2024 01:06:30 -0800 (PST) Received: from e129154.nice.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 658B93F5A1; Fri, 2 Feb 2024 01:05:42 -0800 (PST) Date: Fri, 2 Feb 2024 10:05:05 +0100 From: Beata Michalska To: "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, sumitg@nvidia.com, sudeep.holla@arm.covm, will@kernel.org, catalin.marinas@arm.com, viresh.kumar@linaro.org, ionela.voinescu@arm.com, yang@os.amperecomputing.com, linux-tegra@vger.kernel.org Subject: Re: [PATCH v2 2/2] cpufreq: Wire-up arch-flavored freq info into cpufreq_verify_current_freq Message-ID: References: <20231127160838.1403404-1-beata.michalska@arm.com> <20231127160838.1403404-3-beata.michalska@arm.com> 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 Content-Transfer-Encoding: 8bit In-Reply-To: Apologies for extremely late reply, juggling too many things at time .... On Wed, Dec 06, 2023 at 09:41:05PM +0100, Rafael J. Wysocki wrote: > On Mon, Nov 27, 2023 at 5:09 PM Beata Michalska wrote: > > > > From: Sumit Gupta > > > > When available, use arch_freq_get_on_cpu to obtain current frequency > > (usually an average reported over given period of time) > > to better align the cpufreq's view on the current state of affairs. > > And why is this a good idea? Apart from being problematic with an issue pointed at [1] (which will result in dropping the change in cpufreq) this was to keep the cpufreq core aware of potential frequency changes and take appropriate action (informing the governor) case it got out of sync. > > Any problem statement? The problem has been raised here [2] > > > This also automatically pulls in the update for cpuinfo_cur_freq sysfs > > attribute, aligning it with the scaling_cur_freq one, and thus providing > > consistent view on relevant platforms. > > I have no idea what the above is supposed to mean, sorry. Bad wording I guess. With this change both 'cpuinfo_cur_freq' and 'scaling_cur_freq' will use the arch_freq_get_on_cpu if available, and will use the same source of information (one depending on a platform). > > > Signed-off-by: Sumit Gupta > > [BM: Subject & commit msg] > > Signed-off-by: Beata Michalska > > --- > > drivers/cpufreq/cpufreq.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 8c4f9c2f9c44..109559438f45 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -1756,7 +1756,8 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b > > { > > unsigned int new_freq; > > > > - new_freq = cpufreq_driver->get(policy->cpu); > > + new_freq = arch_freq_get_on_cpu(policy->cpu); > > + new_freq = new_freq ?: cpufreq_driver->get(policy->cpu); > > Please don't use ?: in general and it is not even useful here AFAICS. > > What would be wrong with > > new_freq = arch_freq_get_on_cpu(policy->cpu); > if (!new_freq) > new_freq = cpufreq_driver->get(policy->cpu); > > ? Nothing wrong with that. --- [1] https://lore.kernel.org/all/ZWXy0h%2FfFfQh+Rhy@arm.com/ [2] https://lore.kernel.org/lkml/6a5710f6-bfbb-5dfd-11cd-0cd02220cee7@nvidia.com/ --- BR Beata > > > if (!new_freq) > > return 0; > > > > --