Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4735528pxj; Tue, 22 Jun 2021 06:59:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf5YKFDnlatR4Z6mpfVvgaNfL6HmBg1bSfIncXSmQVHCzqbJKQeZ8427ivGu1IopEYLUyl X-Received: by 2002:a05:6e02:1be4:: with SMTP id y4mr2676517ilv.247.1624370394303; Tue, 22 Jun 2021 06:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624370394; cv=none; d=google.com; s=arc-20160816; b=0UCte9oD8ULqROYpUdnpzOkj5TN2ySdGE3pSmgaG3GsnBtwpSacqRrLJ9OJX9XTqfT dzdBPUmeIV6bFbLaqtED+FXq83WR2H1Lp2ivkCb6F81FtqHvWp+dsrCqaq5RccOBNVDz 8ee5TCYbk+yvPD1FMRgBJn7741wNURSeb4gwycc4EfjZWik3gUC+GR/9T3x5Rc0VkHn7 11o+RtYMYr3Tndnbix6rONF8z3zh31WwXC5oSzXMWqyb8W8NSnuCTvzPefR0TjzTnDsL eFecehdJ0+WY3PirSwdfBEYprXPH4K/SNdkyToxiu1uSuH1aMbTL1kYz+cNdeLXfwWL3 OaCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AgStD5uf4NxYGoLiL2Q86kzb8gpXU4KXrZSSO8xHVCE=; b=F4hJKwXEy+Ewo3vTBRnDhqv3ylx0bKEAJ85P1QnYpBnHpgMnumCl3FVhhWiYDsp193 SO9dRi9tdNByQp7VP9Qf7HF804Ntb6AYmubCvODHln8HsP5Ld7HkezQ/aQJKu6xE/v+/ LQKOaoWWOffUEgwrqq79111ofavwjtMcp4MasFJPvX55lZQ0GjegNmyw+6o55blv6HJ5 dYyaoLr+s0oq0z7jf8HDlTLknXDEdiHDPzbveoIJJutZWQJjJxsZwRCC5vo/t7hJ+RWJ +jaysUBY3H9jOhHhCWb2eGvEPNtvJ4QHtZDWoxvydprjZNSVtcZZUBq9NbL1C4XJlbD9 wETg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w34si11368840jal.91.2021.06.22.06.59.40; Tue, 22 Jun 2021 06:59:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbhFVOBQ (ORCPT + 99 others); Tue, 22 Jun 2021 10:01:16 -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.