Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3862736rdh; Tue, 28 Nov 2023 06:02:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4lezdi+unno6O53l4NvzqQCraciIIzQmrKW4ifT/t6HSwnkDGK+5I8PRaTwpwvU7v9BZb X-Received: by 2002:a05:6871:419c:b0:1f9:eaa6:9c43 with SMTP id lc28-20020a056871419c00b001f9eaa69c43mr21261024oab.31.1701180130003; Tue, 28 Nov 2023 06:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701180129; cv=none; d=google.com; s=arc-20160816; b=ctn90+fFMxFGno3uGX9J8CMAPtDjOd7nrykgeLFJk5zjmZ3nxgQQeDGlUP+ZjUoZ+X yAM1kLTztXyXgojfAnqdhpCkYRgV/rDjkEEddIcvTT4tziMXd5wGeya6yT48hATthjvK Y17LkESf0Wa5gVztbAaDCdySVkazF0mPms9VPDgcDL7pFs5mQYrnbdlI3j6NKwm3FW5n 04rgdW8Zhc6FaKlzqlGiaw7iCYhPH3lOjfYf0kZ9gxsQ0xHaMUP1xQBS3ntUSE7R5s5A zf4U2RO+wisnLoKH82vrT6t2CCwob4/RQfSRjoi8uVZVJw+Cg07CDJ+n6vPBcgOT5fKB hd1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Bk0aoPSsnyxLevFW4RisVevzKU2Re6O1irtFXyByY0I=; fh=obWMZtm6rdvocQaeuTRSzzVrHM8Zf7SlqFP0/GK0+Gw=; b=JTzasOCmNa0tOPngB32EMWyx+ea6QuC+UazADo7yYxIlALKzBHrXoaYFZeEXsZ+1D2 M4TKYu+dCxbGZXrmLZXHp0IQ/y932Ry1zAx62gzYv05xAvpmdBFg7fSW4wm8x4uPNtJ/ l1mELiYB2z4IBnwJvlS8Wxq5S8bx1NQjVG5q6WFlHdAmYB4cYarMK2hE3sHEcDb4SGw4 7Etap7NOgqUQyTzAIVoWI3mz8sIGl+8M2cUNniH43O71vnkG9ARFTX3eGP/b178JzH3C +X7hMp4J0noYUF+N4t8IV/m04+qNBpw28T35otuTfg1hVBPmWKO4zz4soZ88eEHWj8z0 KseA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id lg11-20020a0568700b8b00b001f5acb56fcbsi4869506oab.132.2023.11.28.06.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 06:02:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AD9B480BEDF0; Tue, 28 Nov 2023 06:02:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344802AbjK1OBv (ORCPT + 99 others); Tue, 28 Nov 2023 09:01:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344806AbjK1OBu (ORCPT ); Tue, 28 Nov 2023 09:01:50 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8AD981A5; Tue, 28 Nov 2023 06:01:56 -0800 (PST) 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 C2D431FB; Tue, 28 Nov 2023 06:02:43 -0800 (PST) Received: from localhost (ionvoi01-desktop.cambridge.arm.com [10.2.78.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E7D003F6C4; Tue, 28 Nov 2023 06:01:55 -0800 (PST) Date: Tue, 28 Nov 2023 14:01:54 +0000 From: Ionela Voinescu To: Beata Michalska 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, rafael@kernel.org, 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231127160838.1403404-3-beata.michalska@arm.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 06:02:06 -0800 (PST) Hi Beata, Sumit, On Monday 27 Nov 2023 at 16:08:38 (+0000), 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. > 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. > > 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); Given that arch_freq_get_on_cpu() is an average frequency, it does not seem right to me to trigger the sync & update process of cpufreq_verify_current_freq() based on it. cpufreq_verify_current_freq() will at least modify the internal state of the policy and send PRE and POST notifications, if not do a full frequency update, based on this average frequency, which is likely different from the current frequency, even beyond the 1MHz threshold. While I believe it's okay to return this average frequency in cpuinfo_cur_freq, I don't think it should be used as an indication of an accurate current frequency, which is what cpufreq_verify_current_freq() expects. Sumit, can you give more details on the issue at [1] and why this change fixes it? [1] https://lore.kernel.org/lkml/6a5710f6-bfbb-5dfd-11cd-0cd02220cee7@nvidia.com/ Thank you, Ionela. > if (!new_freq) > return 0; > > -- > 2.25.1 >