From 5322beb19bb07e9b2f1ddbc5c81078617d74dd67 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 11 Feb 2020 15:35:11 -0500 Subject: [PATCH] fix: workqueue: add worker function to workqueue_execute_end tracepoint (v5.6) See upstream commit : commit 1c5da0ec7f20dfb56030fb93f7f52f48e12deb52 Author: Daniel Jordan Date: Mon Jan 13 17:52:39 2020 -0500 workqueue: add worker function to workqueue_execute_end tracepoint It's surprising that workqueue_execute_end includes only the work when its counterpart workqueue_execute_start has both the work and the worker function. You can't set a tracing filter or trigger based on the function, and postprocessing scripts interested in specific functions are harder to write since they have to remember the work from _start and match it up with the same field in _end. Add the function name, taking care to use the copy stashed in the worker since the work is no longer safe to touch. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .../events/lttng-module/workqueue.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/instrumentation/events/lttng-module/workqueue.h b/instrumentation/events/lttng-module/workqueue.h index e0ef9178..5e269e30 100644 --- a/instrumentation/events/lttng-module/workqueue.h +++ b/instrumentation/events/lttng-module/workqueue.h @@ -92,6 +92,26 @@ LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, ) ) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +/** + * workqueue_execute_end - called immediately after the workqueue callback + * @work: pointer to struct work_struct + * @function: pointer to worker function + * + * Allows to track workqueue execution. + */ +LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, + + TP_PROTO(struct work_struct *work, work_func_t function), + + TP_ARGS(work, function), + + TP_FIELDS( + ctf_integer_hex(void *, work, work) + ctf_integer_hex(void *, function, function) + ) +) +#else /** * workqueue_execute_end - called immediately after the workqueue callback * @work: pointer to struct work_struct @@ -104,6 +124,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, TP_ARGS(work) ) +#endif #endif /* LTTNG_TRACE_WORKQUEUE_H */ -- 2.34.1