Skip to contentSkip to conversation

Patches for introducing traces in remoteproc.

PATCH In review Gokul krishna Krishnakumar 3 participants 7 messages Jun 12, 2023 – Jun 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover Patches for introducing traces in remoteproc.

V5: Add more text to Kconfig
Move this trace point to function rproc_load_segments() and rename it to trace_rproc_load_segment_event()

V4: Add config symbol REMOTEPROC_TRACEPOINTS to enable traces
Rename rproc_qcom.h to remoteproc_tracepoints.h Rename qcom_tracepoints.c to remoteproc_tracepoints.c Switch to EXPORT_SYMBOL_GPL

V3: Split the Patch to 2 as per suggestion from Mukesh, fixed format error from v2.

V2: Moved the traces to common code from the qcom_pas driver as per Bjorns review, fixed text as per Triloks suggestion, Updated QuiC copyright to 2023.

[1]: https://lore.kernel.org/all/[email protected]/

Gokul krishna Krishnakumar (2):
remoteproc: Introduce traces for remoteproc events
remoteproc: qcom: Add remoteproc tracing

 drivers/remoteproc/Kconfig                    |   9 ++
 drivers/remoteproc/Makefile                   |   1 +
 drivers/remoteproc/qcom_common.c              |  37 +++++
 drivers/remoteproc/qcom_q6v5.c                |   9 ++
 drivers/remoteproc/remoteproc_core.c          |   5 +
 drivers/remoteproc/remoteproc_internal.h      |   9 +-
 drivers/remoteproc/remoteproc_tracepoints.c   |  14 ++
 include/trace/events/remoteproc_tracepoints.h | 152 ++++++++++++++++++
 8 files changed, 234 insertions(+), 2 deletions(-)
 create mode 100644 drivers/remoteproc/remoteproc_tracepoints.c
 create mode 100644 include/trace/events/remoteproc_tracepoints.h

base-commit: 1ca04f21b204e99dd704146231adfb79ea2fb366

Signature · 1 line
2.40.1
#1 lore raw

PATCH v5 1/2 remoteproc: Introduce traces for remoteproc events

Adding Traces for the following remoteproc events:
rproc_subdev_event, rproc_interrupt_event, rproc_load_event, rproc_start_event, rproc_stop_event

---
 drivers/remoteproc/Kconfig                    |   9 ++
 drivers/remoteproc/Makefile                   |   1 +
 drivers/remoteproc/remoteproc_tracepoints.c   |  14 ++
 include/trace/events/remoteproc_tracepoints.h | 152 ++++++++++++++++++
 4 files changed, 176 insertions(+)
 create mode 100644 drivers/remoteproc/remoteproc_tracepoints.c
 create mode 100644 include/trace/events/remoteproc_tracepoints.h
drivers/remoteproc/Kconfig +9 -0
index a850e9f486dd..4bc4e42a8a36 100644
@@ -365,6 +365,15 @@ config XLNX_R5_REMOTEPROC
 
 	  It's safe to say N if not interested in using RPU r5f cores.
 
+config REMOTEPROC_TRACEPOINTS
+	bool "Support for Remote Processor subsystem traces"
+	help
+	  Say y to add traces to remoteproc events of interest such as
+	  the start/stop/crash events in a remote-processor and also
+	  sub-device stop/start events and there errors. These traces
+	  can be useful while debugging errors with subsystem restart
+	  and draw an estimate on how long each event takes to run.
+
 endif # REMOTEPROC
 
 endmenu
drivers/remoteproc/Makefile +1 -0
index 91314a9b43ce..7045cde5ca76 100644
@@ -10,6 +10,7 @@ remoteproc-y				+= remoteproc_debugfs.o
 remoteproc-y				+= remoteproc_sysfs.o
 remoteproc-y				+= remoteproc_virtio.o
 remoteproc-y				+= remoteproc_elf_loader.o
+obj-$(CONFIG_REMOTEPROC_TRACEPOINTS)	+= remoteproc_tracepoints.o
 obj-$(CONFIG_REMOTEPROC_CDEV)		+= remoteproc_cdev.o
 obj-$(CONFIG_IMX_REMOTEPROC)		+= imx_rproc.o
 obj-$(CONFIG_IMX_DSP_REMOTEPROC)	+= imx_dsp_rproc.o
drivers/remoteproc/remoteproc_tracepoints.c new file +14 -0
new file mode 100644
index 000000000000..cafebda02f8b
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/remoteproc_tracepoints.h>
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_load_segment_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_attach_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_start_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_stop_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_interrupt_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(rproc_subdev_event);
include/trace/events/remoteproc_tracepoints.h new file +152 -0

152 lines not on this page · raw message

Signature · 1 line
2.40.1
#2 lore raw

PATCH v5 2/2 remoteproc: qcom: Add remoteproc tracing

In reply to Gokul krishna Krishnakumar

This change attempts to add traces for start, stop, crash subsystem/subdevice events, these will serve as standard checkpoints in code and could help in debugging the failures in subdevice/subsystem prepare, start, stop and unprepare functions. This will also breakdown the time taken for each step in remoteproc bootup/shutdown process.

---
 drivers/remoteproc/qcom_common.c         | 37 ++++++++++++++++++++++++
 drivers/remoteproc/qcom_q6v5.c           |  9 ++++++
 drivers/remoteproc/remoteproc_core.c     |  5 ++++
 drivers/remoteproc/remoteproc_internal.h |  9 ++++--
 4 files changed, 58 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_common.c +37 -0
index a0d4238492e9..857e5a74c1eb 100644
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/soc/qcom/mdt_loader.h>
 #include <linux/soc/qcom/smem.h>
+#include <trace/events/remoteproc_tracepoints.h>
 
 #include "remoteproc_internal.h"
 #include "qcom_common.h"
@@ -191,6 +192,10 @@ static int glink_subdev_start(struct rproc_subdev *subdev)
 
 	glink->edge = qcom_glink_smem_register(glink->dev, glink->node);
 
+	trace_rproc_subdev_event(dev_name(glink->dev->parent),
+					"glink", "start",
+					PTR_ERR_OR_ZERO(glink->edge));
+
 	return PTR_ERR_OR_ZERO(glink->edge);
 }
 
@@ -199,6 +204,11 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
 	struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
 
 	qcom_glink_smem_unregister(glink->edge);
+
+	trace_rproc_subdev_event(dev_name(glink->dev->parent),
+					"glink", "stop",
+					PTR_ERR_OR_ZERO(glink->edge));
+
 	glink->edge = NULL;
 }
 
@@ -206,6 +216,10 @@ static void glink_subdev_unprepare(struct rproc_subdev *subdev)
 {
 	struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
 
+	trace_rproc_subdev_event(dev_name(glink->dev->parent),
+					"glink", "unprepare",
+					PTR_ERR_OR_ZERO(glink->edge));
+
 	qcom_glink_ssr_notify(glink->ssr_name);
 }
 
@@ -300,6 +314,10 @@ static int smd_subdev_start(struct rproc_subdev *subdev)
 {
 	struct qcom_rproc_subdev *smd = to_smd_subdev(subdev);
 
+	trace_rproc_subdev_event(dev_name(smd->dev->parent),
+					"smd", "start",
+					PTR_ERR_OR_ZERO(smd->edge));
+
 	smd->edge = qcom_smd_register_edge(smd->dev, smd->node);
 
 	return PTR_ERR_OR_ZERO(smd->edge);
@@ -309,6 +327,10 @@ static void smd_subdev_stop(struct rproc_subdev *subdev, bool crashed)
 {
 	struct qcom_rproc_subdev *smd = to_smd_subdev(subdev);
 
+	trace_rproc_subdev_event(dev_name(smd->dev->parent),
+					"smd", "stop",
+					PTR_ERR_OR_ZERO(smd->edge));
+
 	qcom_smd_unregister_edge(smd->edge);
 	smd->edge = NULL;
 }
@@ -425,6 +447,10 @@ static int ssr_notify_prepare(struct rproc_subdev *subdev)
 		.crashed = false,
 	};
 
+	trace_rproc_subdev_event(ssr->info->name,
+					"ssr", "QCOM_SSR_BEFORE_POWERUP",
+					data.crashed);
+
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
 				 QCOM_SSR_BEFORE_POWERUP, &data);
 	return 0;
@@ -437,6 +463,9 @@ static int ssr_notify_start(struct rproc_subdev *subdev)
 		.name = ssr->info->name,
 		.crashed = false,
 	};
+	trace_rproc_subdev_event(ssr->info->name,
+					"ssr", "QCOM_SSR_AFTER_POWERUP",
+					data.crashed);
 
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
 				 QCOM_SSR_AFTER_POWERUP, &data);
@@ -451,6 +480,10 @@ static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed)
 		.crashed = crashed,
 	};
 
+	trace_rproc_subdev_event(ssr->info->name,
+					"ssr", "QCOM_SSR_BEFORE_SHUTDOWN",
+					data.crashed);
+
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
 				 QCOM_SSR_BEFORE_SHUTDOWN, &data);
 }
@@ -463,6 +496,10 @@ static void ssr_notify_unprepare(struct rproc_subdev *subdev)
 		.crashed = false,
 	};
 
+	trace_rproc_subdev_event(ssr->info->name,
+					"ssr", "QCOM_SSR_AFTER_SHUTDOWN",
+					data.crashed);
+
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
 				 QCOM_SSR_AFTER_SHUTDOWN, &data);
 }
drivers/remoteproc/qcom_q6v5.c +9 -0
index 192c7aa0e39e..bf14f01c88c4 100644
@@ -15,6 +15,7 @@
 #include <linux/soc/qcom/smem.h>
 #include <linux/soc/qcom/smem_state.h>
 #include <linux/remoteproc.h>
+#include <trace/events/remoteproc_tracepoints.h>
 #include "qcom_common.h"
 #include "qcom_q6v5.h"
 
@@ -113,6 +114,7 @@ static irqreturn_t q6v5_wdog_interrupt(int irq, void *data)
 		dev_err(q6v5->dev, "watchdog without message\n");
 
 	q6v5->running = false;
+	trace_rproc_interrupt_event(q6v5->rproc, "q6v5_wdog", msg);
 	rproc_report_crash(q6v5->rproc, RPROC_WATCHDOG);
 
 	return IRQ_HANDLED;
@@ -134,6 +136,7 @@ static irqreturn_t q6v5_fatal_interrupt(int irq, void *data)
 		dev_err(q6v5->dev, "fatal error without message\n");
 
 	q6v5->running = false;
+	trace_rproc_interrupt_event(q6v5->rproc, "fatal", msg);
 	rproc_report_crash(q6v5->rproc, RPROC_FATAL_ERROR);
 
 	return IRQ_HANDLED;
@@ -165,6 +168,8 @@ int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout)
 	if (!ret)
 		disable_irq(q6v5->handover_irq);
 
+	trace_rproc_interrupt_event(q6v5->rproc, "Ready", !ret ? "-ETIMEDOUT":"done");
+
 	return !ret ? -ETIMEDOUT : 0;
 }
 EXPORT_SYMBOL_GPL(qcom_q6v5_wait_for_start);
@@ -180,6 +185,8 @@ static irqreturn_t q6v5_handover_interrupt(int irq, void *data)
 
 	q6v5->handover_issued = true;
 
+	trace_rproc_interrupt_event(q6v5->rproc, "handover", "Proxy votes removed");
+
 	return IRQ_HANDLED;
 }
 
@@ -216,6 +223,8 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon)
 
 	qcom_smem_state_update_bits(q6v5->state, BIT(q6v5->stop_bit), 0);
 
+	trace_rproc_interrupt_event(q6v5->rproc, "Stop", ret ? "done":"-EETIMEDOUT");
+
 	return ret == 0 ? -ETIMEDOUT : 0;
 }
 EXPORT_SYMBOL_GPL(qcom_q6v5_request_stop);
drivers/remoteproc/remoteproc_core.c +5 -0
index 695cce218e8c..64c09eff67fe 100644
@@ -38,6 +38,7 @@
 #include <linux/virtio_ring.h>
 #include <asm/byteorder.h>
 #include <linux/platform_device.h>
+#include <trace/events/remoteproc_tracepoints.h>
 
 #include "remoteproc_internal.h"
 
@@ -1648,6 +1649,7 @@ static int rproc_attach(struct rproc *rproc)
 	if (ret)
 		goto clean_up_resources;
 
+	trace_rproc_start_event(rproc, ret);
 	return 0;
 
 clean_up_resources:
@@ -1730,6 +1732,8 @@ static int rproc_stop(struct rproc *rproc, bool crashed)
 		return ret;
 	}
 
+	trace_rproc_stop_event(rproc, crashed ? "crash stop" : "stop");
+
 	rproc_unprepare_subdevices(rproc);
 
 	rproc->state = RPROC_OFFLINE;
@@ -1951,6 +1955,7 @@ int rproc_boot(struct rproc *rproc)
 		}
 
 		ret = rproc_fw_boot(rproc, firmware_p);
+		trace_rproc_start_event(rproc, ret);
 
 		release_firmware(firmware_p);
 	}
drivers/remoteproc/remoteproc_internal.h +8 -2
index d4dbb8d1d80c..f7cb31b94a60 100644
@@ -14,6 +14,7 @@
 
 #include <linux/irqreturn.h>
 #include <linux/firmware.h>
+#include <trace/events/remoteproc_tracepoints.h>
 
 struct rproc;
 
@@ -171,8 +172,13 @@ u64 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
 static inline
 int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
 {
-	if (rproc->ops->load)
-		return rproc->ops->load(rproc, fw);
+	if (rproc->ops->load) {
+		int ret;
+
+		ret = rproc->ops->load(rproc, fw);
+		trace_rproc_load_segment_event(rproc, ret);
+		return ret;
+	}
 
 	return -EINVAL;
 }
Signature · 1 line
2.40.1
#3 lore raw

Re: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing

kernel test robot noticed the following build errors:

Hi Gokul,

kernel test robot noticed the following build errors:

[auto build test ERROR on 1ca04f21b204e99dd704146231adfb79ea2fb366]

url:    https://github.com/intel-lab-lkp/linux/commits/Gokul-krishna-Krishnakumar/remoteproc-Introduce-traces-for-remoteproc-events/20230613-060527
base:   1ca04f21b204e99dd704146231adfb79ea2fb366
patch link:    https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris%40quicinc.com
patch subject: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing
config: i386-randconfig-r025-20230612 (https://download.01.org/0day-ci/archive/20230613/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

reproduce (this is a W=1 build):
git checkout 1ca04f21b204e99dd704146231adfb79ea2fb366
b4 shazam https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris@quicinc.com
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

ld: drivers/remoteproc/remoteproc_core.o: in function `trace_rproc_stop_event':

>> include/trace/events/remoteproc_tracepoints.h:82: undefined reference to `__tracepoint_rproc_stop_event'
>> ld: include/trace/events/remoteproc_tracepoints.h:82: undefined reference to `__SCT__tp_func_rproc_stop_event'
   ld: drivers/remoteproc/remoteproc_core.o: in function `trace_rproc_load_segment_event':
>> include/trace/events/remoteproc_tracepoints.h:17: undefined reference to `__tracepoint_rproc_load_segment_event'
>> ld: include/trace/events/remoteproc_tracepoints.h:17: undefined reference to `__SCT__tp_func_rproc_load_segment_event'
   ld: drivers/remoteproc/remoteproc_core.o: in function `trace_rproc_start_event':
>> include/trace/events/remoteproc_tracepoints.h:63: undefined reference to `__tracepoint_rproc_start_event'
>> ld: include/trace/events/remoteproc_tracepoints.h:63: undefined reference to `__SCT__tp_func_rproc_start_event'
   ld: drivers/remoteproc/remoteproc_core.o:(__jump_table+0x8): undefined reference to `__tracepoint_rproc_stop_event'
>> ld: drivers/remoteproc/remoteproc_core.o:(__jump_table+0x14): undefined reference to `__tracepoint_rproc_load_segment_event'

ld: drivers/remoteproc/remoteproc_core.o:(__jump_table+0x20): undefined reference to `__tracepoint_rproc_start_event'

vim +82 include/trace/events/remoteproc_tracepoints.h

f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   13  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   14  /*
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   15   * Tracepoints for remoteproc and subdevice events
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   16   */
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12  @17  TRACE_EVENT(rproc_load_segment_event,
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   18  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   19  	TP_PROTO(struct rproc *rproc, int ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   20  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   21  	TP_ARGS(rproc, ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   22  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   23  	TP_STRUCT__entry(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   24  		__string(name, rproc->name)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   25  		__string(firmware, rproc->firmware)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   26  		__field(int, ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   27  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   28  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   29  	TP_fast_assign(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   30  		__assign_str(name, rproc->name);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   31  		__assign_str(firmware, rproc->firmware);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   32  		__entry->ret = ret;
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   33  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   34  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   35  	TP_printk("%s loading firmware %s returned %d",
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   36  			__get_str(name), __get_str(firmware),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   37  			__entry->ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   38  );
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   39  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   40  TRACE_EVENT(rproc_attach_event,
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   41  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   42  	TP_PROTO(struct rproc *rproc, int ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   43  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   44  	TP_ARGS(rproc, ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   45  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   46  	TP_STRUCT__entry(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   47  		__string(name, rproc->name)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   48  		__string(firmware, rproc->firmware)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   49  		__field(int, ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   50  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   51  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   52  	TP_fast_assign(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   53  		__assign_str(name, rproc->name);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   54  		__assign_str(firmware, rproc->firmware);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   55  		__entry->ret = ret;
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   56  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   57  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   58  	TP_printk("%s attaching returned %d",
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   59  			__get_str(name),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   60  			__entry->ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   61  );
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   62  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12  @63  TRACE_EVENT(rproc_start_event,
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   64  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   65  	TP_PROTO(struct rproc *rproc, int ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   66  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   67  	TP_ARGS(rproc, ret),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   68  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   69  	TP_STRUCT__entry(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   70  		__string(name, rproc->name)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   71  		__field(int, ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   72  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   73  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   74  	TP_fast_assign(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   75  		__assign_str(name, rproc->name);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   76  		__entry->ret = ret;
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   77  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   78  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   79  	TP_printk("%s %d", __get_str(name), __entry->ret)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   80  );
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   81  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12  @82  TRACE_EVENT(rproc_stop_event,
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   83  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   84  	TP_PROTO(struct rproc *rproc, const char *crash_msg),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   85  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   86  	TP_ARGS(rproc, crash_msg),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   87  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   88  	TP_STRUCT__entry(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   89  		__string(name, rproc->name)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   90  		__string(crash_msg, crash_msg)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   91  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   92  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   93  	TP_fast_assign(
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   94  		__assign_str(name, rproc->name);
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   95  		__assign_str(crash_msg, crash_msg)
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   96  	),
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   97  
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   98  	TP_printk("%s %s", __get_str(name), __get_str(crash_msg))
f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12   99  );

f73173f7e78a04 Gokul krishna Krishnakumar 2023-06-12 100

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw

Re: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing

In reply to Gokul krishna Krishnakumar
kernel test robot noticed the following build errors:

Hi Gokul,

kernel test robot noticed the following build errors:

[auto build test ERROR on 1ca04f21b204e99dd704146231adfb79ea2fb366]

url:    https://github.com/intel-lab-lkp/linux/commits/Gokul-krishna-Krishnakumar/remoteproc-Introduce-traces-for-remoteproc-events/20230613-060527
base:   1ca04f21b204e99dd704146231adfb79ea2fb366
patch link:    https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris%40quicinc.com
patch subject: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing
config: hexagon-randconfig-r041-20230612 (https://download.01.org/0day-ci/archive/20230613/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)

reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 1ca04f21b204e99dd704146231adfb79ea2fb366
b4 shazam https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris@quicinc.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: __tracepoint_rproc_start_event
   >>> referenced by jump_label.h:260 (include/linux/jump_label.h:260)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced by jump_label.h:260 (include/linux/jump_label.h:260)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced by jump_label.h:260 (include/linux/jump_label.h:260)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced 1 more times
--
>> ld.lld: error: undefined symbol: __traceiter_rproc_start_event
   >>> referenced by remoteproc_tracepoints.h:63 (include/trace/events/remoteproc_tracepoints.h:63)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced by remoteproc_tracepoints.h:63 (include/trace/events/remoteproc_tracepoints.h:63)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced by remoteproc_tracepoints.h:63 (include/trace/events/remoteproc_tracepoints.h:63)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_boot) in archive vmlinux.a
   >>> referenced 1 more times
--
>> ld.lld: error: undefined symbol: __tracepoint_rproc_load_segment_event
   >>> referenced by remoteproc_internal.h:178 (drivers/remoteproc/remoteproc_internal.h:178)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_start) in archive vmlinux.a
   >>> referenced by remoteproc_internal.h:178 (drivers/remoteproc/remoteproc_internal.h:178)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_start) in archive vmlinux.a
--
>> ld.lld: error: undefined symbol: __traceiter_rproc_load_segment_event
   >>> referenced by remoteproc_tracepoints.h:17 (include/trace/events/remoteproc_tracepoints.h:17)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_start) in archive vmlinux.a
   >>> referenced by remoteproc_tracepoints.h:17 (include/trace/events/remoteproc_tracepoints.h:17)
   >>>               drivers/remoteproc/remoteproc_core.o:(rproc_start) in archive vmlinux.a
--
>> ld.lld: error: undefined symbol: __tracepoint_rproc_stop_event
   >>> referenced by jump_label.h:260 (include/linux/jump_label.h:260)
   >>>               drivers/remoteproc/remoteproc_core.o:(trace_rproc_stop_event) in archive vmlinux.a
   >>> referenced by jump_label.h:260 (include/linux/jump_label.h:260)
   >>>               drivers/remoteproc/remoteproc_core.o:(trace_rproc_stop_event) in archive vmlinux.a
--
>> ld.lld: error: undefined symbol: __traceiter_rproc_stop_event
   >>> referenced by remoteproc_tracepoints.h:82 (include/trace/events/remoteproc_tracepoints.h:82)
   >>>               drivers/remoteproc/remoteproc_core.o:(trace_rproc_stop_event) in archive vmlinux.a
   >>> referenced by remoteproc_tracepoints.h:82 (include/trace/events/remoteproc_tracepoints.h:82)
   >>>               drivers/remoteproc/remoteproc_core.o:(trace_rproc_stop_event) in archive vmlinux.a
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw

Re: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing

In reply to Gokul krishna Krishnakumar
kernel test robot noticed the following build errors:

Hi Gokul,

kernel test robot noticed the following build errors:

[auto build test ERROR on 1ca04f21b204e99dd704146231adfb79ea2fb366]

url:    https://github.com/intel-lab-lkp/linux/commits/Gokul-krishna-Krishnakumar/remoteproc-Introduce-traces-for-remoteproc-events/20230613-060527
base:   1ca04f21b204e99dd704146231adfb79ea2fb366
patch link:    https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris%40quicinc.com
patch subject: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing
config: microblaze-randconfig-r003-20230612 (https://download.01.org/0day-ci/archive/20230613/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 12.3.0

reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 1ca04f21b204e99dd704146231adfb79ea2fb366
b4 shazam https://lore.kernel.org/r/12b533c73b8c6b039e90f20afef1c8dcd30b80de.1686606835.git.quic_gokukris@quicinc.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=microblaze olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=microblaze SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

microblaze-linux-ld: drivers/remoteproc/remoteproc_core.o: in function `rproc_stop':

>> .tmp_gl_remoteproc_core.o:(.text+0xe1c): undefined reference to `__tracepoint_rproc_stop_event'
>> microblaze-linux-ld: .tmp_gl_remoteproc_core.o:(.text+0xe94): undefined reference to `__traceiter_rproc_stop_event'
   microblaze-linux-ld: drivers/remoteproc/remoteproc_core.o: in function `rproc_start':
>> .tmp_gl_remoteproc_core.o:(.text.unlikely+0x664): undefined reference to `__tracepoint_rproc_load_segment_event'
>> microblaze-linux-ld: .tmp_gl_remoteproc_core.o:(.text.unlikely+0x6dc): undefined reference to `__traceiter_rproc_load_segment_event'
   microblaze-linux-ld: drivers/remoteproc/remoteproc_core.o: in function `trace_rproc_start_event':
>> .tmp_gl_remoteproc_core.o:(.text.unlikely+0x8c8): undefined reference to `__tracepoint_rproc_start_event'
>> microblaze-linux-ld: .tmp_gl_remoteproc_core.o:(.text.unlikely+0x948): undefined reference to `__traceiter_rproc_start_event'
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#6 lore raw

Re: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing

In reply to Gokul krishna Krishnakumar
Quoted 18 lines · On Mon, 12 Jun 2023 15:03:26 -0700 Gokul krishna Krishnakumar…
drivers/remoteproc/remoteproc_internal.h +1 -2
index d4dbb8d1d80c..f7cb31b94a60 100644
@@ -14,6 +14,7 @@
 
 #include <linux/irqreturn.h>
 #include <linux/firmware.h>
+#include <trace/events/remoteproc_tracepoints.h>
 
 struct rproc;
 
@@ -171,8 +172,13 @@ u64 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
 static inline
 int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
 {
-	if (rproc->ops->load)
-		return rproc->ops->load(rproc, fw);

drivers/remoteproc/remoteproc_internal.h u64 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw) · line 184

Quoted 10 lines
drivers/remoteproc/remoteproc_internal.h +7 -0
+	if (rproc->ops->load) {
+		int ret;
+
+		ret = rproc->ops->load(rproc, fw);
+		trace_rproc_load_segment_event(rproc, ret);
+		return ret;
+	}
 
 	return -EINVAL;
 }

So, tracepoints in header files tend to cause problems due to the way they are created. See the comment in include/linux/tracepoint-defs.h.

What you need to do is:

#include <linux/tracepoint-defs.h>

DECLARE_TRACEPOINT(rproc_load_segment_event);

extern void call_trace_rproc_load_segment_event(struct rproc *rproc, int ret);

static inline void test_trace_rproc_load_segment_event(struct rproc *rproc, int ret)

{
	if (trace_rproc_load_segment_event_enabled())
		call_trace_rproc_load_segment_event(rproc, ret);
}

After adding the above in the header. In the C file, add:

void call_trace_rproc_load_segment_event(struct rproc *rproc, int ret)

{
	trace_rproc_load_segment_event(rproc, ret);
}

-- Steve