remoteproc: qcom: Add subdevice tracing
This change adds trace events to rproc subdevices to get an estimate of how long each subdevice takes to run. Change-Id: I513a6d2c3c73c03202a042d2704c79818a4f0aa0 Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
This commit is contained in:
parent
7edca00333
commit
1b5996a813
@ -19,7 +19,8 @@ obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o
|
||||
obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
|
||||
obj-$(CONFIG_KEYSTONE_REMOTEPROC) += keystone_remoteproc.o
|
||||
obj-$(CONFIG_QCOM_PIL_INFO) += qcom_pil_info.o
|
||||
obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o
|
||||
obj-$(CONFIG_QCOM_RPROC_COMMON) += rproc_qcom_common.o
|
||||
rproc_qcom_common-y := qcom_common.o qcom_tracepoints.o
|
||||
obj-$(CONFIG_QCOM_Q6V5_COMMON) += qcom_q6v5.o
|
||||
obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o
|
||||
obj-$(CONFIG_QCOM_Q6V5_MSS) += qcom_q6v5_mss.o
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <linux/soc/qcom/mdt_loader.h>
|
||||
#include <linux/soc/qcom/smem.h>
|
||||
#include <trace/hooks/remoteproc.h>
|
||||
#include <trace/events/rproc_qcom.h>
|
||||
|
||||
#include "remoteproc_internal.h"
|
||||
#include "qcom_common.h"
|
||||
@ -28,6 +29,10 @@
|
||||
#define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev)
|
||||
#define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev)
|
||||
|
||||
#define GLINK_SUBDEV_NAME "glink"
|
||||
#define SMD_SUBDEV_NAME "smd"
|
||||
#define SSR_SUBDEV_NAME "ssr"
|
||||
|
||||
#define MAX_NUM_OF_SS 10
|
||||
#define MAX_REGION_NAME_LENGTH 16
|
||||
#define SBL_MINIDUMP_SMEM_ID 602
|
||||
@ -219,6 +224,8 @@ static int glink_subdev_prepare(struct rproc_subdev *subdev)
|
||||
{
|
||||
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(glink->dev->parent), GLINK_SUBDEV_NAME, "prepare");
|
||||
|
||||
glink->edge = qcom_glink_smem_register(glink->dev, glink->node);
|
||||
|
||||
return PTR_ERR_OR_ZERO(glink->edge);
|
||||
@ -228,6 +235,8 @@ static int glink_subdev_start(struct rproc_subdev *subdev)
|
||||
{
|
||||
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(glink->dev->parent), GLINK_SUBDEV_NAME, "start");
|
||||
|
||||
return qcom_glink_smem_start(glink->edge);
|
||||
}
|
||||
|
||||
@ -235,6 +244,9 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
|
||||
{
|
||||
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(glink->dev->parent), GLINK_SUBDEV_NAME,
|
||||
crashed ? "crash stop" : "stop");
|
||||
|
||||
qcom_glink_smem_unregister(glink->edge);
|
||||
glink->edge = NULL;
|
||||
}
|
||||
@ -243,6 +255,8 @@ static void glink_subdev_unprepare(struct rproc_subdev *subdev)
|
||||
{
|
||||
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(glink->dev->parent), GLINK_SUBDEV_NAME, "unprepare");
|
||||
|
||||
qcom_glink_ssr_notify(glink->ssr_name);
|
||||
}
|
||||
|
||||
@ -338,6 +352,8 @@ static int smd_subdev_start(struct rproc_subdev *subdev)
|
||||
{
|
||||
struct qcom_rproc_subdev *smd = to_smd_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(smd->dev->parent), SMD_SUBDEV_NAME, "start");
|
||||
|
||||
smd->edge = qcom_smd_register_edge(smd->dev, smd->node);
|
||||
|
||||
return PTR_ERR_OR_ZERO(smd->edge);
|
||||
@ -347,6 +363,9 @@ static void smd_subdev_stop(struct rproc_subdev *subdev, bool crashed)
|
||||
{
|
||||
struct qcom_rproc_subdev *smd = to_smd_subdev(subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(smd->dev->parent), SMD_SUBDEV_NAME,
|
||||
crashed ? "crash stop" : "stop");
|
||||
|
||||
qcom_smd_unregister_edge(smd->edge);
|
||||
smd->edge = NULL;
|
||||
}
|
||||
@ -488,6 +507,8 @@ static int ssr_notify_prepare(struct rproc_subdev *subdev)
|
||||
.crashed = false,
|
||||
};
|
||||
|
||||
trace_rproc_qcom_event(ssr->info->name, SSR_SUBDEV_NAME, "prepare");
|
||||
|
||||
ssr->notification = QCOM_SSR_BEFORE_POWERUP;
|
||||
notify_ssr_clients(ssr, &data);
|
||||
return 0;
|
||||
@ -501,6 +522,8 @@ static int ssr_notify_start(struct rproc_subdev *subdev)
|
||||
.crashed = false,
|
||||
};
|
||||
|
||||
trace_rproc_qcom_event(ssr->info->name, SSR_SUBDEV_NAME, "start");
|
||||
|
||||
ssr->notification = QCOM_SSR_AFTER_POWERUP;
|
||||
notify_ssr_clients(ssr, &data);
|
||||
return 0;
|
||||
@ -514,6 +537,8 @@ static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed)
|
||||
.crashed = crashed,
|
||||
};
|
||||
|
||||
trace_rproc_qcom_event(ssr->info->name, SSR_SUBDEV_NAME, crashed ? "crash stop" : "stop");
|
||||
|
||||
ssr->notification = QCOM_SSR_BEFORE_SHUTDOWN;
|
||||
notify_ssr_clients(ssr, &data);
|
||||
}
|
||||
@ -526,6 +551,8 @@ static void ssr_notify_unprepare(struct rproc_subdev *subdev)
|
||||
.crashed = false,
|
||||
};
|
||||
|
||||
trace_rproc_qcom_event(ssr->info->name, SSR_SUBDEV_NAME, "unprepare");
|
||||
|
||||
ssr->notification = QCOM_SSR_AFTER_SHUTDOWN;
|
||||
notify_ssr_clients(ssr, &data);
|
||||
}
|
||||
|
@ -26,6 +26,9 @@
|
||||
#include <linux/soc/qcom/smem_state.h>
|
||||
#include <linux/soc/qcom/qcom_aoss.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/rproc_qcom.h>
|
||||
|
||||
#include "qcom_common.h"
|
||||
#include "qcom_pil_info.h"
|
||||
#include "qcom_q6v5.h"
|
||||
@ -134,10 +137,15 @@ static void adsp_minidump(struct rproc *rproc)
|
||||
{
|
||||
struct qcom_adsp *adsp = rproc->priv;
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_minidump", "enter");
|
||||
|
||||
if (rproc->dump_conf == RPROC_COREDUMP_DISABLED)
|
||||
return;
|
||||
goto exit;
|
||||
|
||||
qcom_minidump(rproc, adsp->minidump_id, adsp_segment_dump);
|
||||
|
||||
exit:
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_minidump", "exit");
|
||||
}
|
||||
|
||||
static int adsp_toggle_load_state(struct qmp *qmp, const char *name, bool enable)
|
||||
@ -259,19 +267,23 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
|
||||
struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
|
||||
int ret;
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_load", "enter");
|
||||
|
||||
scm_pas_enable_bw();
|
||||
ret = qcom_mdt_load_no_free(adsp->dev, fw, rproc->firmware, adsp->pas_id,
|
||||
adsp->mem_region, adsp->mem_phys, adsp->mem_size,
|
||||
&adsp->mem_reloc, adsp->mdata);
|
||||
scm_pas_disable_bw();
|
||||
if (ret)
|
||||
return ret;
|
||||
goto exit;
|
||||
|
||||
qcom_pil_info_store(adsp->info_name, adsp->mem_phys, adsp->mem_size);
|
||||
|
||||
adsp_recalibrate_phys_addrs(adsp, fw);
|
||||
|
||||
return 0;
|
||||
exit:
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_load", "exit");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void disable_regulators(struct qcom_adsp *adsp)
|
||||
@ -329,6 +341,8 @@ static int adsp_start(struct rproc *rproc)
|
||||
struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
|
||||
int ret;
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_start", "enter");
|
||||
|
||||
qcom_q6v5_prepare(&adsp->q6v5);
|
||||
|
||||
ret = do_bus_scaling(adsp, true);
|
||||
@ -395,6 +409,8 @@ static int adsp_start(struct rproc *rproc)
|
||||
qcom_q6v5_unprepare(&adsp->q6v5);
|
||||
free_metadata:
|
||||
qcom_mdt_free_metadata(adsp->dev, adsp->pas_id, adsp->mdata, ret);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_start", "exit");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -415,6 +431,8 @@ static int adsp_stop(struct rproc *rproc)
|
||||
int handover;
|
||||
int ret;
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_stop", "enter");
|
||||
|
||||
ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
|
||||
if (ret == -ETIMEDOUT)
|
||||
dev_err(adsp->dev, "timed out on wait\n");
|
||||
@ -432,6 +450,8 @@ static int adsp_stop(struct rproc *rproc)
|
||||
if (handover)
|
||||
qcom_pas_handover(&adsp->q6v5);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(adsp->dev), "adsp_stop", "exit");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,15 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/rpmsg.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/rproc_qcom.h>
|
||||
|
||||
#include "qcom_common.h"
|
||||
|
||||
#define SYSMON_NOTIF_TIMEOUT CONFIG_RPROC_SYSMON_NOTIF_TIMEOUT
|
||||
|
||||
#define SYSMON_SUBDEV_NAME "sysmon"
|
||||
|
||||
static const char * const notif_timeout_msg = "sysmon msg from %s to %s for %s taking too long";
|
||||
static const char * const shutdown_timeout_msg = "sysmon_send_shutdown to %s taking too long";
|
||||
|
||||
@ -542,6 +547,8 @@ static int sysmon_prepare(struct rproc_subdev *subdev)
|
||||
struct qcom_sysmon *sysmon = container_of(subdev, struct qcom_sysmon,
|
||||
subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(sysmon->rproc->dev.parent), SYSMON_SUBDEV_NAME, "prepare");
|
||||
|
||||
mutex_lock(&sysmon->state_lock);
|
||||
sysmon->state = QCOM_SSR_BEFORE_POWERUP;
|
||||
blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)sysmon);
|
||||
@ -565,6 +572,8 @@ static int sysmon_start(struct rproc_subdev *subdev)
|
||||
subdev);
|
||||
struct qcom_sysmon *target;
|
||||
|
||||
trace_rproc_qcom_event(dev_name(sysmon->rproc->dev.parent), SYSMON_SUBDEV_NAME, "start");
|
||||
|
||||
mutex_lock(&sysmon->state_lock);
|
||||
sysmon->state = QCOM_SSR_AFTER_POWERUP;
|
||||
blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)sysmon);
|
||||
@ -589,6 +598,9 @@ static void sysmon_stop(struct rproc_subdev *subdev, bool crashed)
|
||||
unsigned long timeout;
|
||||
struct qcom_sysmon *sysmon = container_of(subdev, struct qcom_sysmon, subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(sysmon->rproc->dev.parent), SYSMON_SUBDEV_NAME,
|
||||
crashed ? "crash stop" : "stop");
|
||||
|
||||
sysmon->shutdown_acked = false;
|
||||
|
||||
mutex_lock(&sysmon->state_lock);
|
||||
@ -622,6 +634,9 @@ static void sysmon_unprepare(struct rproc_subdev *subdev)
|
||||
struct qcom_sysmon *sysmon = container_of(subdev, struct qcom_sysmon,
|
||||
subdev);
|
||||
|
||||
trace_rproc_qcom_event(dev_name(sysmon->rproc->dev.parent), SYSMON_SUBDEV_NAME,
|
||||
"unprepare");
|
||||
|
||||
mutex_lock(&sysmon->state_lock);
|
||||
sysmon->state = QCOM_SSR_AFTER_SHUTDOWN;
|
||||
blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)sysmon);
|
||||
|
9
drivers/remoteproc/qcom_tracepoints.c
Normal file
9
drivers/remoteproc/qcom_tracepoints.c
Normal file
@ -0,0 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Qualcomm Technologies, Inc. Peripheral Image Loader helpers
|
||||
*
|
||||
* Copyright (c) 2021 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/rproc_qcom.h>
|
36
include/trace/events/rproc_qcom.h
Normal file
36
include/trace/events/rproc_qcom.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM rproc_qcom
|
||||
|
||||
#if !defined(_TRACE_RPROC_QCOM_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_RPROC_QCOM_H
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
TRACE_EVENT(rproc_qcom_event,
|
||||
|
||||
TP_PROTO(const char *name, const char *event, const char *subevent),
|
||||
|
||||
TP_ARGS(name, event, subevent),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__string(event, event)
|
||||
__string(subevent, subevent)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
__assign_str(event, event);
|
||||
__assign_str(subevent, subevent);
|
||||
),
|
||||
|
||||
TP_printk("%s: %s: %s", __get_str(name), __get_str(event), __get_str(subevent))
|
||||
);
|
||||
#endif /* _TRACE_RPROC_QCOM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
Loading…
Reference in New Issue
Block a user