]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: podgov: Add dev to trace events
authorArto Merilainen <amerilainen@nvidia.com>
Fri, 28 Mar 2014 06:57:30 +0000 (08:57 +0200)
committerGerrit Code Review <gerrit2@nvidia.com>
Fri, 11 Apr 2014 08:03:16 +0000 (01:03 -0700)
The trace events currently hold only the scaling statistics but they
do not tell which device was involved. Origianlly this was ok as
the policy was used only by the gpu, however, we use currently the
policy for scaling also vic.

Change-Id: I032ecb6bb6306f078d3525475284b67c69d6bac2
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
drivers/video/tegra/host/pod_scaling.c
include/trace/events/nvhost_podgov.h

index 4b883c156549dfa3c6c9e56ac379c3a9083de660..d0823f0fe7cc248626c0d72b90582db762e88d57 100644 (file)
@@ -209,7 +209,7 @@ static void podgov_enable(struct devfreq *df, int enable)
 
        podgov = df->data;
 
-       trace_podgov_enabled(enable);
+       trace_podgov_enabled(df->dev.parent, enable);
 
        /* bad configuration. quit. */
        if (df->min_freq == df->max_freq)
@@ -261,7 +261,7 @@ static void podgov_set_user_ctl(struct devfreq *df, int user)
        mutex_lock(&df->lock);
        podgov = df->data;
 
-       trace_podgov_set_user_ctl(user);
+       trace_podgov_set_user_ctl(df->dev.parent, user);
 
        /* store the new user value */
        old_user = podgov->p_user;
@@ -309,7 +309,7 @@ static void podgov_set_freq_request(struct devfreq *df, int freq_request)
 
        podgov = df->data;
 
-       trace_podgov_set_freq_request(freq_request);
+       trace_podgov_set_freq_request(df->dev.parent, freq_request);
 
        podgov->p_freq_request = freq_request;
 
@@ -351,7 +351,7 @@ static unsigned long scaling_state_check(struct devfreq *df, ktime_t time)
 
        /* calculate and trace load */
        load = 1000 - podgov->idle_avg;
-       trace_podgov_busy(load);
+       trace_podgov_busy(df->dev.parent, load);
        damp = podgov->p_damp;
 
        if ((1000 - podgov->idle) > podgov->p_load_max) {
@@ -382,7 +382,8 @@ static unsigned long scaling_state_check(struct devfreq *df, ktime_t time)
        /* Convert to hz, limit, and apply */
        res = res * 1000000;
        scaling_limit(df, &res);
-       trace_podgov_scaling_state_check(df->previous_freq, res);
+       trace_podgov_scaling_state_check(df->dev.parent,
+                                        df->previous_freq, res);
        return res;
 }
 
@@ -493,7 +494,7 @@ static int nvhost_scale3d_set_throughput_hint(struct notifier_block *nb,
                podgov->block > 0)
                goto exit_unlock;
 
-       trace_podgov_hint(podgov->idle, hint);
+       trace_podgov_hint(df->dev.parent, podgov->idle, hint);
        podgov->last_throughput_hint = ktime_get();
 
        curr = df->previous_freq;
@@ -522,14 +523,15 @@ static int nvhost_scale3d_set_throughput_hint(struct notifier_block *nb,
        scaling_limit(df, &target);
        if (target != curr) {
                podgov->block = podgov->p_smooth;
-               trace_podgov_do_scale(df->previous_freq, target);
+               trace_podgov_do_scale(df->dev.parent,
+                                     df->previous_freq, target);
                podgov->adjustment_frequency = target;
                podgov->adjustment_type = ADJUSTMENT_LOCAL;
                update_devfreq(df);
        }
 
-       trace_podgov_print_target(idle, avg_idle, curr / 1000000, target, hint,
-               avg_hint);
+       trace_podgov_print_target(df->dev.parent, idle, avg_idle,
+                                 curr / 1000000, target, hint, avg_hint);
 
 exit_unlock:
        mutex_unlock(&df->lock);
@@ -760,8 +762,9 @@ static int nvhost_pod_estimate_freq(struct devfreq *df,
                    dev_stat.current_frequency)
                        return GET_TARGET_FREQ_DONTSCALE;
 
-               trace_podgov_estimate_freq(df->previous_freq,
-                       podgov->adjustment_frequency);
+               trace_podgov_estimate_freq(df->dev.parent,
+                                          df->previous_freq,
+                                          podgov->adjustment_frequency);
 
                *freq = podgov->adjustment_frequency;
                return 0;
@@ -798,7 +801,7 @@ static int nvhost_pod_estimate_freq(struct devfreq *df,
 
        podgov->last_scale = now;
 
-       trace_podgov_estimate_freq(df->previous_freq, *freq);
+       trace_podgov_estimate_freq(df->dev.parent, df->previous_freq, *freq);
 
 
        return 0;
index e0b9991544477039840144ec7dfab8777b827848..44d528e9ed3f14a519e756cbc8249e202782ec9b 100644 (file)
@@ -1,23 +1,16 @@
 /*
- * include/trace/events/nvhost_podgov.h
- *
  * Nvhost event logging to ftrace.
  *
- * Copyright (c) 2013, NVIDIA Corporation.
+ * Copyright (c) 2013-2014, NVIDIA Corporation.  All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT
+ * This program is distributed in the hope it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #undef TRACE_SYSTEM
 
 #include <linux/ktime.h>
 #include <linux/tracepoint.h>
+#include <linux/device.h>
 
 DECLARE_EVENT_CLASS(podgov_update_freq,
-       TP_PROTO(unsigned long old_freq, unsigned long new_freq),
+       TP_PROTO(struct device *dev, unsigned long old_freq, unsigned long new_freq),
 
-       TP_ARGS(old_freq, new_freq),
+       TP_ARGS(dev, old_freq, new_freq),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(unsigned long, old_freq)
                __field(unsigned long, new_freq)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->old_freq = old_freq;
                __entry->new_freq = new_freq;
        ),
 
-       TP_printk("old_freq=%lu, new_freq=%lu",
-         __entry->old_freq, __entry->new_freq)
+       TP_printk("name=%s, old_freq=%lu, new_freq=%lu",
+         dev_name(__entry->dev), __entry->old_freq, __entry->new_freq)
 );
 
 DEFINE_EVENT(podgov_update_freq, podgov_do_scale,
-       TP_PROTO(unsigned long old_freq, unsigned long new_freq),
-       TP_ARGS(old_freq, new_freq)
+       TP_PROTO(struct device *dev, unsigned long old_freq, unsigned long new_freq),
+       TP_ARGS(dev, old_freq, new_freq)
 );
 
 DEFINE_EVENT(podgov_update_freq, podgov_scaling_state_check,
-       TP_PROTO(unsigned long old_freq, unsigned long new_freq),
-       TP_ARGS(old_freq, new_freq)
+       TP_PROTO(struct device *dev, unsigned long old_freq, unsigned long new_freq),
+       TP_ARGS(dev, old_freq, new_freq)
 );
 
 DEFINE_EVENT(podgov_update_freq, podgov_estimate_freq,
-       TP_PROTO(unsigned long old_freq, unsigned long new_freq),
-       TP_ARGS(old_freq, new_freq)
+       TP_PROTO(struct device *dev, unsigned long old_freq, unsigned long new_freq),
+       TP_ARGS(dev, old_freq, new_freq)
 );
 
 DEFINE_EVENT(podgov_update_freq, podgov_clocks_handler,
-       TP_PROTO(unsigned long old_freq, unsigned long new_freq),
-       TP_ARGS(old_freq, new_freq)
+       TP_PROTO(struct device *dev, unsigned long old_freq, unsigned long new_freq),
+       TP_ARGS(dev, old_freq, new_freq)
 );
 
 TRACE_EVENT(podgov_enabled,
-       TP_PROTO(int enable),
+       TP_PROTO(struct device *dev, int enable),
 
-       TP_ARGS(enable),
+       TP_ARGS(dev, enable),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(int, enable)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->enable = enable;
        ),
 
-       TP_printk("scaling_enabled=%d", __entry->enable)
+       TP_printk("name=%s, scaling_enabled=%d", dev_name(__entry->dev), __entry->enable)
 );
 
 TRACE_EVENT(podgov_set_user_ctl,
-       TP_PROTO(int user_ctl),
+       TP_PROTO(struct device *dev, int user_ctl),
 
-       TP_ARGS(user_ctl),
+       TP_ARGS(dev, user_ctl),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(int, user_ctl)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->user_ctl = user_ctl;
        ),
 
-       TP_printk("userspace control=%d", __entry->user_ctl)
+       TP_printk("name=%s, userspace control=%d", dev_name(__entry->dev), __entry->user_ctl)
 );
 
 TRACE_EVENT(podgov_set_freq_request,
-       TP_PROTO(int freq_request),
+       TP_PROTO(struct device *dev, int freq_request),
 
-       TP_ARGS(freq_request),
+       TP_ARGS(dev, freq_request),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(int, freq_request)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->freq_request = freq_request;
        ),
 
-       TP_printk("freq_request=%d", __entry->freq_request)
+       TP_printk("name=%s, freq_request=%d", dev_name(__entry->dev), __entry->freq_request)
 );
 
 TRACE_EVENT(podgov_busy,
-       TP_PROTO(unsigned long busyness),
+       TP_PROTO(struct device *dev, unsigned long busyness),
 
-       TP_ARGS(busyness),
+       TP_ARGS(dev, busyness),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(unsigned long, busyness)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->busyness = busyness;
        ),
 
-       TP_printk("busyness=%lu", __entry->busyness)
+       TP_printk("name=%s, busyness=%lu", dev_name(__entry->dev), __entry->busyness)
 );
 
 TRACE_EVENT(podgov_hint,
-       TP_PROTO(long idle_estimate, int hint),
+       TP_PROTO(struct device *dev, long idle_estimate, int hint),
 
-       TP_ARGS(idle_estimate, hint),
+       TP_ARGS(dev, idle_estimate, hint),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(long, idle_estimate)
                __field(int, hint)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->idle_estimate = idle_estimate;
                __entry->hint = hint;
        ),
 
-       TP_printk("podgov: idle %ld, hint %d", __entry->idle_estimate,
-               __entry->hint)
+       TP_printk("podgov (%s): idle %ld, hint %d", dev_name(__entry->dev),
+               __entry->idle_estimate, __entry->hint)
 );
 
 TRACE_EVENT(podgov_idle,
-       TP_PROTO(unsigned long idleness),
+       TP_PROTO(struct device *dev, unsigned long idleness),
 
-       TP_ARGS(idleness),
+       TP_ARGS(dev, idleness),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(unsigned long, idleness)
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->idleness = idleness;
        ),
 
-       TP_printk("idleness=%lu", __entry->idleness)
+       TP_printk("name=%s, idleness=%lu", dev_name(__entry->dev), __entry->idleness)
 );
 
 TRACE_EVENT(podgov_print_target,
-       TP_PROTO(long busy, int avg_busy, long curr, long target, int hint,
-               int avg_hint),
+       TP_PROTO(struct device *dev, long busy, int avg_busy, long curr,
+               long target, int hint, int avg_hint),
 
-       TP_ARGS(busy, avg_busy, curr, target, hint, avg_hint),
+       TP_ARGS(dev, busy, avg_busy, curr, target, hint, avg_hint),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(long, busy)
                __field(int, avg_busy)
                __field(long, curr)
@@ -183,6 +192,7 @@ TRACE_EVENT(podgov_print_target,
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->busy = busy;
                __entry->avg_busy = avg_busy;
                __entry->curr = curr;
@@ -191,18 +201,19 @@ TRACE_EVENT(podgov_print_target,
                __entry->avg_hint = avg_hint;
        ),
 
-       TP_printk("podgov: busy %ld <%d>, curr %ld, t %ld, hint %d <%d>\n",
-               __entry->busy, __entry->avg_busy, __entry->curr,
+       TP_printk("podgov (%s): busy %ld <%d>, curr %ld, t %ld, hint %d <%d>\n",
+               dev_name(__entry->dev), __entry->busy, __entry->avg_busy, __entry->curr,
                __entry->target, __entry->hint, __entry->avg_hint)
 );
 
 TRACE_EVENT(podgov_stats,
-       TP_PROTO(int fast_up_count, int slow_down_count, unsigned int idle_min,
-               unsigned int idle_max),
+       TP_PROTO(struct device *dev, int fast_up_count, int slow_down_count,
+               unsigned int idle_min, unsigned int idle_max),
 
-       TP_ARGS(fast_up_count, slow_down_count, idle_min, idle_max),
+       TP_ARGS(dev, fast_up_count, slow_down_count, idle_min, idle_max),
 
        TP_STRUCT__entry(
+               __field(struct device *, dev)
                __field(int, fast_up_count)
                __field(int, slow_down_count)
                __field(unsigned int, idle_min)
@@ -210,15 +221,17 @@ TRACE_EVENT(podgov_stats,
        ),
 
        TP_fast_assign(
+               __entry->dev = dev;
                __entry->fast_up_count = fast_up_count;
                __entry->slow_down_count = slow_down_count;
                __entry->idle_min = idle_min;
                __entry->idle_max = idle_max;
        ),
 
-       TP_printk("podgov stats: + %d - %d min %u max %u\n",
-               __entry->fast_up_count, __entry->slow_down_count,
-               __entry->idle_min, __entry->idle_max)
+       TP_printk("podgov stats (%s): + %d - %d min %u max %u\n",
+               dev_name(__entry->dev), __entry->fast_up_count,
+               __entry->slow_down_count, __entry->idle_min,
+               __entry->idle_max)
 );
 
 #endif /*  _TRACE_NVHOST_PODGOV_H */