18e8d7f13SDavid Howells /* AFS tracepoints 28e8d7f13SDavid Howells * 38e8d7f13SDavid Howells * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved. 48e8d7f13SDavid Howells * Written by David Howells (dhowells@redhat.com) 58e8d7f13SDavid Howells * 68e8d7f13SDavid Howells * This program is free software; you can redistribute it and/or 78e8d7f13SDavid Howells * modify it under the terms of the GNU General Public Licence 88e8d7f13SDavid Howells * as published by the Free Software Foundation; either version 98e8d7f13SDavid Howells * 2 of the Licence, or (at your option) any later version. 108e8d7f13SDavid Howells */ 118e8d7f13SDavid Howells #undef TRACE_SYSTEM 128e8d7f13SDavid Howells #define TRACE_SYSTEM afs 138e8d7f13SDavid Howells 148e8d7f13SDavid Howells #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ) 158e8d7f13SDavid Howells #define _TRACE_AFS_H 168e8d7f13SDavid Howells 178e8d7f13SDavid Howells #include <linux/tracepoint.h> 188e8d7f13SDavid Howells 19341f741fSDavid Howells /* 20341f741fSDavid Howells * Define enums for tracing information. 21341f741fSDavid Howells */ 22341f741fSDavid Howells #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY 23341f741fSDavid Howells #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY 24341f741fSDavid Howells 25341f741fSDavid Howells enum afs_call_trace { 26341f741fSDavid Howells afs_call_trace_alloc, 27341f741fSDavid Howells afs_call_trace_free, 28341f741fSDavid Howells afs_call_trace_put, 29341f741fSDavid Howells afs_call_trace_wake, 30341f741fSDavid Howells afs_call_trace_work, 31341f741fSDavid Howells }; 32341f741fSDavid Howells 33*025db80cSDavid Howells enum afs_fs_operation { 34*025db80cSDavid Howells afs_FS_FetchData = 130, /* AFS Fetch file data */ 35*025db80cSDavid Howells afs_FS_FetchStatus = 132, /* AFS Fetch file status */ 36*025db80cSDavid Howells afs_FS_StoreData = 133, /* AFS Store file data */ 37*025db80cSDavid Howells afs_FS_StoreStatus = 135, /* AFS Store file status */ 38*025db80cSDavid Howells afs_FS_RemoveFile = 136, /* AFS Remove a file */ 39*025db80cSDavid Howells afs_FS_CreateFile = 137, /* AFS Create a file */ 40*025db80cSDavid Howells afs_FS_Rename = 138, /* AFS Rename or move a file or directory */ 41*025db80cSDavid Howells afs_FS_Symlink = 139, /* AFS Create a symbolic link */ 42*025db80cSDavid Howells afs_FS_Link = 140, /* AFS Create a hard link */ 43*025db80cSDavid Howells afs_FS_MakeDir = 141, /* AFS Create a directory */ 44*025db80cSDavid Howells afs_FS_RemoveDir = 142, /* AFS Remove a directory */ 45*025db80cSDavid Howells afs_FS_GetVolumeInfo = 148, /* AFS Get information about a volume */ 46*025db80cSDavid Howells afs_FS_GetVolumeStatus = 149, /* AFS Get volume status information */ 47*025db80cSDavid Howells afs_FS_GetRootVolume = 151, /* AFS Get root volume name */ 48*025db80cSDavid Howells afs_FS_SetLock = 156, /* AFS Request a file lock */ 49*025db80cSDavid Howells afs_FS_ExtendLock = 157, /* AFS Extend a file lock */ 50*025db80cSDavid Howells afs_FS_ReleaseLock = 158, /* AFS Release a file lock */ 51*025db80cSDavid Howells afs_FS_Lookup = 161, /* AFS lookup file in directory */ 52*025db80cSDavid Howells afs_FS_FetchData64 = 65537, /* AFS Fetch file data */ 53*025db80cSDavid Howells afs_FS_StoreData64 = 65538, /* AFS Store file data */ 54*025db80cSDavid Howells afs_FS_GiveUpAllCallBacks = 65539, /* AFS Give up all our callbacks on a server */ 55*025db80cSDavid Howells afs_FS_GetCapabilities = 65540, /* AFS Get FS server capabilities */ 56*025db80cSDavid Howells }; 57*025db80cSDavid Howells 58*025db80cSDavid Howells enum afs_vl_operation { 59*025db80cSDavid Howells afs_VL_GetEntryByNameU = 527, /* AFS Get Vol Entry By Name operation ID */ 60*025db80cSDavid Howells afs_VL_GetAddrsU = 533, /* AFS Get FS server addresses */ 61*025db80cSDavid Howells afs_YFSVL_GetEndpoints = 64002, /* YFS Get FS & Vol server addresses */ 62*025db80cSDavid Howells afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */ 63*025db80cSDavid Howells }; 64*025db80cSDavid Howells 65341f741fSDavid Howells #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */ 66341f741fSDavid Howells 67341f741fSDavid Howells /* 68341f741fSDavid Howells * Declare tracing information enums and their string mappings for display. 69341f741fSDavid Howells */ 70341f741fSDavid Howells #define afs_call_traces \ 71341f741fSDavid Howells EM(afs_call_trace_alloc, "ALLOC") \ 72341f741fSDavid Howells EM(afs_call_trace_free, "FREE ") \ 73341f741fSDavid Howells EM(afs_call_trace_put, "PUT ") \ 74341f741fSDavid Howells EM(afs_call_trace_wake, "WAKE ") \ 75341f741fSDavid Howells E_(afs_call_trace_work, "WORK ") 76341f741fSDavid Howells 77*025db80cSDavid Howells #define afs_fs_operations \ 78*025db80cSDavid Howells EM(afs_FS_FetchData, "FS.FetchData") \ 79*025db80cSDavid Howells EM(afs_FS_FetchStatus, "FS.FetchStatus") \ 80*025db80cSDavid Howells EM(afs_FS_StoreData, "FS.StoreData") \ 81*025db80cSDavid Howells EM(afs_FS_StoreStatus, "FS.StoreStatus") \ 82*025db80cSDavid Howells EM(afs_FS_RemoveFile, "FS.RemoveFile") \ 83*025db80cSDavid Howells EM(afs_FS_CreateFile, "FS.CreateFile") \ 84*025db80cSDavid Howells EM(afs_FS_Rename, "FS.Rename") \ 85*025db80cSDavid Howells EM(afs_FS_Symlink, "FS.Symlink") \ 86*025db80cSDavid Howells EM(afs_FS_Link, "FS.Link") \ 87*025db80cSDavid Howells EM(afs_FS_MakeDir, "FS.MakeDir") \ 88*025db80cSDavid Howells EM(afs_FS_RemoveDir, "FS.RemoveDir") \ 89*025db80cSDavid Howells EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \ 90*025db80cSDavid Howells EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \ 91*025db80cSDavid Howells EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \ 92*025db80cSDavid Howells EM(afs_FS_SetLock, "FS.SetLock") \ 93*025db80cSDavid Howells EM(afs_FS_ExtendLock, "FS.ExtendLock") \ 94*025db80cSDavid Howells EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \ 95*025db80cSDavid Howells EM(afs_FS_Lookup, "FS.Lookup") \ 96*025db80cSDavid Howells EM(afs_FS_FetchData64, "FS.FetchData64") \ 97*025db80cSDavid Howells EM(afs_FS_StoreData64, "FS.StoreData64") \ 98*025db80cSDavid Howells EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \ 99*025db80cSDavid Howells E_(afs_FS_GetCapabilities, "FS.GetCapabilities") 100*025db80cSDavid Howells 101*025db80cSDavid Howells #define afs_vl_operations \ 102*025db80cSDavid Howells EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \ 103*025db80cSDavid Howells EM(afs_VL_GetAddrsU, "VL.GetAddrsU") \ 104*025db80cSDavid Howells EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \ 105*025db80cSDavid Howells E_(afs_VL_GetCapabilities, "VL.GetCapabilities") 106*025db80cSDavid Howells 107*025db80cSDavid Howells 108341f741fSDavid Howells /* 109341f741fSDavid Howells * Export enum symbols via userspace. 110341f741fSDavid Howells */ 111341f741fSDavid Howells #undef EM 112341f741fSDavid Howells #undef E_ 113341f741fSDavid Howells #define EM(a, b) TRACE_DEFINE_ENUM(a); 114341f741fSDavid Howells #define E_(a, b) TRACE_DEFINE_ENUM(a); 115341f741fSDavid Howells 116341f741fSDavid Howells afs_call_traces; 117*025db80cSDavid Howells afs_fs_operations; 118*025db80cSDavid Howells afs_vl_operations; 119341f741fSDavid Howells 120341f741fSDavid Howells /* 121341f741fSDavid Howells * Now redefine the EM() and E_() macros to map the enums to the strings that 122341f741fSDavid Howells * will be printed in the output. 123341f741fSDavid Howells */ 124341f741fSDavid Howells #undef EM 125341f741fSDavid Howells #undef E_ 126341f741fSDavid Howells #define EM(a, b) { a, b }, 127341f741fSDavid Howells #define E_(a, b) { a, b } 128341f741fSDavid Howells 1298e8d7f13SDavid Howells TRACE_EVENT(afs_recv_data, 1308e8d7f13SDavid Howells TP_PROTO(struct afs_call *call, unsigned count, unsigned offset, 1318e8d7f13SDavid Howells bool want_more, int ret), 1328e8d7f13SDavid Howells 1338e8d7f13SDavid Howells TP_ARGS(call, count, offset, want_more, ret), 1348e8d7f13SDavid Howells 1358e8d7f13SDavid Howells TP_STRUCT__entry( 1368e8d7f13SDavid Howells __field(struct rxrpc_call *, rxcall ) 1378e8d7f13SDavid Howells __field(struct afs_call *, call ) 1388e8d7f13SDavid Howells __field(enum afs_call_state, state ) 1398e8d7f13SDavid Howells __field(unsigned int, count ) 1408e8d7f13SDavid Howells __field(unsigned int, offset ) 1418e8d7f13SDavid Howells __field(unsigned short, unmarshall ) 1428e8d7f13SDavid Howells __field(bool, want_more ) 1438e8d7f13SDavid Howells __field(int, ret ) 1448e8d7f13SDavid Howells ), 1458e8d7f13SDavid Howells 1468e8d7f13SDavid Howells TP_fast_assign( 1478e8d7f13SDavid Howells __entry->rxcall = call->rxcall; 1488e8d7f13SDavid Howells __entry->call = call; 1498e8d7f13SDavid Howells __entry->state = call->state; 1508e8d7f13SDavid Howells __entry->unmarshall = call->unmarshall; 1518e8d7f13SDavid Howells __entry->count = count; 1528e8d7f13SDavid Howells __entry->offset = offset; 1538e8d7f13SDavid Howells __entry->want_more = want_more; 1548e8d7f13SDavid Howells __entry->ret = ret; 1558e8d7f13SDavid Howells ), 1568e8d7f13SDavid Howells 1578e8d7f13SDavid Howells TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d", 1588e8d7f13SDavid Howells __entry->rxcall, 1598e8d7f13SDavid Howells __entry->call, 1608e8d7f13SDavid Howells __entry->state, __entry->unmarshall, 1618e8d7f13SDavid Howells __entry->offset, __entry->count, 1628e8d7f13SDavid Howells __entry->want_more, __entry->ret) 1638e8d7f13SDavid Howells ); 1648e8d7f13SDavid Howells 1658e8d7f13SDavid Howells TRACE_EVENT(afs_notify_call, 1668e8d7f13SDavid Howells TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call), 1678e8d7f13SDavid Howells 1688e8d7f13SDavid Howells TP_ARGS(rxcall, call), 1698e8d7f13SDavid Howells 1708e8d7f13SDavid Howells TP_STRUCT__entry( 1718e8d7f13SDavid Howells __field(struct rxrpc_call *, rxcall ) 1728e8d7f13SDavid Howells __field(struct afs_call *, call ) 1738e8d7f13SDavid Howells __field(enum afs_call_state, state ) 1748e8d7f13SDavid Howells __field(unsigned short, unmarshall ) 1758e8d7f13SDavid Howells ), 1768e8d7f13SDavid Howells 1778e8d7f13SDavid Howells TP_fast_assign( 1788e8d7f13SDavid Howells __entry->rxcall = rxcall; 1798e8d7f13SDavid Howells __entry->call = call; 1808e8d7f13SDavid Howells __entry->state = call->state; 1818e8d7f13SDavid Howells __entry->unmarshall = call->unmarshall; 1828e8d7f13SDavid Howells ), 1838e8d7f13SDavid Howells 1848e8d7f13SDavid Howells TP_printk("c=%p ac=%p s=%u u=%u", 1858e8d7f13SDavid Howells __entry->rxcall, 1868e8d7f13SDavid Howells __entry->call, 1878e8d7f13SDavid Howells __entry->state, __entry->unmarshall) 1888e8d7f13SDavid Howells ); 1898e8d7f13SDavid Howells 1908e8d7f13SDavid Howells TRACE_EVENT(afs_cb_call, 1918e8d7f13SDavid Howells TP_PROTO(struct afs_call *call), 1928e8d7f13SDavid Howells 1938e8d7f13SDavid Howells TP_ARGS(call), 1948e8d7f13SDavid Howells 1958e8d7f13SDavid Howells TP_STRUCT__entry( 1968e8d7f13SDavid Howells __field(struct rxrpc_call *, rxcall ) 1978e8d7f13SDavid Howells __field(struct afs_call *, call ) 1988e8d7f13SDavid Howells __field(const char *, name ) 1998e8d7f13SDavid Howells __field(u32, op ) 2008e8d7f13SDavid Howells ), 2018e8d7f13SDavid Howells 2028e8d7f13SDavid Howells TP_fast_assign( 2038e8d7f13SDavid Howells __entry->rxcall = call->rxcall; 2048e8d7f13SDavid Howells __entry->call = call; 2058e8d7f13SDavid Howells __entry->name = call->type->name; 2068e8d7f13SDavid Howells __entry->op = call->operation_ID; 2078e8d7f13SDavid Howells ), 2088e8d7f13SDavid Howells 2098e8d7f13SDavid Howells TP_printk("c=%p ac=%p %s o=%u", 2108e8d7f13SDavid Howells __entry->rxcall, 2118e8d7f13SDavid Howells __entry->call, 2128e8d7f13SDavid Howells __entry->name, 2138e8d7f13SDavid Howells __entry->op) 2148e8d7f13SDavid Howells ); 2158e8d7f13SDavid Howells 216341f741fSDavid Howells TRACE_EVENT(afs_call, 217341f741fSDavid Howells TP_PROTO(struct afs_call *call, enum afs_call_trace op, 218341f741fSDavid Howells int usage, int outstanding, const void *where), 219341f741fSDavid Howells 220341f741fSDavid Howells TP_ARGS(call, op, usage, outstanding, where), 221341f741fSDavid Howells 222341f741fSDavid Howells TP_STRUCT__entry( 223341f741fSDavid Howells __field(struct afs_call *, call ) 224341f741fSDavid Howells __field(int, op ) 225341f741fSDavid Howells __field(int, usage ) 226341f741fSDavid Howells __field(int, outstanding ) 227341f741fSDavid Howells __field(const void *, where ) 228341f741fSDavid Howells ), 229341f741fSDavid Howells 230341f741fSDavid Howells TP_fast_assign( 231341f741fSDavid Howells __entry->call = call; 232341f741fSDavid Howells __entry->op = op; 233341f741fSDavid Howells __entry->usage = usage; 234341f741fSDavid Howells __entry->outstanding = outstanding; 235341f741fSDavid Howells __entry->where = where; 236341f741fSDavid Howells ), 237341f741fSDavid Howells 238341f741fSDavid Howells TP_printk("c=%p %s u=%d o=%d sp=%pSR", 239341f741fSDavid Howells __entry->call, 240341f741fSDavid Howells __print_symbolic(__entry->op, afs_call_traces), 241341f741fSDavid Howells __entry->usage, 242341f741fSDavid Howells __entry->outstanding, 243341f741fSDavid Howells __entry->where) 244341f741fSDavid Howells ); 245341f741fSDavid Howells 246*025db80cSDavid Howells TRACE_EVENT(afs_make_fs_call, 247*025db80cSDavid Howells TP_PROTO(struct afs_call *call, const struct afs_fid *fid), 248*025db80cSDavid Howells 249*025db80cSDavid Howells TP_ARGS(call, fid), 250*025db80cSDavid Howells 251*025db80cSDavid Howells TP_STRUCT__entry( 252*025db80cSDavid Howells __field(struct afs_call *, call ) 253*025db80cSDavid Howells __field(enum afs_fs_operation, op ) 254*025db80cSDavid Howells __field_struct(struct afs_fid, fid ) 255*025db80cSDavid Howells ), 256*025db80cSDavid Howells 257*025db80cSDavid Howells TP_fast_assign( 258*025db80cSDavid Howells __entry->call = call; 259*025db80cSDavid Howells __entry->op = call->operation_ID; 260*025db80cSDavid Howells if (fid) { 261*025db80cSDavid Howells __entry->fid = *fid; 262*025db80cSDavid Howells } else { 263*025db80cSDavid Howells __entry->fid.vid = 0; 264*025db80cSDavid Howells __entry->fid.vnode = 0; 265*025db80cSDavid Howells __entry->fid.unique = 0; 266*025db80cSDavid Howells } 267*025db80cSDavid Howells ), 268*025db80cSDavid Howells 269*025db80cSDavid Howells TP_printk("c=%p %06x:%06x:%06x %s", 270*025db80cSDavid Howells __entry->call, 271*025db80cSDavid Howells __entry->fid.vid, 272*025db80cSDavid Howells __entry->fid.vnode, 273*025db80cSDavid Howells __entry->fid.unique, 274*025db80cSDavid Howells __print_symbolic(__entry->op, afs_fs_operations)) 275*025db80cSDavid Howells ); 276*025db80cSDavid Howells 277*025db80cSDavid Howells TRACE_EVENT(afs_make_vl_call, 278*025db80cSDavid Howells TP_PROTO(struct afs_call *call), 279*025db80cSDavid Howells 280*025db80cSDavid Howells TP_ARGS(call), 281*025db80cSDavid Howells 282*025db80cSDavid Howells TP_STRUCT__entry( 283*025db80cSDavid Howells __field(struct afs_call *, call ) 284*025db80cSDavid Howells __field(enum afs_vl_operation, op ) 285*025db80cSDavid Howells ), 286*025db80cSDavid Howells 287*025db80cSDavid Howells TP_fast_assign( 288*025db80cSDavid Howells __entry->call = call; 289*025db80cSDavid Howells __entry->op = call->operation_ID; 290*025db80cSDavid Howells ), 291*025db80cSDavid Howells 292*025db80cSDavid Howells TP_printk("c=%p %s", 293*025db80cSDavid Howells __entry->call, 294*025db80cSDavid Howells __print_symbolic(__entry->op, afs_vl_operations)) 295*025db80cSDavid Howells ); 296*025db80cSDavid Howells 297*025db80cSDavid Howells TRACE_EVENT(afs_call_done, 298*025db80cSDavid Howells TP_PROTO(struct afs_call *call), 299*025db80cSDavid Howells 300*025db80cSDavid Howells TP_ARGS(call), 301*025db80cSDavid Howells 302*025db80cSDavid Howells TP_STRUCT__entry( 303*025db80cSDavid Howells __field(struct afs_call *, call ) 304*025db80cSDavid Howells __field(struct rxrpc_call *, rx_call ) 305*025db80cSDavid Howells __field(int, ret ) 306*025db80cSDavid Howells __field(u32, abort_code ) 307*025db80cSDavid Howells ), 308*025db80cSDavid Howells 309*025db80cSDavid Howells TP_fast_assign( 310*025db80cSDavid Howells __entry->call = call; 311*025db80cSDavid Howells __entry->rx_call = call->rxcall; 312*025db80cSDavid Howells __entry->ret = call->error; 313*025db80cSDavid Howells __entry->abort_code = call->abort_code; 314*025db80cSDavid Howells ), 315*025db80cSDavid Howells 316*025db80cSDavid Howells TP_printk(" c=%p ret=%d ab=%d [%p]", 317*025db80cSDavid Howells __entry->call, 318*025db80cSDavid Howells __entry->ret, 319*025db80cSDavid Howells __entry->abort_code, 320*025db80cSDavid Howells __entry->rx_call) 321*025db80cSDavid Howells ); 322*025db80cSDavid Howells 3238e8d7f13SDavid Howells #endif /* _TRACE_AFS_H */ 3248e8d7f13SDavid Howells 3258e8d7f13SDavid Howells /* This part must be outside protection */ 3268e8d7f13SDavid Howells #include <trace/define_trace.h> 327