Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6999083imm; Tue, 24 Jul 2018 06:51:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjvrnzMnY8JVSw0uwYaW3hA2+rhaz6pTWdkGRvC53TKzeEq8II+clEDqpfhRWVEIIlEI49 X-Received: by 2002:a62:170c:: with SMTP id 12-v6mr17757666pfx.139.1532440271379; Tue, 24 Jul 2018 06:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532440271; cv=none; d=google.com; s=arc-20160816; b=YDFitbUi5xLylTdmRKnlku1VHeyyUb3R+CEjRwu9j0nEbdBUH0rZ0Obsj85+8+x+JG IhXi5CtE3VP91pqa+pAsnODGqlAxEUFd3Lkt14XCYPehUD/HAesLg4jTXy0R50+00OZh gA+kVyG3kaH3iZQpoHw1So808UTXk2izZqadBVnX6gocEhqgfPaWt9oE1nvfz3aRRqrJ kNJHvYzl/pFHQzGlpS2p9T7QcgJeK9UA9bgassmNZVsdaKr8TKQzcBr98vxjhpfPnbhd o2zPqQoFMt9YUlSrI2yalcw/eeZ6Qlu/QRBB102++8lf3D7n9Gi0ox1m1fTHErFjb4LU PASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=oin0+Ex9nloMfLtg9qMDMZIK0jpe5F2VAUrDTFSJev4=; b=wf8sb8Z1EwAmdwJDwN2IsZeZC9nfXVFfvwO1MNfn7cZ8K4vkqIeqhVdpKEQZ+Hn4yC CCsyCfe6ZC1JROuRYdV9kudgjYiL5wWYoaKcM9CrQLOhXfsrebeWdL84TVz7718bfcDD DbHiBTKgOe00kYl1+vfCZeifaj3lu9XwQsqdZi8zDZ8iwBxUu0wg7fcsasb+7pdSjQzm J9wJENwXOIEop0lG1YSMs9Q51PWT238YlQI3nj9JSr2F2ftM4GrGC/ePOyO23Guj0sLz eI1FYjbYlpgJIzBwtWeIfW64K3ssXuOZQLuJ6CG5eEH98sxSh9xcqQHj9t6ODJPf/05P WPxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si2680584plr.75.2018.07.24.06.50.56; Tue, 24 Jul 2018 06:51:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388470AbeGXO4K (ORCPT + 99 others); Tue, 24 Jul 2018 10:56:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:58734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388315AbeGXO4K (ORCPT ); Tue, 24 Jul 2018 10:56:10 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E596120874; Tue, 24 Jul 2018 13:49:33 +0000 (UTC) Date: Tue, 24 Jul 2018 09:49:32 -0400 From: Steven Rostedt To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Ruchi Kandoi , Ingo Molnar , Jonathan Corbet , linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Viresh Kumar Subject: Re: [PATCH v2] cpufreq: trace frequency limits change Message-ID: <20180724094932.11e10452@gandalf.local.home> In-Reply-To: <20180720222114.200311-1-joel@joelfernandes.org> References: <20180720222114.200311-1-joel@joelfernandes.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Jul 2018 15:21:14 -0700 Joel Fernandes wrote: > From: Ruchi Kandoi > > systrace used for tracing for Android systems has carried a patch for > many years in the Android tree that traces when the cpufreq limits > change. With the help of this information, systrace can know when the > policy limits change and can visually display the data. Lets add > upstream support for the same. > > Signed-off-by: Ruchi Kandoi > Signed-off-by: Joel Fernandes (Google) > --- > v1->v2: Minor changes suggested by Viresh > > Documentation/trace/events-power.rst | 1 + > drivers/cpufreq/cpufreq.c | 1 + > include/trace/events/power.h | 25 +++++++++++++++++++++++++ > 3 files changed, 27 insertions(+) > > diff --git a/Documentation/trace/events-power.rst b/Documentation/trace/events-power.rst > index a77daca75e30..2ef318962e29 100644 > --- a/Documentation/trace/events-power.rst > +++ b/Documentation/trace/events-power.rst > @@ -27,6 +27,7 @@ cpufreq. > > cpu_idle "state=%lu cpu_id=%lu" > cpu_frequency "state=%lu cpu_id=%lu" > + cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu" > > A suspend event is used to indicate the system going in and out of the > suspend mode: > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index b0dfd3222013..4fd935df101e 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2236,6 +2236,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, > > policy->min = new_policy->min; > policy->max = new_policy->max; > + trace_cpu_frequency_limits(policy->min, policy->max, policy->cpu); Wouldn't it make more sense just to pass in "policy"? > > policy->cached_target_freq = UINT_MAX; > > diff --git a/include/trace/events/power.h b/include/trace/events/power.h > index 908977d69783..f5bec45108b6 100644 > --- a/include/trace/events/power.h > +++ b/include/trace/events/power.h > @@ -148,6 +148,31 @@ DEFINE_EVENT(cpu, cpu_frequency, > TP_ARGS(frequency, cpu_id) > ); > > +TRACE_EVENT(cpu_frequency_limits, > + > + TP_PROTO(unsigned int min_freq, unsigned int max_freq, > + unsigned int cpu_id), > + > + TP_ARGS(min_freq, max_freq, cpu_id), > + > + TP_STRUCT__entry( > + __field(u32, min_freq) > + __field(u32, max_freq) > + __field(u32, cpu_id) > + ), > + > + TP_fast_assign( > + __entry->min_freq = min_freq; > + __entry->max_freq = max_freq; > + __entry->cpu_id = cpu_id; Then have here: __entry->min_freq = policy->min; __entry->max_freq = policy->max; __entry->puc_id = policy->cpu; It would also make the footprint of the tracepoint in the code smaller as it would pass fewer parameters to the trace event. -- Steve > + ), > + > + TP_printk("min=%lu max=%lu cpu_id=%lu", > + (unsigned long)__entry->min_freq, > + (unsigned long)__entry->max_freq, > + (unsigned long)__entry->cpu_id) > +); > + > TRACE_EVENT(device_pm_callback_start, > > TP_PROTO(struct device *dev, const char *pm_ops, int event),