Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6105c524 authored by Dov Levenglick's avatar Dov Levenglick
Browse files

mmc: sdhci-msm: add pm_qos trace-points



Add trace-points for tracking pm_qos voting.
This assists in following the voting for debugging
performance related issues.

Change-Id: I5a9e886c739252043e9f28f100e0493436a0eb75
Signed-off-by: default avatarDov Levenglick <dovl@codeaurora.org>
parent 03e5732d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/msm-bus.h>

#include <trace/events/mmc.h>
#include "sdhci-pltfm.h"

enum sdc_mpm_pin_state {
@@ -1629,6 +1630,11 @@ static void pm_qos_dump_configuration(struct device *dev,
			config->cpu_dma_latency_tbl_us[2]);
	else
		dev_dbg(dev, "not dumping latency_us table\n");

	trace_mmc_pm_qos_config(dev_name(dev), config->cpu_affinity_type,
			&config->cpu_affinity_mask, config->rw_policy,
			config->cpu_dma_latency_tbl_us,
			config->cpu_dma_latency_tbl_sz);
}

static struct sdhci_msm_pm_qos_config *search_pm_qos_config(
@@ -1662,6 +1668,7 @@ static void pm_qos_update(struct sdhci_host *host,
	s32 latency;
	unsigned int default_num;
	bool update_timeout;
	const char *name = dev_name(dev);

	if (list_empty(&mngmt->head))
		return;
@@ -1699,6 +1706,9 @@ static void pm_qos_update(struct sdhci_host *host,
			dev_dbg(dev,
				"could not find default configuration got mngmt->type=%d\n",
				mngmt->type);
			trace_mmc_pm_qos_skip(name,
				"could not find default configuration",
				mngmt->type);
			goto out_no_update;
		}
	}
@@ -1737,6 +1747,8 @@ static void pm_qos_update(struct sdhci_host *host,
		dev_dbg(dev,
			"skipping update of pm qos for mngmt->type=%d (no change)\n",
			mngmt->type);
		trace_mmc_pm_qos_skip(name, "no change, skipping pm_qos_voting",
			mngmt->type);
		goto out_no_update;
	}

@@ -1750,16 +1762,26 @@ static void pm_qos_update(struct sdhci_host *host,
		 * request, it is necessary to remove the old one and add
		 * a new one.
		 */
		trace_mmc_pm_qos_remove(name, mngmt->prev_latency,
					mngmt->type,
					&mngmt->prev->cpu_affinity_mask);
		pm_qos_remove_request(&mngmt->dma_req);
		cpumask_copy(&mngmt->dma_req.cpus_affine,
			     &config->cpu_affinity_mask);
		trace_mmc_pm_qos_add(name, latency, mngmt->type,
					&config->cpu_affinity_mask);
		pm_qos_add_request(&mngmt->dma_req,
				   PM_QOS_CPU_DMA_LATENCY, latency);
	} else {
		trace_mmc_pm_qos_update(name, latency, mngmt->type,
					&config->cpu_affinity_mask);
		pm_qos_update_request(&mngmt->dma_req, latency);
	}

	if (update_timeout) {
		trace_mmc_pm_qos_update_timeout(name,
					latency, mngmt->type,
					&mngmt->prev->cpu_affinity_mask);
		pm_qos_update_request_timeout(&mngmt->dma_req,
			latency, pdata->pm_qos.pm_qos_timeout_us);
		/*
+106 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 Google, Inc.
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -209,6 +209,111 @@ DEFINE_EVENT(mmc_pm_template, mmc_resume_host,
	     TP_PROTO(const char *dev_name, int err, s64 usecs),
	     TP_ARGS(dev_name, err, usecs));

DECLARE_EVENT_CLASS(mmc_pm_qos_template,
	TP_PROTO(const char *dev_name, s32 latency, int type,
		cpumask_t *cpumask),

	TP_ARGS(dev_name, latency, type, cpumask),

	TP_STRUCT__entry(
		__string(dev_name, dev_name)
		__field(s32, latency)
		__field(int, type)
		__field(u32, cpumask)
	),

	TP_fast_assign(
		__assign_str(dev_name, dev_name);
		__entry->latency = latency;
		__entry->type = type;
		__entry->cpumask = cpumask->bits[0];
	),

	TP_printk(
		"%s: latency=%d for req_type=%d with cpu mask=0x%08X",
		__get_str(dev_name),
		__entry->latency,
		__entry->type,
		__entry->cpumask
	)
);

DEFINE_EVENT(mmc_pm_qos_template, mmc_pm_qos_add,
	TP_PROTO(const char *dev_name, s32 latency, int type,
		cpumask_t *cpumask),
	TP_ARGS(dev_name, latency, type, cpumask));

DEFINE_EVENT(mmc_pm_qos_template, mmc_pm_qos_update,
	TP_PROTO(const char *dev_name, s32 latency, int type,
		cpumask_t *cpumask),
	TP_ARGS(dev_name, latency, type, cpumask));

DEFINE_EVENT(mmc_pm_qos_template, mmc_pm_qos_update_timeout,
	TP_PROTO(const char *dev_name, s32 latency, int type,
		cpumask_t *cpumask),
	TP_ARGS(dev_name, latency, type, cpumask));

DEFINE_EVENT(mmc_pm_qos_template, mmc_pm_qos_remove,
	TP_PROTO(const char *dev_name, s32 latency, int type,
		cpumask_t *cpumask),
	TP_ARGS(dev_name, latency, type, cpumask));

TRACE_EVENT(mmc_pm_qos_config,

	TP_PROTO(const char *dev_name, int type, cpumask_t *cpumask,
		 int policy, u32 *latencies, unsigned num),

	TP_ARGS(dev_name, type, cpumask, policy, latencies, num),

	TP_STRUCT__entry(
		__string(dev_name, dev_name)
		__field(int, type)
		__field(u32, cpumask)
		__field(int, policy)
		__field(unsigned, num)
		__dynamic_array(u32, _latencies, num)
	),

	TP_fast_assign(
		__assign_str(dev_name, dev_name);
		__entry->type = type;
		__entry->cpumask = cpumask->bits[0];
		__entry->policy = policy;
		__entry->num = num;
		memcpy(__get_dynamic_array(_latencies), latencies, num);
	),

	TP_printk(
		"%s: req_type=%d, cpu mask=0x%08X, policy=%d, tbl_sz=%d, latencies=%s",
		__get_str(dev_name), __entry->type,
		__entry->cpumask, __entry->policy, __entry->num,
		__print_hex(__get_dynamic_array(_latencies), __entry->num)
	)
);

TRACE_EVENT(mmc_pm_qos_skip,

	TP_PROTO(const char *dev_name, const char *msg, int type),

	TP_ARGS(dev_name, msg, type),

	TP_STRUCT__entry(
		__string(dev_name, dev_name)
		__string(msg, msg)
		__field(int, type)
	),

	TP_fast_assign(
		__assign_str(dev_name, dev_name);
		__assign_str(msg, msg);
		__entry->type = type;
	),

	TP_printk("%s: %s for req_type=%d\n",
		__get_str(dev_name), __get_str(msg), __entry->type
	)
);

#endif /* if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) */

/* This part must be outside protection */