Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4664157pxj; Tue, 22 Jun 2021 05:30:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR8A0ikNoZynOKsEXBkffRbjSfvfBlFxWf+VkAYsT9fuWa+EiQkQcoPedrM/3sLWi2q05A X-Received: by 2002:aa7:c997:: with SMTP id c23mr4663074edt.42.1624365003788; Tue, 22 Jun 2021 05:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624365003; cv=none; d=google.com; s=arc-20160816; b=fw5Iz4PgZ2q9uvZIe2VlpSpVq2PtRM5Zoc34cz87l0bRra8KAjPm7Ri3jfADIK+Dpr 9Ks7V0sCKw7HltUEMyjeDURniqO4xppzzTq49UoRPXAsijiRz1rnseEvqEq54vxvwTKf zAJ9GlqLR1I7ur7+Fu2CV3MGSqA09YuxOVUSwHL1357HHgFSldYmERzanZPgxnvNjilb 6DXoFrxWXYNhisMKxDKdPdSnr8TMWX6iDkhhtqV6J16omjILPEj08nsOauI4ZDR19d7L 6K3xW7zyb0sUZ0aSsW4+q9nIWiSjhNRChYyoDj69wQFBBJRj3clmEofNQUm7Kx/MR+YC ZFhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=cHtNQpCSXG22FMwHUu24sGvKayaAtRpBNbls39GRY0k=; b=pkdSQmCGCyb/REWf9RIkL/1gbxtt59obK741uN/hoFxMXPOWr1xp1hPjsuuacCsq8l lIAxn0W6Al6YjoNZymlYOW6yp87OEZilbQ7vncdchgX3NIBNWPxXmHoQ/Km0PlkQGrGH wte7LXm87SBQi5jG4mN1+3tVjsnUWXsFd1H8RppOf8PaYPy+n6HsYLo3IxH7DiQ9RWV9 Atc9ME+PIDzT1v8hGd3cQeBDcAKyVNuHgOk2mtM65/tYYyqUZVPSoo/9gZvJFuk65RdZ ofADwcHNuRiFPpDMfJU2AKXomES+SV5BTpMEaJ56tFo7P9zMcMajJv3srMiyQPqLaGVA diow== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si1354733ede.159.2021.06.22.05.29.40; Tue, 22 Jun 2021 05:30:03 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbhFVMak (ORCPT + 99 others); Tue, 22 Jun 2021 08:30:40 -0400 Received: from mail-ot1-f45.google.com ([209.85.210.45]:42861 "EHLO mail-ot1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbhFVMaj (ORCPT ); Tue, 22 Jun 2021 08:30:39 -0400 Received: by mail-ot1-f45.google.com with SMTP id w23-20020a9d5a970000b02903d0ef989477so20949762oth.9; Tue, 22 Jun 2021 05:28:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cHtNQpCSXG22FMwHUu24sGvKayaAtRpBNbls39GRY0k=; b=fxRUVIhQfUbgt5T28jgXCetyExXj9U+0+MbKqK+yaXfRNHrGdaD/U+T68jXd3KPnDc 0K57wLEUozn5sflb8WAq6TqjWVbVYB059M7mX8LIjaG9614rUP5FKagJSt3IcuyS7anR IuYcBb99Llp06nSdT2YBbDcvb433K+k1/rDvJ1xiE+EHZFaIp3FsJTbCobFO5O3Dh5Mq qAQ7EF9w6dkHKsIgU4AMp6rFXzWCkU/rtPZBFr0I8dnpwxax7wRrVccL5FAhobbzTlHH mQZt9oTWifEzVukglDcanE5yMre3teo2iA403N9Dm7tAgywcT+gUam8fb/hMqNIrtnDb 8nFA== X-Gm-Message-State: AOAM531NUKTy0qzycz/5Hv3S2P1Lw1MdW0ssG8AlDVjUDNd1W0dCm63V COWj7GSK3B3ZHVxZ9AXO0LkzN2eQA/nK/61dpOU= X-Received: by 2002:a05:6830:1bf7:: with SMTP id k23mr3061137otb.206.1624364903953; Tue, 22 Jun 2021 05:28:23 -0700 (PDT) MIME-Version: 1.0 References: <20210622075925.16189-1-lukasz.luba@arm.com> <20210622075925.16189-4-lukasz.luba@arm.com> In-Reply-To: <20210622075925.16189-4-lukasz.luba@arm.com> From: "Rafael J. Wysocki" Date: Tue, 22 Jun 2021 14:28:11 +0200 Message-ID: Subject: Re: [RFC PATCH 3/4] cpufreq: Add Active Stats calls tracking frequency changes To: Lukasz Luba 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, when the CPU > was not idle, at a given performance level. This patch adds needed calls > which provide the CPU frequency transition events to the Active Stats > framework. > > Signed-off-by: Lukasz Luba > --- > drivers/cpufreq/cpufreq.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 802abc925b2a..d79cb9310572 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -14,6 +14,7 @@ > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > +#include > #include > #include > #include > @@ -387,6 +388,8 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, > > cpufreq_stats_record_transition(policy, freqs->new); > policy->cur = freqs->new; > + > + active_stats_cpu_freq_change(policy->cpu, freqs->new); > } > } > > @@ -2085,6 +2088,8 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, > policy->cpuinfo.max_freq); > cpufreq_stats_record_transition(policy, freq); > > + active_stats_cpu_freq_fast_change(policy->cpu, freq); > + This is quite a bit of overhead and so why is it needed in addition to the code below? And pretty much the same goes for the idle loop change. There is quite a bit of instrumentation in that code already and it avoids adding new locking for a reason. Why is it a good idea to add more locking to that code? > if (trace_cpu_frequency_enabled()) { > for_each_cpu(cpu, policy->cpus) > trace_cpu_frequency(freq, cpu); > --