Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1243128rdb; Wed, 6 Dec 2023 12:41:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IErlsmHlk613xIK/ohDWHfg/qqhwyYe5kiC27ciVi3L3f3A54zj/U523RD/d6f82HO5S6QH X-Received: by 2002:a05:6a20:a087:b0:18f:97c:8a3c with SMTP id r7-20020a056a20a08700b0018f097c8a3cmr1446683pzj.103.1701895287344; Wed, 06 Dec 2023 12:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701895287; cv=none; d=google.com; s=arc-20160816; b=EUM0DHgAk3AJeCpGPpbcWVd/hZFz+gTEV8MKuDW+fgXht5XVpmPyJBZ5/zq4kAZrKm QjKv5aKJSv8ipCeW6z7FmueqS6ZeKCdhTXE6qmgQp5DI58pO3QYNrFM5J7CuoUF7tlK+ xX2j2PpjDDnT9kElh0/lGNtpvj4Ti2QLlA4fBV5GpxD9bKBgo6beTcjifkXgvLe7550v vpI8dyVo02KQFnsV31ypq0A8tN/MkfXpna3eA7OmW1Q8JoNKPecRNQu+O5lL0zXjgBBK knWvNaPvlE5ZptHgkdaud3wBLq3M2zF6yDFl7PiK79Y4kMOferpdcByS1UPIUTNQmRkT /1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=d0G1DGkJ4ugZpaldrvEtNq9GgluInjREcZXERsm8aLQ=; fh=7oZSzCUwaO+sC0OPUU02BFJxfIjfIpatUnXc1W7w9/0=; b=dmMEQjHTx0IY/F7iuY+aIy8mg3qiTMIAFwIVuz6oMQDj2uE109jYHodK8YhD4nTwcf dQhCcloeJ0wgNQBYa4qbg96U1u12btZj/5leYZVoZUsA9ljK8MVCI2bZ/xoA5MqSwJJx hUA2/aa862f59o11LB6H0P79bEN1uET036Fpt/fDNJm1GuCijQZ822Q/fIqZa2vhJFNA 1vgQlPndw1AL/gtcFQ9yTWxtT+BMdh212Ls7znLZyuHwgv3p8edcOJMg6bOlx/0xyq0V 5hXJ12TNMCpTx1XjHe8pAFMeg+XgXYQyCfTQUqVZ4LZxIRPW01LrK47XlI4XPU6zbPJX kLJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v5-20020a634805000000b00578e0ff59bbsi416462pga.865.2023.12.06.12.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 76FA4802B055; Wed, 6 Dec 2023 12:41:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbjLFUlM convert rfc822-to-8bit (ORCPT + 99 others); Wed, 6 Dec 2023 15:41:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjLFUlL (ORCPT ); Wed, 6 Dec 2023 15:41:11 -0500 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964B3135; Wed, 6 Dec 2023 12:41:17 -0800 (PST) Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-1fb00ea5e5fso36422fac.1; Wed, 06 Dec 2023 12:41:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701895277; x=1702500077; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FlhVPOODXTOWxGwKg9e3DDYoZLed8F9HR5wooT/tC2c=; b=QLC4wXqyj/T8ERSCaT7olfK+3lA8UwpoXB7yz0AAwp9s41jtJEIZ0nGNDNqkf9IKaX pO3DYMFWoN/hEYFHyxxsxn70XMsvBAewB85IPXIkiGG6HsDQBxyouDKpANkE8mG/e01z F9UZoa186LfyntFwwBseS4ZLUyI4Tgl2H8sYOXmY/Icn/dXAtxPfcx6Vpar6/snBLd/9 EXghDuJcMZUaMRdow4CBWUDhevVBzJ5L7RXdTn/xd0sFhZwxq+PqerIUYOi7RVDcDj6Q YBu5M469OzMmEuVSMVjo6G0BTlPOKjKhYNPWPPVP24aB3yhSAYVbkGZDozU53PFSIUar qCtA== X-Gm-Message-State: AOJu0YyC/X50n+EwCgqqu/iNslLDPh4wo3dUVPTCzL8KXtxzKldPFF2Z gzcURKA5Dz9s8ldd9QO4yGjlnJ5z/MfxR/SJ5gs= X-Received: by 2002:a05:6870:b4a0:b0:1fb:5e42:5096 with SMTP id y32-20020a056870b4a000b001fb5e425096mr2586685oap.5.1701895276869; Wed, 06 Dec 2023 12:41:16 -0800 (PST) MIME-Version: 1.0 References: <20231127160838.1403404-1-beata.michalska@arm.com> <20231127160838.1403404-3-beata.michalska@arm.com> In-Reply-To: <20231127160838.1403404-3-beata.michalska@arm.com> From: "Rafael J. Wysocki" Date: Wed, 6 Dec 2023 21:41:05 +0100 Message-ID: Subject: Re: [PATCH v2 2/2] cpufreq: Wire-up arch-flavored freq info into cpufreq_verify_current_freq 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, ionela.voinescu@arm.com, yang@os.amperecomputing.com, linux-tegra@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 12:41:25 -0800 (PST) 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? Any problem statement? > 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. > 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); ? > if (!new_freq) > return 0; > > --