From patchwork Thu Jul 19 19:59:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10535267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 05770600F4 for ; Thu, 19 Jul 2018 20:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8F4729D72 for ; Thu, 19 Jul 2018 20:00:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF9B29D7D; Thu, 19 Jul 2018 20:00:17 +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 7A76629D72 for ; Thu, 19 Jul 2018 20:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727449AbeGSUoz (ORCPT ); Thu, 19 Jul 2018 16:44:55 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33664 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727485AbeGSUoz (ORCPT ); Thu, 19 Jul 2018 16:44:55 -0400 Received: by mail-pg1-f196.google.com with SMTP id r5-v6so4701307pgv.0 for ; Thu, 19 Jul 2018 13:00:15 -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=I75kxmBTru1UzX2PQRe3XdnyeGupJQzpnNNYnAgGGLg=; b=ZS9Et4pUmgr/FSYDih5UtMKXideAWa8ZeeI8iZXwv4CkaWbVjAOpQPTXjsZKoCohLu yHVfxxdwLa5GnVaVSxD+zbQ+Dfxrt0sVMcMvC31hM+zssmJDvfLYkhDxQTgD3k8MxuUj K1usnZ4X8HrlucJLz7i4heVgB+uxsbVbV/xao= 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=I75kxmBTru1UzX2PQRe3XdnyeGupJQzpnNNYnAgGGLg=; b=jdNJetXDYw6yffdf784ER5VEIjNctTbcAuZOKMn3Pl+/irPdSulh4ZRkwpJojyoHkA Xkv9exHW/wQmLsb4daVcYexq08dBQb3cr+0+4EVvSBhFJV/YhnII5K/w2PfFmfB5kh9m XERUOpC7uBDPmD0ZvH2fdTaUSYt1eWvPmFVHEj++9cyhXfASOCClnPFKqwavD08sHkM2 /SMEzV70vB8vppO5OkCzeeR3prDv7FfdGWcq9wA608+YtGQvCKoo+H8fPBdmbk5r/Azf 17LUTOKlIr6XBuZ+zQsNqB6Y/uC3dfzOomSPy03QybY11QP6rn6cvuEX81qkf0CxXxk3 QZ5Q== X-Gm-Message-State: AOUpUlFOH6nbBYEpj4m/DDXM7UYNROCaf8W+JjxIf/1By4PSWmgSmMzW XvshmX8C+3CkWBToCzSG/9xchA== X-Google-Smtp-Source: AAOMgpcO1AH75HpcnXi3yE/HOWglb6fxGeKqQik7cozriRvPgUTI26zwXmNN+xUtrycyrs8QtGyCIQ== X-Received: by 2002:a62:f0d:: with SMTP id x13-v6mr10777303pfi.123.1532030415613; Thu, 19 Jul 2018 13:00:15 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id x4-v6sm15379pfm.119.2018.07.19.13.00.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 13:00:15 -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 RFC] cpufreq: trace frequency limits change Date: Thu, 19 Jul 2018 12:59:57 -0700 Message-Id: <20180719195957.59000-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-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) --- 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..6533c6987866 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->max, policy->min, policy->cpu); policy->cached_target_freq = UINT_MAX; diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 908977d69783..e978b05b0200 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 max_freq, unsigned int min_freq, + unsigned int cpu_id), + + TP_ARGS(max_freq, min_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; + ), + + 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),