From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 018E8C5472F for ; Mon, 26 Aug 2024 08:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yoUz9Nvk/4TqR2DU81b86vbIiuM85MTWTo7qq2tasaE=; b=M53qOIh4nGc7BSrxqrGsUstgwZ UHUvvkJBGkAl6TyVfo3s8pAiP5TRzmKumu1D9APaI98wLjZ51tFReUyKjHfJfXq4CnyAHncVty3DJ DXaj5MvmjbQBEtezxSJm0ItV6BRFoZnr/KcoVTAvVckFrbTFXAMiImiy/mxScvGAL9cV13E8FAbTl 2SYj36M63C0hQj/QWFs3D+hPxqFNW6eCn06Kx7dZKERawu3rEiKc8Cka2Dj3bddikFPQWPOYr+go3 07Gfr5LFdJGon9DO85+VTnCc4NumPGYPxVgUvIHEBJ2qqah3mPWwyQfUXpDmM7rv7pvMYfOzZUHXz 6pl7LbUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siV7J-00000006VHC-0Ray; Mon, 26 Aug 2024 08:30:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siU5K-00000006FjI-0nHn for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 07:24:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yoUz9Nvk/4TqR2DU81b86vbIiuM85MTWTo7qq2tasaE=; b=YJXuyktpCi1E9fZUgS88RpcJBo 3KHWKCrGeUOiqywng/ZPuwk7Sl5lZL8WaxFtkjpQZ+Jqgw1IZG+fEA25fUdlzir6vNareHeyEKygS mDRGHDsQ5uExL2U0Br97GXTmTSG1VqiXLR+xUW2eLncoL2YvBmMQM+suRANg2i3hV/omFv8De9TSV fI34hLwrp1VBIl7o/mtNiI7e+LXTU3lmr2uKJEKbkbfNn8irFYIF8BwMs0sOTzgktF7PSXamIAQRV YIO58J3YVWTnuDj2ToiV58totLwLcyeMcjB39rXTL2pZCZj+3pwGyt8+oBrGf3wd1LWfS5l+sddZO sbQJ1Xfg==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siU5D-0000000Aa7v-3tJa for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 07:24:16 +0000 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 05783339; Mon, 26 Aug 2024 00:24:36 -0700 (PDT) Received: from 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 A78673F66E; Mon, 26 Aug 2024 00:24:06 -0700 (PDT) Date: Mon, 26 Aug 2024 09:24:00 +0200 From: Beata Michalska To: Jie Zhan Cc: Catalin Marinas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ionela.voinescu@arm.com, sudeep.holla@arm.com, will@kernel.org, vincent.guittot@linaro.org, vanshikonda@os.amperecomputing.com, sumitg@nvidia.com, yang@os.amperecomputing.com, lihuisong@huawei.com, viresh.kumar@linaro.org, rafael@kernel.org Subject: Re: [PATCH v6 0/4] Add support for AArch64 AMUv1-based arch_freq_get_on_cpu Message-ID: References: <20240603082154.3830591-1-beata.michalska@arm.com> <8500d58c-e6c5-04c7-73a0-38d3f77f2cb7@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8500d58c-e6c5-04c7-73a0-38d3f77f2cb7@hisilicon.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_082413_051123_48141D75 X-CRM114-Status: GOOD ( 34.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 14, 2024 at 04:05:24PM +0800, Jie Zhan wrote: > > On 11/07/2024 21:59, Beata Michalska wrote: > > Hi Catalin, > > > > On Mon, Jul 08, 2024 at 06:10:02PM +0100, Catalin Marinas wrote: > > > Hi Beata, > > > > > > On Mon, Jun 03, 2024 at 09:21:50AM +0100, Beata Michalska wrote: > > > > Introducing arm64 specific version of arch_freq_get_on_cpu, cashing on > > > > existing implementation for FIE and AMUv1 support: the frequency scale > > > > factor, updated on each sched tick, serves as a base for retrieving > > > > the frequency for a given CPU, representing an average frequency > > > > reported between the ticks - thus its accuracy is limited. > > > > > > > > The changes have been rather lightly (due to some limitations) tested on > > > > an FVP model. Note that some small discrepancies have been observed while > > > > testing (on the model) and this is currently being investigated, though it > > > > should not have any significant impact on the overall results. > > > What's the plan with this series? Are you still investigating those > > > discrepancies or is it good to go? > > > > > Overall it should be good to go with small caveat: > > as per discussion [1] we might need to provide new sysfs attribute exposing an > > average frequency instead of plugging new code under existing cpuinfo_cur_freq. > > This is to avoid messing up with other archs and make a clean distinction on > > which attribute provides what information. > > As such, the arch_freq_get_on_cpu implementation provided within this series > > [PATCH v6 3/4] will most probably be shifted to a new function. > > > > Hopefully will be able to send those changes soon. > > > > --- > > [1] https://lore.kernel.org/all/ZmrB_DqtmVpvG30l@arm.com/ > > --- > > BR > > Beata > > > > > -- > > > Catalin > > > > Hi Beata, Hi Jie, > > I've recently tested this patchset on a Kunpeng system. > It works as expected when reading scaling_cur_freq. > The frequency samples are much stabler than what cppc_cpufreq returns. Thank you for giving it a spin. (and apologies for late reply) > > A few minor things. > > 1. I observed larger errors on idle cpus than busy cpus, though it's just up > to 1%. > Not sure if this comes from the uncertain time interval between the last > tick and entering idle. > The shorter averaging interval, the larger error, I supposed. All right - will look into it. Just for my benefit: that diff is strictly between arch_freq_avg_get_on_cpu and cpufreq_driver->get(policy->cpu) ? > > 2. In the current implementation, the resolution of frequency would be: > max_freq_khz / SCHED_CAPACITY_SCALE > This looks a bit unnecessary to me. > > It's supposed to get a better resolution if we can do this in > arch_freq_get_on_cpu(): > > freq = delta_cycle_cnt * max_freq_khz / delta_const_cnt > > which may require caching both current and previous sets of counts in the > per-cpu struct amu_cntr_sample. > arch_freq_get_on_cpu relies on the frequency scale factor to derive the average frequency. The scale factor is being calculated based on the deltas you have mentioned and arch_max_freq_scale which uses SCHED_CAPACITY_SCALE*2 factor to accommodate for rather low reference frequencies. arch_freq_get_on_cpu just does somewhat reverse computation to that. --- BR Beata > Kind regards, > Jie >