trace: spa_taskqs_ent trace class, dispatch and dispatched tracepoints

Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
This commit is contained in:
Rob Norris 2023-10-23 14:34:56 +11:00
parent 238392bc95
commit 2fec57bf03
6 changed files with 89 additions and 0 deletions

View File

@ -11,6 +11,7 @@ KERNEL_H = \
trace_dnode.h \
trace_multilist.h \
trace_rrwlock.h \
trace_spa_taskqs.h \
trace_txg.h \
trace_vdev.h \
trace_zil.h \

View File

@ -0,0 +1,74 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
#if defined(_KERNEL)
#if defined(HAVE_DECLARE_EVENT_CLASS)
#undef TRACE_SYSTEM
#define TRACE_SYSTEM zfs
#undef TRACE_SYSTEM_VAR
#define TRACE_SYSTEM_VAR zfs_spa_taskqs
#if !defined(_TRACE_SPA_TASKQS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SPA_TASKQS_H
#include <linux/tracepoint.h>
#include <sys/types.h>
/*
* Generic support for two argument tracepoints of the form:
*
* DTRACE_PROBE2(...,
* spa_taskqs_t *stqs, ...,
* taskq_ent_t *ent, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_spa_taskqs_ent_class,
TP_PROTO(spa_taskqs_t *stqs, taskq_ent_t *ent),
TP_ARGS(stqs, ent),
);
/* END CSTYLED */
/* BEGIN CSTYLED */
#define DEFINE_SPA_TASKQS_ENT_EVENT(name) \
DEFINE_EVENT(zfs_spa_taskqs_ent_class, name, \
TP_PROTO(spa_taskqs_t *stqs, taskq_ent_t *ent), \
TP_ARGS(stqs, ent))
/* END CSTYLED */
DEFINE_SPA_TASKQS_ENT_EVENT(zfs_spa_taskqs_ent__dispatch);
DEFINE_SPA_TASKQS_ENT_EVENT(zfs_spa_taskqs_ent__dispatched);
#endif /* _TRACE_SPA_TASKQS_H */
#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_PATH sys
#define TRACE_INCLUDE_FILE trace_spa_taskqs
#include <trace/define_trace.h>
#else
DEFINE_DTRACE_PROBE2(spa_taskqs_ent__dispatch);
DEFINE_DTRACE_PROBE2(spa_taskqs_ent__dispatched);
#endif /* HAVE_DECLARE_EVENT_CLASS */
#endif /* _KERNEL */

View File

@ -44,6 +44,7 @@
#include <sys/trace_dnode.h>
#include <sys/trace_multilist.h>
#include <sys/trace_rrwlock.h>
#include <sys/trace_spa_taskqs.h>
#include <sys/trace_txg.h>
#include <sys/trace_vdev.h>
#include <sys/trace_zil.h>

View File

@ -183,6 +183,8 @@ typedef enum spa_proc_state {
} spa_proc_state_t;
typedef struct spa_taskqs {
zio_taskq_type_t stqs_type;
zio_type_t stqs_zio_type;
uint_t stqs_count;
taskq_t **stqs_taskq;
} spa_taskqs_t;

View File

@ -47,6 +47,7 @@
#include <sys/trace_dnode.h>
#include <sys/trace_multilist.h>
#include <sys/trace_rrwlock.h>
#include <sys/trace_spa_taskqs.h>
#include <sys/trace_txg.h>
#include <sys/trace_vdev.h>
#include <sys/trace_zil.h>

View File

@ -87,6 +87,7 @@
#include <sys/zfeature.h>
#include <sys/dsl_destroy.h>
#include <sys/zvol.h>
#include <sys/trace_zfs.h>
#ifdef _KERNEL
#include <sys/fm/protocol.h>
@ -982,6 +983,9 @@ spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q)
uint_t cpus, flags = TASKQ_DYNAMIC;
boolean_t batch = B_FALSE;
tqs->stqs_type = q;
tqs->stqs_zio_type = t;
switch (mode) {
case ZTI_MODE_FIXED:
ASSERT3U(value, >, 0);
@ -1399,6 +1403,9 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
ASSERT3P(tqs->stqs_taskq, !=, NULL);
ASSERT3U(tqs->stqs_count, !=, 0);
DTRACE_PROBE2(spa_taskqs_ent__dispatch,
spa_taskqs_t *, tqs, taskq_ent_t *, ent);
if (tqs->stqs_count == 1) {
tq = tqs->stqs_taskq[0];
} else {
@ -1406,6 +1413,9 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
}
taskq_dispatch_ent(tq, func, arg, flags, ent);
DTRACE_PROBE2(spa_taskqs_ent__dispatched,
spa_taskqs_t *, tqs, taskq_ent_t *, ent);
}
/*