From patchwork Tue Jul 24 17:35:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10542771 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CEF1157A for ; Tue, 24 Jul 2018 17:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A61328CBD for ; Tue, 24 Jul 2018 17:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E1CC28E93; Tue, 24 Jul 2018 17:36:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3C0B28CBD for ; Tue, 24 Jul 2018 17:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388407AbeGXSnf (ORCPT ); Tue, 24 Jul 2018 14:43:35 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37066 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388415AbeGXSnf (ORCPT ); Tue, 24 Jul 2018 14:43:35 -0400 Received: by mail-pg1-f194.google.com with SMTP id n7-v6so3387939pgq.4 for ; Tue, 24 Jul 2018 10:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id; bh=drQgHff0Z7JTZYtCB2EFIHygtH5rcojdmre/pe07yT0=; b=keKfup2uinI29UnVDia9wxrDXzyc5E9b1ejjK4AAUOHcfmeUKFYZLZ4TZF4FQQzBFF D4OisbPiML/UnZamBt0mU5EcOjwygfuVsC93YpQIa6wYQ9gQGWDGgfOK8XGnPCiTw/B+ n8etUDrT7fEYccI8xcVV4sKloKauaK5hC7sls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=drQgHff0Z7JTZYtCB2EFIHygtH5rcojdmre/pe07yT0=; b=Q9cLsZEpfUr44sK00xL6ptHmg3GdetxvYx/JPzekKwemJC9iK62Yq7zSgg+I85EIcw Fnzql+5FTFcf9u4m2RXLlDCh737VgpjadP05pKmAoZuexbHqmMRhQuBo9+l2TRGaVn66 yohMpoXmgjMpBiQmnsbx+BS36MWXAH9nL7DOqFqKzP/ZrMFr9hnu+Zvx05qTb5F6K0+w 42oqXTCTIp2BoMOCQLMlHOXDTf1MIGUHjW0iWrq50oFO1Xt0kdWezH5Teb5Jrv2NrNRW MiSzKftJFNLx86SNjUgjIb/nTRuRg5NL+oRmxnlohlF4qU9s3VIQ5VGGo7v1OXAfmALv ohaw== X-Gm-Message-State: AOUpUlEfqGexLqhlQNl7+YLmPXmpQxXITTCfxAbr4Z87QEGwkO2LFswK Ixori4PuORVTWNBWE6Ekkcwz1A== X-Google-Smtp-Source: AAOMgpex18OY1o9C5cko5tmcESmLSGrIUKcg2jsI6DCWycA3CO4tI+ch7vUd7u9HIJoMdGkkwnwgwg== X-Received: by 2002:a62:6b44:: with SMTP id g65-v6mr18582910pfc.226.1532453762429; Tue, 24 Jul 2018 10:36:02 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id h10-v6sm23151306pfj.78.2018.07.24.10.36.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 10:36:01 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Ruchi Kandoi , Joel Fernandes , Ingo Molnar , Jonathan Corbet , linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Steven Rostedt , Viresh Kumar Subject: [PATCH v3] cpufreq: trace frequency limits change Date: Tue, 24 Jul 2018 10:35:44 -0700 Message-Id: <20180724173544.18876-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) Acked-by: Viresh Kumar Acked-by: Steven Rostedt (VMware) --- Viresh since I changed the patch, could you Ack it again? v2->v3: reduce parameters to tracepoint call (Steve) v1->v2: correct ordering of min/max (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..52566f1f1050 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); policy->cached_target_freq = UINT_MAX; diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 908977d69783..f7aece721aed 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -5,6 +5,7 @@ #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_POWER_H +#include #include #include #include @@ -148,6 +149,30 @@ DEFINE_EVENT(cpu, cpu_frequency, TP_ARGS(frequency, cpu_id) ); +TRACE_EVENT(cpu_frequency_limits, + + TP_PROTO(struct cpufreq_policy *policy), + + TP_ARGS(policy), + + TP_STRUCT__entry( + __field(u32, min_freq) + __field(u32, max_freq) + __field(u32, cpu_id) + ), + + TP_fast_assign( + __entry->min_freq = policy->min; + __entry->max_freq = policy->max; + __entry->cpu_id = policy->cpu; + ), + + 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),