From patchwork Fri Jul 20 22:21:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10538539 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 38BEE6053F for ; Fri, 20 Jul 2018 22:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EAC92907F for ; Fri, 20 Jul 2018 22:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB0E7295B5; Fri, 20 Jul 2018 22:22:20 +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 835C6295B5 for ; Fri, 20 Jul 2018 22:22:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbeGTXMf (ORCPT ); Fri, 20 Jul 2018 19:12:35 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:34653 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728353AbeGTXMe (ORCPT ); Fri, 20 Jul 2018 19:12:34 -0400 Received: by mail-pl0-f68.google.com with SMTP id f6-v6so5739055plo.1 for ; Fri, 20 Jul 2018 15:22:19 -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=Q6LT1JT9/AC23wv/j/yb4s9egokrPdXmkX3KFr2QR7E=; b=wWoO7PMWR8BMbgjvOfQylj0DxZAMUbuqAmhcErn2wxUcek62DR6zQQXNUDlAcbua9r sSAlQhJ2SIkB4cddskFS7pjvSt7EAmE+Yzvxtb8/rWTvWoEE6DUdSVsZuuIww5PQDzL1 Nm2An6HGaEYO3jpdIFSCd4do6+4fa6lP/zs1k= 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=Q6LT1JT9/AC23wv/j/yb4s9egokrPdXmkX3KFr2QR7E=; b=q5yFoNX3ZUtA4L7ItyXhsl/Tr8Mn7u2bHFypx4dgWgZelM0YwJua87M/213YGBw5bL Tkz5L1eaW78efIxSHL6Z4PZurV8CKdUFjhTLDNgFgdL0CrBk4LIJuZveJ/wntBYwxO7p RawxRg/9v21g1ZrjqwPJI+0KD/+DY2UFHsIcalUvDOb+ggQ/SWVunQAsZiZfoaFuOmJp 7jLMYjEMFrmiKS3l+VvaiwYUYsaDg4lHfLPAQPDgtpLgc1yma8hSqQQ3w1jEXnCeGZnq 5NwDKDJlZQ/P6m4eH+Q3iuPREyhy+EZjDKOJDzDWzSjarPc961xfKJ/IgcAYCfRX/l0+ bXPg== X-Gm-Message-State: AOUpUlFSn5fkJ4RTSF7ha3LjdDZZFwZ1qur8qmHg6jdiKZ3U+iokjS9j tnMJfdsvEZaI0mbscMPs8bPT7A== X-Google-Smtp-Source: AAOMgpfcdT5EMMYOGrpA8IYX7tVc4wgjBZw3Kfm/0efPnQUSJURgH6GKX/fuye42nFdl/IDBJvNk4w== X-Received: by 2002:a17:902:5381:: with SMTP id c1-v6mr3627149pli.137.1532125338871; Fri, 20 Jul 2018 15:22:18 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id b62-v6sm9135812pfm.97.2018.07.20.15.22.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 15:22:18 -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 v2] cpufreq: trace frequency limits change Date: Fri, 20 Jul 2018 15:21:14 -0700 Message-Id: <20180720222114.200311-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 --- 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); 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; + ), + + 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),