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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A04C48BE5 for ; Tue, 22 Jun 2021 13:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F113061357 for ; Tue, 22 Jun 2021 13:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231387AbhFVOBR (ORCPT ); Tue, 22 Jun 2021 10:01:17 -0400 Received: from foss.arm.com ([217.140.110.172]:49662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbhFVOBQ (ORCPT ); Tue, 22 Jun 2021 10:01:16 -0400 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 232A5ED1; Tue, 22 Jun 2021 06:59:00 -0700 (PDT) Received: from [10.57.7.129] (unknown [10.57.7.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 124733F694; Tue, 22 Jun 2021 06:58:57 -0700 (PDT) Subject: Re: [RFC PATCH 2/4] cpuidle: Add Active Stats calls tracking idle entry/exit To: "Rafael J. Wysocki" Cc: Linux Kernel Mailing List , Daniel Lezcano , Linux PM , Amit Kucheria , "Zhang, Rui" , Dietmar Eggemann , Chris Redpath , Beata.Michalska@arm.com, Viresh Kumar , "Rafael J. Wysocki" , Amit Kachhap References: <20210622075925.16189-1-lukasz.luba@arm.com> <20210622075925.16189-3-lukasz.luba@arm.com> From: Lukasz Luba Message-ID: <2f7d855c-5232-ddbe-8403-db3596dcebc5@arm.com> Date: Tue, 22 Jun 2021 14:58:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/22/21 1:33 PM, Rafael J. Wysocki wrote: > On Tue, Jun 22, 2021 at 9:59 AM Lukasz Luba wrote: >> >> The Active Stats framework tracks and accounts the activity of the CPU >> for each performance level. It accounts the real residency, > > No, it doesn't. It just measures the time between the entry and exit > and that's not the real residency (because it doesn't take the exit > latency into account, for example). It's 'just' a 'model' and as other models has limitations, but it's better than existing one, which IPA has to use: cpu_util + currect_freq_at_sampling_time > >> when the CPU was not idle, at a given performance level. This patch adds needed calls >> which provide the CPU idle entry/exit events to the Active Stats >> framework. > > And it adds overhead to overhead-sensitive code. > > AFAICS, some users of that code will not really get the benefit, so > adding the overhead to it is questionable. > > First, why is the existing instrumentation in the idle loop insufficient? The instrumentation (tracing) cannot be used at run time AFAIK. I need this idle + freq information combined in a running platform, not for post-processing (like we have in LISA). The thermal governor IPA would use them for used power estimation. > > Second, why do you need to add locking to this code? The idle entry/exit updates the CPU's accounting data structure. There is a reader of those data structures: thermal governor, run from different CPU, which is the reason why I put locking for them.