Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'trace-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing updates from Steven Rostedt:
"Some clean ups and small fixes, but the biggest change is the addition
of the TRACE_DEFINE_ENUM() macro that can be used by tracepoints.

Tracepoints have helper functions for the TP_printk() called
__print_symbolic() and __print_flags() that lets a numeric number be
displayed as a a human comprehensible text. What is placed in the
TP_printk() is also shown in the tracepoint format file such that user
space tools like perf and trace-cmd can parse the binary data and
express the values too. Unfortunately, the way the TRACE_EVENT()
macro works, anything placed in the TP_printk() will be shown pretty
much exactly as is. The problem arises when enums are used. That's
because unlike macros, enums will not be changed into their values by
the C pre-processor. Thus, the enum string is exported to the format
file, and this makes it useless for user space tools.

The TRACE_DEFINE_ENUM() solves this by converting the enum strings in
the TP_printk() format into their number, and that is what is shown to
user space. For example, the tracepoint tlb_flush currently has this
in its format file:

__print_symbolic(REC->reason,
{ TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" },
{ TLB_REMOTE_SHOOTDOWN, "remote shootdown" },
{ TLB_LOCAL_SHOOTDOWN, "local shootdown" },
{ TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" })

After adding:

TRACE_DEFINE_ENUM(TLB_FLUSH_ON_TASK_SWITCH);
TRACE_DEFINE_ENUM(TLB_REMOTE_SHOOTDOWN);
TRACE_DEFINE_ENUM(TLB_LOCAL_SHOOTDOWN);
TRACE_DEFINE_ENUM(TLB_LOCAL_MM_SHOOTDOWN);

Its format file will contain this:

__print_symbolic(REC->reason,
{ 0, "flush on task switch" },
{ 1, "remote shootdown" },
{ 2, "local shootdown" },
{ 3, "local mm shootdown" })"

* tag 'trace-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (27 commits)
tracing: Add enum_map file to show enums that have been mapped
writeback: Export enums used by tracepoint to user space
v4l: Export enums used by tracepoints to user space
SUNRPC: Export enums in tracepoints to user space
mm: tracing: Export enums in tracepoints to user space
irq/tracing: Export enums in tracepoints to user space
f2fs: Export the enums in the tracepoints to userspace
net/9p/tracing: Export enums in tracepoints to userspace
x86/tlb/trace: Export enums in used by tlb_flush tracepoint
tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM()
tracing: Allow for modules to convert their enums to values
tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values
tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentation
tracing: Give system name a pointer
brcmsmac: Move each system tracepoints to their own header
iwlwifi: Move each system tracepoints to their own header
mac80211: Move message tracepoints to their own header
tracing: Add TRACE_SYSTEM_VAR to xhci-hcd
tracing: Add TRACE_SYSTEM_VAR to kvm-s390
tracing: Add TRACE_SYSTEM_VAR to intel-sst
...

+1959 -909
+7
arch/s390/kvm/trace-s390.h
··· 10 10 #define TRACE_INCLUDE_FILE trace-s390 11 11 12 12 /* 13 + * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a 14 + * legitimate C variable. It is not exported to user space. 15 + */ 16 + #undef TRACE_SYSTEM_VAR 17 + #define TRACE_SYSTEM_VAR kvm_s390 18 + 19 + /* 13 20 * Trace point for the creation of the kvm instance. 14 21 */ 15 22 TRACE_EVENT(kvm_s390_create_vm,
-1
drivers/gpu/drm/drm_trace.h
··· 7 7 8 8 #undef TRACE_SYSTEM 9 9 #define TRACE_SYSTEM drm 10 - #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) 11 10 #define TRACE_INCLUDE_FILE drm_trace 12 11 13 12 TRACE_EVENT(drm_vblank_event,
-1
drivers/gpu/drm/i915/i915_trace.h
··· 12 12 13 13 #undef TRACE_SYSTEM 14 14 #define TRACE_SYSTEM i915 15 - #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) 16 15 #define TRACE_INCLUDE_FILE i915_trace 17 16 18 17 /* pipe updates */
-1
drivers/gpu/drm/radeon/radeon_trace.h
··· 9 9 10 10 #undef TRACE_SYSTEM 11 11 #define TRACE_SYSTEM radeon 12 - #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) 13 12 #define TRACE_INCLUDE_FILE radeon_trace 14 13 15 14 TRACE_EVENT(radeon_bo_create,
+102
drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac.h
··· 1 + /* 2 + * Copyright (c) 2011 Broadcom Corporation 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ) 18 + #define __TRACE_BRCMSMAC_H 19 + 20 + #include <linux/tracepoint.h> 21 + 22 + #undef TRACE_SYSTEM 23 + #define TRACE_SYSTEM brcmsmac 24 + 25 + /* 26 + * We define a tracepoint, its arguments, its printk format and its 27 + * 'fast binary record' layout. 28 + */ 29 + TRACE_EVENT(brcms_timer, 30 + /* TPPROTO is the prototype of the function called by this tracepoint */ 31 + TP_PROTO(struct brcms_timer *t), 32 + /* 33 + * TPARGS(firstarg, p) are the parameters names, same as found in the 34 + * prototype. 35 + */ 36 + TP_ARGS(t), 37 + /* 38 + * Fast binary tracing: define the trace record via TP_STRUCT__entry(). 39 + * You can think about it like a regular C structure local variable 40 + * definition. 41 + */ 42 + TP_STRUCT__entry( 43 + __field(uint, ms) 44 + __field(uint, set) 45 + __field(uint, periodic) 46 + ), 47 + TP_fast_assign( 48 + __entry->ms = t->ms; 49 + __entry->set = t->set; 50 + __entry->periodic = t->periodic; 51 + ), 52 + TP_printk( 53 + "ms=%u set=%u periodic=%u", 54 + __entry->ms, __entry->set, __entry->periodic 55 + ) 56 + ); 57 + 58 + TRACE_EVENT(brcms_dpc, 59 + TP_PROTO(unsigned long data), 60 + TP_ARGS(data), 61 + TP_STRUCT__entry( 62 + __field(unsigned long, data) 63 + ), 64 + TP_fast_assign( 65 + __entry->data = data; 66 + ), 67 + TP_printk( 68 + "data=%p", 69 + (void *)__entry->data 70 + ) 71 + ); 72 + 73 + TRACE_EVENT(brcms_macintstatus, 74 + TP_PROTO(const struct device *dev, int in_isr, u32 macintstatus, 75 + u32 mask), 76 + TP_ARGS(dev, in_isr, macintstatus, mask), 77 + TP_STRUCT__entry( 78 + __string(dev, dev_name(dev)) 79 + __field(int, in_isr) 80 + __field(u32, macintstatus) 81 + __field(u32, mask) 82 + ), 83 + TP_fast_assign( 84 + __assign_str(dev, dev_name(dev)); 85 + __entry->in_isr = in_isr; 86 + __entry->macintstatus = macintstatus; 87 + __entry->mask = mask; 88 + ), 89 + TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev), 90 + __entry->in_isr, __entry->macintstatus, __entry->mask) 91 + ); 92 + #endif /* __TRACE_BRCMSMAC_H */ 93 + 94 + #ifdef CONFIG_BRCM_TRACING 95 + 96 + #undef TRACE_INCLUDE_PATH 97 + #define TRACE_INCLUDE_PATH . 98 + #undef TRACE_INCLUDE_FILE 99 + #define TRACE_INCLUDE_FILE brcms_trace_brcmsmac 100 + #include <trace/define_trace.h> 101 + 102 + #endif /* CONFIG_BRCM_TRACING */
+88
drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h
··· 1 + /* 2 + * Copyright (c) 2011 Broadcom Corporation 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + #if !defined(__TRACE_BRCMSMAC_MSG_H) || defined(TRACE_HEADER_MULTI_READ) 18 + #define __TRACE_BRCMSMAC_MSG_H 19 + 20 + #include <linux/tracepoint.h> 21 + 22 + #undef TRACE_SYSTEM 23 + #define TRACE_SYSTEM brcmsmac_msg 24 + 25 + #define MAX_MSG_LEN 100 26 + 27 + DECLARE_EVENT_CLASS(brcms_msg_event, 28 + TP_PROTO(struct va_format *vaf), 29 + TP_ARGS(vaf), 30 + TP_STRUCT__entry( 31 + __dynamic_array(char, msg, MAX_MSG_LEN) 32 + ), 33 + TP_fast_assign( 34 + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 35 + MAX_MSG_LEN, vaf->fmt, 36 + *vaf->va) >= MAX_MSG_LEN); 37 + ), 38 + TP_printk("%s", __get_str(msg)) 39 + ); 40 + 41 + DEFINE_EVENT(brcms_msg_event, brcms_info, 42 + TP_PROTO(struct va_format *vaf), 43 + TP_ARGS(vaf) 44 + ); 45 + 46 + DEFINE_EVENT(brcms_msg_event, brcms_warn, 47 + TP_PROTO(struct va_format *vaf), 48 + TP_ARGS(vaf) 49 + ); 50 + 51 + DEFINE_EVENT(brcms_msg_event, brcms_err, 52 + TP_PROTO(struct va_format *vaf), 53 + TP_ARGS(vaf) 54 + ); 55 + 56 + DEFINE_EVENT(brcms_msg_event, brcms_crit, 57 + TP_PROTO(struct va_format *vaf), 58 + TP_ARGS(vaf) 59 + ); 60 + 61 + TRACE_EVENT(brcms_dbg, 62 + TP_PROTO(u32 level, const char *func, struct va_format *vaf), 63 + TP_ARGS(level, func, vaf), 64 + TP_STRUCT__entry( 65 + __field(u32, level) 66 + __string(func, func) 67 + __dynamic_array(char, msg, MAX_MSG_LEN) 68 + ), 69 + TP_fast_assign( 70 + __entry->level = level; 71 + __assign_str(func, func); 72 + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 73 + MAX_MSG_LEN, vaf->fmt, 74 + *vaf->va) >= MAX_MSG_LEN); 75 + ), 76 + TP_printk("%s: %s", __get_str(func), __get_str(msg)) 77 + ); 78 + #endif /* __TRACE_BRCMSMAC_MSG_H */ 79 + 80 + #ifdef CONFIG_BRCM_TRACING 81 + 82 + #undef TRACE_INCLUDE_PATH 83 + #define TRACE_INCLUDE_PATH . 84 + #undef TRACE_INCLUDE_FILE 85 + #define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_msg 86 + #include <trace/define_trace.h> 87 + 88 + #endif /* CONFIG_BRCM_TRACING */
+110
drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h
··· 1 + /* 2 + * Copyright (c) 2011 Broadcom Corporation 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + #if !defined(__TRACE_BRCMSMAC_TX_H) || defined(TRACE_HEADER_MULTI_READ) 18 + #define __TRACE_BRCMSMAC_TX_H 19 + 20 + #include <linux/tracepoint.h> 21 + 22 + #undef TRACE_SYSTEM 23 + #define TRACE_SYSTEM brcmsmac_tx 24 + 25 + TRACE_EVENT(brcms_txdesc, 26 + TP_PROTO(const struct device *dev, 27 + void *txh, size_t txh_len), 28 + TP_ARGS(dev, txh, txh_len), 29 + TP_STRUCT__entry( 30 + __string(dev, dev_name(dev)) 31 + __dynamic_array(u8, txh, txh_len) 32 + ), 33 + TP_fast_assign( 34 + __assign_str(dev, dev_name(dev)); 35 + memcpy(__get_dynamic_array(txh), txh, txh_len); 36 + ), 37 + TP_printk("[%s] txdesc", __get_str(dev)) 38 + ); 39 + 40 + TRACE_EVENT(brcms_txstatus, 41 + TP_PROTO(const struct device *dev, u16 framelen, u16 frameid, 42 + u16 status, u16 lasttxtime, u16 sequence, u16 phyerr, 43 + u16 ackphyrxsh), 44 + TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr, 45 + ackphyrxsh), 46 + TP_STRUCT__entry( 47 + __string(dev, dev_name(dev)) 48 + __field(u16, framelen) 49 + __field(u16, frameid) 50 + __field(u16, status) 51 + __field(u16, lasttxtime) 52 + __field(u16, sequence) 53 + __field(u16, phyerr) 54 + __field(u16, ackphyrxsh) 55 + ), 56 + TP_fast_assign( 57 + __assign_str(dev, dev_name(dev)); 58 + __entry->framelen = framelen; 59 + __entry->frameid = frameid; 60 + __entry->status = status; 61 + __entry->lasttxtime = lasttxtime; 62 + __entry->sequence = sequence; 63 + __entry->phyerr = phyerr; 64 + __entry->ackphyrxsh = ackphyrxsh; 65 + ), 66 + TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x " 67 + "Seq %#04x PHYTxStatus %#04x RxAck %#04x", 68 + __get_str(dev), __entry->frameid, __entry->status, 69 + __entry->lasttxtime, __entry->sequence, __entry->phyerr, 70 + __entry->ackphyrxsh) 71 + ); 72 + 73 + TRACE_EVENT(brcms_ampdu_session, 74 + TP_PROTO(const struct device *dev, unsigned max_ampdu_len, 75 + u16 max_ampdu_frames, u16 ampdu_len, u16 ampdu_frames, 76 + u16 dma_len), 77 + TP_ARGS(dev, max_ampdu_len, max_ampdu_frames, ampdu_len, ampdu_frames, 78 + dma_len), 79 + TP_STRUCT__entry( 80 + __string(dev, dev_name(dev)) 81 + __field(unsigned, max_ampdu_len) 82 + __field(u16, max_ampdu_frames) 83 + __field(u16, ampdu_len) 84 + __field(u16, ampdu_frames) 85 + __field(u16, dma_len) 86 + ), 87 + TP_fast_assign( 88 + __assign_str(dev, dev_name(dev)); 89 + __entry->max_ampdu_len = max_ampdu_len; 90 + __entry->max_ampdu_frames = max_ampdu_frames; 91 + __entry->ampdu_len = ampdu_len; 92 + __entry->ampdu_frames = ampdu_frames; 93 + __entry->dma_len = dma_len; 94 + ), 95 + TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u", 96 + __get_str(dev), __entry->max_ampdu_len, 97 + __entry->max_ampdu_frames, __entry->ampdu_len, 98 + __entry->ampdu_frames, __entry->dma_len) 99 + ); 100 + #endif /* __TRACE_BRCMSMAC_TX_H */ 101 + 102 + #ifdef CONFIG_BRCM_TRACING 103 + 104 + #undef TRACE_INCLUDE_PATH 105 + #define TRACE_INCLUDE_PATH . 106 + #undef TRACE_INCLUDE_FILE 107 + #define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_tx 108 + #include <trace/define_trace.h> 109 + 110 + #endif /* CONFIG_BRCM_TRACING */
+5 -220
drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h
··· 14 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 15 */ 16 16 17 - #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ) 18 - 19 - #define __TRACE_BRCMSMAC_H 17 + #ifndef __BRCMS_TRACE_EVENTS_H 18 + #define __BRCMS_TRACE_EVENTS_H 20 19 21 20 #include <linux/types.h> 22 21 #include <linux/device.h> ··· 33 34 static inline void trace_ ## name(proto) {} 34 35 #endif 35 36 36 - #undef TRACE_SYSTEM 37 - #define TRACE_SYSTEM brcmsmac 38 - 39 - /* 40 - * We define a tracepoint, its arguments, its printk format and its 41 - * 'fast binary record' layout. 42 - */ 43 - TRACE_EVENT(brcms_timer, 44 - /* TPPROTO is the prototype of the function called by this tracepoint */ 45 - TP_PROTO(struct brcms_timer *t), 46 - /* 47 - * TPARGS(firstarg, p) are the parameters names, same as found in the 48 - * prototype. 49 - */ 50 - TP_ARGS(t), 51 - /* 52 - * Fast binary tracing: define the trace record via TP_STRUCT__entry(). 53 - * You can think about it like a regular C structure local variable 54 - * definition. 55 - */ 56 - TP_STRUCT__entry( 57 - __field(uint, ms) 58 - __field(uint, set) 59 - __field(uint, periodic) 60 - ), 61 - TP_fast_assign( 62 - __entry->ms = t->ms; 63 - __entry->set = t->set; 64 - __entry->periodic = t->periodic; 65 - ), 66 - TP_printk( 67 - "ms=%u set=%u periodic=%u", 68 - __entry->ms, __entry->set, __entry->periodic 69 - ) 70 - ); 71 - 72 - TRACE_EVENT(brcms_dpc, 73 - TP_PROTO(unsigned long data), 74 - TP_ARGS(data), 75 - TP_STRUCT__entry( 76 - __field(unsigned long, data) 77 - ), 78 - TP_fast_assign( 79 - __entry->data = data; 80 - ), 81 - TP_printk( 82 - "data=%p", 83 - (void *)__entry->data 84 - ) 85 - ); 86 - 87 - TRACE_EVENT(brcms_macintstatus, 88 - TP_PROTO(const struct device *dev, int in_isr, u32 macintstatus, 89 - u32 mask), 90 - TP_ARGS(dev, in_isr, macintstatus, mask), 91 - TP_STRUCT__entry( 92 - __string(dev, dev_name(dev)) 93 - __field(int, in_isr) 94 - __field(u32, macintstatus) 95 - __field(u32, mask) 96 - ), 97 - TP_fast_assign( 98 - __assign_str(dev, dev_name(dev)); 99 - __entry->in_isr = in_isr; 100 - __entry->macintstatus = macintstatus; 101 - __entry->mask = mask; 102 - ), 103 - TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev), 104 - __entry->in_isr, __entry->macintstatus, __entry->mask) 105 - ); 106 - 107 - #undef TRACE_SYSTEM 108 - #define TRACE_SYSTEM brcmsmac_tx 109 - 110 - TRACE_EVENT(brcms_txdesc, 111 - TP_PROTO(const struct device *dev, 112 - void *txh, size_t txh_len), 113 - TP_ARGS(dev, txh, txh_len), 114 - TP_STRUCT__entry( 115 - __string(dev, dev_name(dev)) 116 - __dynamic_array(u8, txh, txh_len) 117 - ), 118 - TP_fast_assign( 119 - __assign_str(dev, dev_name(dev)); 120 - memcpy(__get_dynamic_array(txh), txh, txh_len); 121 - ), 122 - TP_printk("[%s] txdesc", __get_str(dev)) 123 - ); 124 - 125 - TRACE_EVENT(brcms_txstatus, 126 - TP_PROTO(const struct device *dev, u16 framelen, u16 frameid, 127 - u16 status, u16 lasttxtime, u16 sequence, u16 phyerr, 128 - u16 ackphyrxsh), 129 - TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr, 130 - ackphyrxsh), 131 - TP_STRUCT__entry( 132 - __string(dev, dev_name(dev)) 133 - __field(u16, framelen) 134 - __field(u16, frameid) 135 - __field(u16, status) 136 - __field(u16, lasttxtime) 137 - __field(u16, sequence) 138 - __field(u16, phyerr) 139 - __field(u16, ackphyrxsh) 140 - ), 141 - TP_fast_assign( 142 - __assign_str(dev, dev_name(dev)); 143 - __entry->framelen = framelen; 144 - __entry->frameid = frameid; 145 - __entry->status = status; 146 - __entry->lasttxtime = lasttxtime; 147 - __entry->sequence = sequence; 148 - __entry->phyerr = phyerr; 149 - __entry->ackphyrxsh = ackphyrxsh; 150 - ), 151 - TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x " 152 - "Seq %#04x PHYTxStatus %#04x RxAck %#04x", 153 - __get_str(dev), __entry->frameid, __entry->status, 154 - __entry->lasttxtime, __entry->sequence, __entry->phyerr, 155 - __entry->ackphyrxsh) 156 - ); 157 - 158 - TRACE_EVENT(brcms_ampdu_session, 159 - TP_PROTO(const struct device *dev, unsigned max_ampdu_len, 160 - u16 max_ampdu_frames, u16 ampdu_len, u16 ampdu_frames, 161 - u16 dma_len), 162 - TP_ARGS(dev, max_ampdu_len, max_ampdu_frames, ampdu_len, ampdu_frames, 163 - dma_len), 164 - TP_STRUCT__entry( 165 - __string(dev, dev_name(dev)) 166 - __field(unsigned, max_ampdu_len) 167 - __field(u16, max_ampdu_frames) 168 - __field(u16, ampdu_len) 169 - __field(u16, ampdu_frames) 170 - __field(u16, dma_len) 171 - ), 172 - TP_fast_assign( 173 - __assign_str(dev, dev_name(dev)); 174 - __entry->max_ampdu_len = max_ampdu_len; 175 - __entry->max_ampdu_frames = max_ampdu_frames; 176 - __entry->ampdu_len = ampdu_len; 177 - __entry->ampdu_frames = ampdu_frames; 178 - __entry->dma_len = dma_len; 179 - ), 180 - TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u", 181 - __get_str(dev), __entry->max_ampdu_len, 182 - __entry->max_ampdu_frames, __entry->ampdu_len, 183 - __entry->ampdu_frames, __entry->dma_len) 184 - ); 185 - 186 - #undef TRACE_SYSTEM 187 - #define TRACE_SYSTEM brcmsmac_msg 188 - 189 - #define MAX_MSG_LEN 100 190 - 191 - DECLARE_EVENT_CLASS(brcms_msg_event, 192 - TP_PROTO(struct va_format *vaf), 193 - TP_ARGS(vaf), 194 - TP_STRUCT__entry( 195 - __dynamic_array(char, msg, MAX_MSG_LEN) 196 - ), 197 - TP_fast_assign( 198 - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 199 - MAX_MSG_LEN, vaf->fmt, 200 - *vaf->va) >= MAX_MSG_LEN); 201 - ), 202 - TP_printk("%s", __get_str(msg)) 203 - ); 204 - 205 - DEFINE_EVENT(brcms_msg_event, brcms_info, 206 - TP_PROTO(struct va_format *vaf), 207 - TP_ARGS(vaf) 208 - ); 209 - 210 - DEFINE_EVENT(brcms_msg_event, brcms_warn, 211 - TP_PROTO(struct va_format *vaf), 212 - TP_ARGS(vaf) 213 - ); 214 - 215 - DEFINE_EVENT(brcms_msg_event, brcms_err, 216 - TP_PROTO(struct va_format *vaf), 217 - TP_ARGS(vaf) 218 - ); 219 - 220 - DEFINE_EVENT(brcms_msg_event, brcms_crit, 221 - TP_PROTO(struct va_format *vaf), 222 - TP_ARGS(vaf) 223 - ); 224 - 225 - TRACE_EVENT(brcms_dbg, 226 - TP_PROTO(u32 level, const char *func, struct va_format *vaf), 227 - TP_ARGS(level, func, vaf), 228 - TP_STRUCT__entry( 229 - __field(u32, level) 230 - __string(func, func) 231 - __dynamic_array(char, msg, MAX_MSG_LEN) 232 - ), 233 - TP_fast_assign( 234 - __entry->level = level; 235 - __assign_str(func, func); 236 - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 237 - MAX_MSG_LEN, vaf->fmt, 238 - *vaf->va) >= MAX_MSG_LEN); 239 - ), 240 - TP_printk("%s: %s", __get_str(func), __get_str(msg)) 241 - ); 37 + #include "brcms_trace_brcmsmac.h" 38 + #include "brcms_trace_brcmsmac_tx.h" 39 + #include "brcms_trace_brcmsmac_msg.h" 242 40 243 41 #endif /* __TRACE_BRCMSMAC_H */ 244 - 245 - #ifdef CONFIG_BRCM_TRACING 246 - 247 - #undef TRACE_INCLUDE_PATH 248 - #define TRACE_INCLUDE_PATH . 249 - #undef TRACE_INCLUDE_FILE 250 - #define TRACE_INCLUDE_FILE brcms_trace_events 251 - 252 - #include <trace/define_trace.h> 253 - 254 - #endif /* CONFIG_BRCM_TRACING */
+79
drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of version 2 of the GNU General Public License as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along with 15 + * this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 + * 18 + * The full GNU General Public License is included in this distribution in the 19 + * file called LICENSE. 20 + * 21 + * Contact Information: 22 + * Intel Linux Wireless <ilw@linux.intel.com> 23 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 + * 25 + *****************************************************************************/ 26 + 27 + #if !defined(__IWLWIFI_DEVICE_TRACE_DATA) || defined(TRACE_HEADER_MULTI_READ) 28 + #define __IWLWIFI_DEVICE_TRACE_DATA 29 + 30 + #include <linux/tracepoint.h> 31 + 32 + #undef TRACE_SYSTEM 33 + #define TRACE_SYSTEM iwlwifi_data 34 + 35 + TRACE_EVENT(iwlwifi_dev_tx_data, 36 + TP_PROTO(const struct device *dev, 37 + struct sk_buff *skb, 38 + void *data, size_t data_len), 39 + TP_ARGS(dev, skb, data, data_len), 40 + TP_STRUCT__entry( 41 + DEV_ENTRY 42 + 43 + __dynamic_array(u8, data, iwl_trace_data(skb) ? data_len : 0) 44 + ), 45 + TP_fast_assign( 46 + DEV_ASSIGN; 47 + if (iwl_trace_data(skb)) 48 + memcpy(__get_dynamic_array(data), data, data_len); 49 + ), 50 + TP_printk("[%s] TX frame data", __get_str(dev)) 51 + ); 52 + 53 + TRACE_EVENT(iwlwifi_dev_rx_data, 54 + TP_PROTO(const struct device *dev, 55 + const struct iwl_trans *trans, 56 + void *rxbuf, size_t len), 57 + TP_ARGS(dev, trans, rxbuf, len), 58 + TP_STRUCT__entry( 59 + DEV_ENTRY 60 + 61 + __dynamic_array(u8, data, 62 + len - iwl_rx_trace_len(trans, rxbuf, len)) 63 + ), 64 + TP_fast_assign( 65 + size_t offs = iwl_rx_trace_len(trans, rxbuf, len); 66 + DEV_ASSIGN; 67 + if (offs < len) 68 + memcpy(__get_dynamic_array(data), 69 + ((u8 *)rxbuf) + offs, len - offs); 70 + ), 71 + TP_printk("[%s] RX frame data", __get_str(dev)) 72 + ); 73 + #endif /* __IWLWIFI_DEVICE_TRACE_DATA */ 74 + 75 + #undef TRACE_INCLUDE_PATH 76 + #define TRACE_INCLUDE_PATH . 77 + #undef TRACE_INCLUDE_FILE 78 + #define TRACE_INCLUDE_FILE iwl-devtrace-data 79 + #include <trace/define_trace.h>
+155
drivers/net/wireless/iwlwifi/iwl-devtrace-io.h
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of version 2 of the GNU General Public License as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along with 15 + * this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 + * 18 + * The full GNU General Public License is included in this distribution in the 19 + * file called LICENSE. 20 + * 21 + * Contact Information: 22 + * Intel Linux Wireless <ilw@linux.intel.com> 23 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 + * 25 + *****************************************************************************/ 26 + 27 + #if !defined(__IWLWIFI_DEVICE_TRACE_IO) || defined(TRACE_HEADER_MULTI_READ) 28 + #define __IWLWIFI_DEVICE_TRACE_IO 29 + 30 + #include <linux/tracepoint.h> 31 + 32 + #undef TRACE_SYSTEM 33 + #define TRACE_SYSTEM iwlwifi_io 34 + 35 + TRACE_EVENT(iwlwifi_dev_ioread32, 36 + TP_PROTO(const struct device *dev, u32 offs, u32 val), 37 + TP_ARGS(dev, offs, val), 38 + TP_STRUCT__entry( 39 + DEV_ENTRY 40 + __field(u32, offs) 41 + __field(u32, val) 42 + ), 43 + TP_fast_assign( 44 + DEV_ASSIGN; 45 + __entry->offs = offs; 46 + __entry->val = val; 47 + ), 48 + TP_printk("[%s] read io[%#x] = %#x", 49 + __get_str(dev), __entry->offs, __entry->val) 50 + ); 51 + 52 + TRACE_EVENT(iwlwifi_dev_iowrite8, 53 + TP_PROTO(const struct device *dev, u32 offs, u8 val), 54 + TP_ARGS(dev, offs, val), 55 + TP_STRUCT__entry( 56 + DEV_ENTRY 57 + __field(u32, offs) 58 + __field(u8, val) 59 + ), 60 + TP_fast_assign( 61 + DEV_ASSIGN; 62 + __entry->offs = offs; 63 + __entry->val = val; 64 + ), 65 + TP_printk("[%s] write io[%#x] = %#x)", 66 + __get_str(dev), __entry->offs, __entry->val) 67 + ); 68 + 69 + TRACE_EVENT(iwlwifi_dev_iowrite32, 70 + TP_PROTO(const struct device *dev, u32 offs, u32 val), 71 + TP_ARGS(dev, offs, val), 72 + TP_STRUCT__entry( 73 + DEV_ENTRY 74 + __field(u32, offs) 75 + __field(u32, val) 76 + ), 77 + TP_fast_assign( 78 + DEV_ASSIGN; 79 + __entry->offs = offs; 80 + __entry->val = val; 81 + ), 82 + TP_printk("[%s] write io[%#x] = %#x)", 83 + __get_str(dev), __entry->offs, __entry->val) 84 + ); 85 + 86 + TRACE_EVENT(iwlwifi_dev_iowrite_prph32, 87 + TP_PROTO(const struct device *dev, u32 offs, u32 val), 88 + TP_ARGS(dev, offs, val), 89 + TP_STRUCT__entry( 90 + DEV_ENTRY 91 + __field(u32, offs) 92 + __field(u32, val) 93 + ), 94 + TP_fast_assign( 95 + DEV_ASSIGN; 96 + __entry->offs = offs; 97 + __entry->val = val; 98 + ), 99 + TP_printk("[%s] write PRPH[%#x] = %#x)", 100 + __get_str(dev), __entry->offs, __entry->val) 101 + ); 102 + 103 + TRACE_EVENT(iwlwifi_dev_ioread_prph32, 104 + TP_PROTO(const struct device *dev, u32 offs, u32 val), 105 + TP_ARGS(dev, offs, val), 106 + TP_STRUCT__entry( 107 + DEV_ENTRY 108 + __field(u32, offs) 109 + __field(u32, val) 110 + ), 111 + TP_fast_assign( 112 + DEV_ASSIGN; 113 + __entry->offs = offs; 114 + __entry->val = val; 115 + ), 116 + TP_printk("[%s] read PRPH[%#x] = %#x", 117 + __get_str(dev), __entry->offs, __entry->val) 118 + ); 119 + 120 + TRACE_EVENT(iwlwifi_dev_irq, 121 + TP_PROTO(const struct device *dev), 122 + TP_ARGS(dev), 123 + TP_STRUCT__entry( 124 + DEV_ENTRY 125 + ), 126 + TP_fast_assign( 127 + DEV_ASSIGN; 128 + ), 129 + /* TP_printk("") doesn't compile */ 130 + TP_printk("%d", 0) 131 + ); 132 + 133 + TRACE_EVENT(iwlwifi_dev_ict_read, 134 + TP_PROTO(const struct device *dev, u32 index, u32 value), 135 + TP_ARGS(dev, index, value), 136 + TP_STRUCT__entry( 137 + DEV_ENTRY 138 + __field(u32, index) 139 + __field(u32, value) 140 + ), 141 + TP_fast_assign( 142 + DEV_ASSIGN; 143 + __entry->index = index; 144 + __entry->value = value; 145 + ), 146 + TP_printk("[%s] read ict[%d] = %#.8x", 147 + __get_str(dev), __entry->index, __entry->value) 148 + ); 149 + #endif /* __IWLWIFI_DEVICE_TRACE_IO */ 150 + 151 + #undef TRACE_INCLUDE_PATH 152 + #define TRACE_INCLUDE_PATH . 153 + #undef TRACE_INCLUDE_FILE 154 + #define TRACE_INCLUDE_FILE iwl-devtrace-io 155 + #include <trace/define_trace.h>
+200
drivers/net/wireless/iwlwifi/iwl-devtrace-iwlwifi.h
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of version 2 of the GNU General Public License as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along with 15 + * this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 + * 18 + * The full GNU General Public License is included in this distribution in the 19 + * file called LICENSE. 20 + * 21 + * Contact Information: 22 + * Intel Linux Wireless <ilw@linux.intel.com> 23 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 + * 25 + *****************************************************************************/ 26 + 27 + #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ) 28 + #define __IWLWIFI_DEVICE_TRACE_IWLWIFI 29 + 30 + #include <linux/tracepoint.h> 31 + 32 + #undef TRACE_SYSTEM 33 + #define TRACE_SYSTEM iwlwifi 34 + 35 + TRACE_EVENT(iwlwifi_dev_hcmd, 36 + TP_PROTO(const struct device *dev, 37 + struct iwl_host_cmd *cmd, u16 total_size, 38 + struct iwl_cmd_header *hdr), 39 + TP_ARGS(dev, cmd, total_size, hdr), 40 + TP_STRUCT__entry( 41 + DEV_ENTRY 42 + __dynamic_array(u8, hcmd, total_size) 43 + __field(u32, flags) 44 + ), 45 + TP_fast_assign( 46 + int i, offset = sizeof(*hdr); 47 + 48 + DEV_ASSIGN; 49 + __entry->flags = cmd->flags; 50 + memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); 51 + 52 + for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 53 + if (!cmd->len[i]) 54 + continue; 55 + memcpy((u8 *)__get_dynamic_array(hcmd) + offset, 56 + cmd->data[i], cmd->len[i]); 57 + offset += cmd->len[i]; 58 + } 59 + ), 60 + TP_printk("[%s] hcmd %#.2x (%ssync)", 61 + __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0], 62 + __entry->flags & CMD_ASYNC ? "a" : "") 63 + ); 64 + 65 + TRACE_EVENT(iwlwifi_dev_rx, 66 + TP_PROTO(const struct device *dev, const struct iwl_trans *trans, 67 + void *rxbuf, size_t len), 68 + TP_ARGS(dev, trans, rxbuf, len), 69 + TP_STRUCT__entry( 70 + DEV_ENTRY 71 + __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, rxbuf, len)) 72 + ), 73 + TP_fast_assign( 74 + DEV_ASSIGN; 75 + memcpy(__get_dynamic_array(rxbuf), rxbuf, 76 + iwl_rx_trace_len(trans, rxbuf, len)); 77 + ), 78 + TP_printk("[%s] RX cmd %#.2x", 79 + __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4]) 80 + ); 81 + 82 + TRACE_EVENT(iwlwifi_dev_tx, 83 + TP_PROTO(const struct device *dev, struct sk_buff *skb, 84 + void *tfd, size_t tfdlen, 85 + void *buf0, size_t buf0_len, 86 + void *buf1, size_t buf1_len), 87 + TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), 88 + TP_STRUCT__entry( 89 + DEV_ENTRY 90 + 91 + __field(size_t, framelen) 92 + __dynamic_array(u8, tfd, tfdlen) 93 + 94 + /* 95 + * Do not insert between or below these items, 96 + * we want to keep the frame together (except 97 + * for the possible padding). 98 + */ 99 + __dynamic_array(u8, buf0, buf0_len) 100 + __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len) 101 + ), 102 + TP_fast_assign( 103 + DEV_ASSIGN; 104 + __entry->framelen = buf0_len + buf1_len; 105 + memcpy(__get_dynamic_array(tfd), tfd, tfdlen); 106 + memcpy(__get_dynamic_array(buf0), buf0, buf0_len); 107 + if (!iwl_trace_data(skb)) 108 + memcpy(__get_dynamic_array(buf1), buf1, buf1_len); 109 + ), 110 + TP_printk("[%s] TX %.2x (%zu bytes)", 111 + __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], 112 + __entry->framelen) 113 + ); 114 + 115 + TRACE_EVENT(iwlwifi_dev_ucode_error, 116 + TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, 117 + u32 data1, u32 data2, u32 line, u32 blink1, 118 + u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, 119 + u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, 120 + u32 brd_ver), 121 + TP_ARGS(dev, desc, tsf_low, data1, data2, line, 122 + blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, 123 + gp3, ucode_ver, hw_ver, brd_ver), 124 + TP_STRUCT__entry( 125 + DEV_ENTRY 126 + __field(u32, desc) 127 + __field(u32, tsf_low) 128 + __field(u32, data1) 129 + __field(u32, data2) 130 + __field(u32, line) 131 + __field(u32, blink1) 132 + __field(u32, blink2) 133 + __field(u32, ilink1) 134 + __field(u32, ilink2) 135 + __field(u32, bcon_time) 136 + __field(u32, gp1) 137 + __field(u32, gp2) 138 + __field(u32, gp3) 139 + __field(u32, ucode_ver) 140 + __field(u32, hw_ver) 141 + __field(u32, brd_ver) 142 + ), 143 + TP_fast_assign( 144 + DEV_ASSIGN; 145 + __entry->desc = desc; 146 + __entry->tsf_low = tsf_low; 147 + __entry->data1 = data1; 148 + __entry->data2 = data2; 149 + __entry->line = line; 150 + __entry->blink1 = blink1; 151 + __entry->blink2 = blink2; 152 + __entry->ilink1 = ilink1; 153 + __entry->ilink2 = ilink2; 154 + __entry->bcon_time = bcon_time; 155 + __entry->gp1 = gp1; 156 + __entry->gp2 = gp2; 157 + __entry->gp3 = gp3; 158 + __entry->ucode_ver = ucode_ver; 159 + __entry->hw_ver = hw_ver; 160 + __entry->brd_ver = brd_ver; 161 + ), 162 + TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " 163 + "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " 164 + "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " 165 + "hw 0x%08X brd 0x%08X", 166 + __get_str(dev), __entry->desc, __entry->tsf_low, 167 + __entry->data1, 168 + __entry->data2, __entry->line, __entry->blink1, 169 + __entry->blink2, __entry->ilink1, __entry->ilink2, 170 + __entry->bcon_time, __entry->gp1, __entry->gp2, 171 + __entry->gp3, __entry->ucode_ver, __entry->hw_ver, 172 + __entry->brd_ver) 173 + ); 174 + 175 + TRACE_EVENT(iwlwifi_dev_ucode_event, 176 + TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), 177 + TP_ARGS(dev, time, data, ev), 178 + TP_STRUCT__entry( 179 + DEV_ENTRY 180 + 181 + __field(u32, time) 182 + __field(u32, data) 183 + __field(u32, ev) 184 + ), 185 + TP_fast_assign( 186 + DEV_ASSIGN; 187 + __entry->time = time; 188 + __entry->data = data; 189 + __entry->ev = ev; 190 + ), 191 + TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", 192 + __get_str(dev), __entry->time, __entry->data, __entry->ev) 193 + ); 194 + #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */ 195 + 196 + #undef TRACE_INCLUDE_PATH 197 + #define TRACE_INCLUDE_PATH . 198 + #undef TRACE_INCLUDE_FILE 199 + #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi 200 + #include <trace/define_trace.h>
+97
drivers/net/wireless/iwlwifi/iwl-devtrace-msg.h
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of version 2 of the GNU General Public License as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along with 15 + * this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 + * 18 + * The full GNU General Public License is included in this distribution in the 19 + * file called LICENSE. 20 + * 21 + * Contact Information: 22 + * Intel Linux Wireless <ilw@linux.intel.com> 23 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 + * 25 + *****************************************************************************/ 26 + 27 + #if !defined(__IWLWIFI_DEVICE_TRACE_MSG) || defined(TRACE_HEADER_MULTI_READ) 28 + #define __IWLWIFI_DEVICE_TRACE_MSG 29 + 30 + #include <linux/tracepoint.h> 31 + 32 + #undef TRACE_SYSTEM 33 + #define TRACE_SYSTEM iwlwifi_msg 34 + 35 + #define MAX_MSG_LEN 110 36 + 37 + DECLARE_EVENT_CLASS(iwlwifi_msg_event, 38 + TP_PROTO(struct va_format *vaf), 39 + TP_ARGS(vaf), 40 + TP_STRUCT__entry( 41 + __dynamic_array(char, msg, MAX_MSG_LEN) 42 + ), 43 + TP_fast_assign( 44 + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 45 + MAX_MSG_LEN, vaf->fmt, 46 + *vaf->va) >= MAX_MSG_LEN); 47 + ), 48 + TP_printk("%s", __get_str(msg)) 49 + ); 50 + 51 + DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err, 52 + TP_PROTO(struct va_format *vaf), 53 + TP_ARGS(vaf) 54 + ); 55 + 56 + DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn, 57 + TP_PROTO(struct va_format *vaf), 58 + TP_ARGS(vaf) 59 + ); 60 + 61 + DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info, 62 + TP_PROTO(struct va_format *vaf), 63 + TP_ARGS(vaf) 64 + ); 65 + 66 + DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit, 67 + TP_PROTO(struct va_format *vaf), 68 + TP_ARGS(vaf) 69 + ); 70 + 71 + TRACE_EVENT(iwlwifi_dbg, 72 + TP_PROTO(u32 level, bool in_interrupt, const char *function, 73 + struct va_format *vaf), 74 + TP_ARGS(level, in_interrupt, function, vaf), 75 + TP_STRUCT__entry( 76 + __field(u32, level) 77 + __field(u8, in_interrupt) 78 + __string(function, function) 79 + __dynamic_array(char, msg, MAX_MSG_LEN) 80 + ), 81 + TP_fast_assign( 82 + __entry->level = level; 83 + __entry->in_interrupt = in_interrupt; 84 + __assign_str(function, function); 85 + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 86 + MAX_MSG_LEN, vaf->fmt, 87 + *vaf->va) >= MAX_MSG_LEN); 88 + ), 89 + TP_printk("%s", __get_str(msg)) 90 + ); 91 + #endif /* __IWLWIFI_DEVICE_TRACE_MSG */ 92 + 93 + #undef TRACE_INCLUDE_PATH 94 + #define TRACE_INCLUDE_PATH . 95 + #undef TRACE_INCLUDE_FILE 96 + #define TRACE_INCLUDE_FILE iwl-devtrace-msg 97 + #include <trace/define_trace.h>
+81
drivers/net/wireless/iwlwifi/iwl-devtrace-ucode.h
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of version 2 of the GNU General Public License as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along with 15 + * this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 + * 18 + * The full GNU General Public License is included in this distribution in the 19 + * file called LICENSE. 20 + * 21 + * Contact Information: 22 + * Intel Linux Wireless <ilw@linux.intel.com> 23 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 + * 25 + *****************************************************************************/ 26 + 27 + #if !defined(__IWLWIFI_DEVICE_TRACE_UCODE) || defined(TRACE_HEADER_MULTI_READ) 28 + #define __IWLWIFI_DEVICE_TRACE_UCODE 29 + 30 + #include <linux/tracepoint.h> 31 + 32 + #undef TRACE_SYSTEM 33 + #define TRACE_SYSTEM iwlwifi_ucode 34 + 35 + TRACE_EVENT(iwlwifi_dev_ucode_cont_event, 36 + TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), 37 + TP_ARGS(dev, time, data, ev), 38 + TP_STRUCT__entry( 39 + DEV_ENTRY 40 + 41 + __field(u32, time) 42 + __field(u32, data) 43 + __field(u32, ev) 44 + ), 45 + TP_fast_assign( 46 + DEV_ASSIGN; 47 + __entry->time = time; 48 + __entry->data = data; 49 + __entry->ev = ev; 50 + ), 51 + TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", 52 + __get_str(dev), __entry->time, __entry->data, __entry->ev) 53 + ); 54 + 55 + TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, 56 + TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry), 57 + TP_ARGS(dev, wraps, n_entry, p_entry), 58 + TP_STRUCT__entry( 59 + DEV_ENTRY 60 + 61 + __field(u32, wraps) 62 + __field(u32, n_entry) 63 + __field(u32, p_entry) 64 + ), 65 + TP_fast_assign( 66 + DEV_ASSIGN; 67 + __entry->wraps = wraps; 68 + __entry->n_entry = n_entry; 69 + __entry->p_entry = p_entry; 70 + ), 71 + TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X", 72 + __get_str(dev), __entry->wraps, __entry->n_entry, 73 + __entry->p_entry) 74 + ); 75 + #endif /* __IWLWIFI_DEVICE_TRACE_UCODE */ 76 + 77 + #undef TRACE_INCLUDE_PATH 78 + #define TRACE_INCLUDE_PATH . 79 + #undef TRACE_INCLUDE_FILE 80 + #define TRACE_INCLUDE_FILE iwl-devtrace-ucode 81 + #include <trace/define_trace.h>
+6 -432
drivers/net/wireless/iwlwifi/iwl-devtrace.h
··· 24 24 * 25 25 *****************************************************************************/ 26 26 27 - #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) 27 + #ifndef __IWLWIFI_DEVICE_TRACE 28 28 #include <linux/skbuff.h> 29 29 #include <linux/ieee80211.h> 30 30 #include <net/cfg80211.h> ··· 80 80 #define DEV_ENTRY __string(dev, dev_name(dev)) 81 81 #define DEV_ASSIGN __assign_str(dev, dev_name(dev)) 82 82 83 - #undef TRACE_SYSTEM 84 - #define TRACE_SYSTEM iwlwifi_io 83 + #include "iwl-devtrace-io.h" 84 + #include "iwl-devtrace-ucode.h" 85 + #include "iwl-devtrace-msg.h" 86 + #include "iwl-devtrace-data.h" 87 + #include "iwl-devtrace-iwlwifi.h" 85 88 86 - TRACE_EVENT(iwlwifi_dev_ioread32, 87 - TP_PROTO(const struct device *dev, u32 offs, u32 val), 88 - TP_ARGS(dev, offs, val), 89 - TP_STRUCT__entry( 90 - DEV_ENTRY 91 - __field(u32, offs) 92 - __field(u32, val) 93 - ), 94 - TP_fast_assign( 95 - DEV_ASSIGN; 96 - __entry->offs = offs; 97 - __entry->val = val; 98 - ), 99 - TP_printk("[%s] read io[%#x] = %#x", 100 - __get_str(dev), __entry->offs, __entry->val) 101 - ); 102 - 103 - TRACE_EVENT(iwlwifi_dev_iowrite8, 104 - TP_PROTO(const struct device *dev, u32 offs, u8 val), 105 - TP_ARGS(dev, offs, val), 106 - TP_STRUCT__entry( 107 - DEV_ENTRY 108 - __field(u32, offs) 109 - __field(u8, val) 110 - ), 111 - TP_fast_assign( 112 - DEV_ASSIGN; 113 - __entry->offs = offs; 114 - __entry->val = val; 115 - ), 116 - TP_printk("[%s] write io[%#x] = %#x)", 117 - __get_str(dev), __entry->offs, __entry->val) 118 - ); 119 - 120 - TRACE_EVENT(iwlwifi_dev_iowrite32, 121 - TP_PROTO(const struct device *dev, u32 offs, u32 val), 122 - TP_ARGS(dev, offs, val), 123 - TP_STRUCT__entry( 124 - DEV_ENTRY 125 - __field(u32, offs) 126 - __field(u32, val) 127 - ), 128 - TP_fast_assign( 129 - DEV_ASSIGN; 130 - __entry->offs = offs; 131 - __entry->val = val; 132 - ), 133 - TP_printk("[%s] write io[%#x] = %#x)", 134 - __get_str(dev), __entry->offs, __entry->val) 135 - ); 136 - 137 - TRACE_EVENT(iwlwifi_dev_iowrite_prph32, 138 - TP_PROTO(const struct device *dev, u32 offs, u32 val), 139 - TP_ARGS(dev, offs, val), 140 - TP_STRUCT__entry( 141 - DEV_ENTRY 142 - __field(u32, offs) 143 - __field(u32, val) 144 - ), 145 - TP_fast_assign( 146 - DEV_ASSIGN; 147 - __entry->offs = offs; 148 - __entry->val = val; 149 - ), 150 - TP_printk("[%s] write PRPH[%#x] = %#x)", 151 - __get_str(dev), __entry->offs, __entry->val) 152 - ); 153 - 154 - TRACE_EVENT(iwlwifi_dev_ioread_prph32, 155 - TP_PROTO(const struct device *dev, u32 offs, u32 val), 156 - TP_ARGS(dev, offs, val), 157 - TP_STRUCT__entry( 158 - DEV_ENTRY 159 - __field(u32, offs) 160 - __field(u32, val) 161 - ), 162 - TP_fast_assign( 163 - DEV_ASSIGN; 164 - __entry->offs = offs; 165 - __entry->val = val; 166 - ), 167 - TP_printk("[%s] read PRPH[%#x] = %#x", 168 - __get_str(dev), __entry->offs, __entry->val) 169 - ); 170 - 171 - TRACE_EVENT(iwlwifi_dev_irq, 172 - TP_PROTO(const struct device *dev), 173 - TP_ARGS(dev), 174 - TP_STRUCT__entry( 175 - DEV_ENTRY 176 - ), 177 - TP_fast_assign( 178 - DEV_ASSIGN; 179 - ), 180 - /* TP_printk("") doesn't compile */ 181 - TP_printk("%d", 0) 182 - ); 183 - 184 - TRACE_EVENT(iwlwifi_dev_ict_read, 185 - TP_PROTO(const struct device *dev, u32 index, u32 value), 186 - TP_ARGS(dev, index, value), 187 - TP_STRUCT__entry( 188 - DEV_ENTRY 189 - __field(u32, index) 190 - __field(u32, value) 191 - ), 192 - TP_fast_assign( 193 - DEV_ASSIGN; 194 - __entry->index = index; 195 - __entry->value = value; 196 - ), 197 - TP_printk("[%s] read ict[%d] = %#.8x", 198 - __get_str(dev), __entry->index, __entry->value) 199 - ); 200 - 201 - #undef TRACE_SYSTEM 202 - #define TRACE_SYSTEM iwlwifi_ucode 203 - 204 - TRACE_EVENT(iwlwifi_dev_ucode_cont_event, 205 - TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), 206 - TP_ARGS(dev, time, data, ev), 207 - TP_STRUCT__entry( 208 - DEV_ENTRY 209 - 210 - __field(u32, time) 211 - __field(u32, data) 212 - __field(u32, ev) 213 - ), 214 - TP_fast_assign( 215 - DEV_ASSIGN; 216 - __entry->time = time; 217 - __entry->data = data; 218 - __entry->ev = ev; 219 - ), 220 - TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", 221 - __get_str(dev), __entry->time, __entry->data, __entry->ev) 222 - ); 223 - 224 - TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, 225 - TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry), 226 - TP_ARGS(dev, wraps, n_entry, p_entry), 227 - TP_STRUCT__entry( 228 - DEV_ENTRY 229 - 230 - __field(u32, wraps) 231 - __field(u32, n_entry) 232 - __field(u32, p_entry) 233 - ), 234 - TP_fast_assign( 235 - DEV_ASSIGN; 236 - __entry->wraps = wraps; 237 - __entry->n_entry = n_entry; 238 - __entry->p_entry = p_entry; 239 - ), 240 - TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X", 241 - __get_str(dev), __entry->wraps, __entry->n_entry, 242 - __entry->p_entry) 243 - ); 244 - 245 - #undef TRACE_SYSTEM 246 - #define TRACE_SYSTEM iwlwifi_msg 247 - 248 - #define MAX_MSG_LEN 110 249 - 250 - DECLARE_EVENT_CLASS(iwlwifi_msg_event, 251 - TP_PROTO(struct va_format *vaf), 252 - TP_ARGS(vaf), 253 - TP_STRUCT__entry( 254 - __dynamic_array(char, msg, MAX_MSG_LEN) 255 - ), 256 - TP_fast_assign( 257 - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 258 - MAX_MSG_LEN, vaf->fmt, 259 - *vaf->va) >= MAX_MSG_LEN); 260 - ), 261 - TP_printk("%s", __get_str(msg)) 262 - ); 263 - 264 - DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err, 265 - TP_PROTO(struct va_format *vaf), 266 - TP_ARGS(vaf) 267 - ); 268 - 269 - DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn, 270 - TP_PROTO(struct va_format *vaf), 271 - TP_ARGS(vaf) 272 - ); 273 - 274 - DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info, 275 - TP_PROTO(struct va_format *vaf), 276 - TP_ARGS(vaf) 277 - ); 278 - 279 - DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit, 280 - TP_PROTO(struct va_format *vaf), 281 - TP_ARGS(vaf) 282 - ); 283 - 284 - TRACE_EVENT(iwlwifi_dbg, 285 - TP_PROTO(u32 level, bool in_interrupt, const char *function, 286 - struct va_format *vaf), 287 - TP_ARGS(level, in_interrupt, function, vaf), 288 - TP_STRUCT__entry( 289 - __field(u32, level) 290 - __field(u8, in_interrupt) 291 - __string(function, function) 292 - __dynamic_array(char, msg, MAX_MSG_LEN) 293 - ), 294 - TP_fast_assign( 295 - __entry->level = level; 296 - __entry->in_interrupt = in_interrupt; 297 - __assign_str(function, function); 298 - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 299 - MAX_MSG_LEN, vaf->fmt, 300 - *vaf->va) >= MAX_MSG_LEN); 301 - ), 302 - TP_printk("%s", __get_str(msg)) 303 - ); 304 - 305 - #undef TRACE_SYSTEM 306 - #define TRACE_SYSTEM iwlwifi_data 307 - 308 - TRACE_EVENT(iwlwifi_dev_tx_data, 309 - TP_PROTO(const struct device *dev, 310 - struct sk_buff *skb, 311 - void *data, size_t data_len), 312 - TP_ARGS(dev, skb, data, data_len), 313 - TP_STRUCT__entry( 314 - DEV_ENTRY 315 - 316 - __dynamic_array(u8, data, iwl_trace_data(skb) ? data_len : 0) 317 - ), 318 - TP_fast_assign( 319 - DEV_ASSIGN; 320 - if (iwl_trace_data(skb)) 321 - memcpy(__get_dynamic_array(data), data, data_len); 322 - ), 323 - TP_printk("[%s] TX frame data", __get_str(dev)) 324 - ); 325 - 326 - TRACE_EVENT(iwlwifi_dev_rx_data, 327 - TP_PROTO(const struct device *dev, 328 - const struct iwl_trans *trans, 329 - void *rxbuf, size_t len), 330 - TP_ARGS(dev, trans, rxbuf, len), 331 - TP_STRUCT__entry( 332 - DEV_ENTRY 333 - 334 - __dynamic_array(u8, data, 335 - len - iwl_rx_trace_len(trans, rxbuf, len)) 336 - ), 337 - TP_fast_assign( 338 - size_t offs = iwl_rx_trace_len(trans, rxbuf, len); 339 - DEV_ASSIGN; 340 - if (offs < len) 341 - memcpy(__get_dynamic_array(data), 342 - ((u8 *)rxbuf) + offs, len - offs); 343 - ), 344 - TP_printk("[%s] RX frame data", __get_str(dev)) 345 - ); 346 - 347 - #undef TRACE_SYSTEM 348 - #define TRACE_SYSTEM iwlwifi 349 - 350 - TRACE_EVENT(iwlwifi_dev_hcmd, 351 - TP_PROTO(const struct device *dev, 352 - struct iwl_host_cmd *cmd, u16 total_size, 353 - struct iwl_cmd_header *hdr), 354 - TP_ARGS(dev, cmd, total_size, hdr), 355 - TP_STRUCT__entry( 356 - DEV_ENTRY 357 - __dynamic_array(u8, hcmd, total_size) 358 - __field(u32, flags) 359 - ), 360 - TP_fast_assign( 361 - int i, offset = sizeof(*hdr); 362 - 363 - DEV_ASSIGN; 364 - __entry->flags = cmd->flags; 365 - memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); 366 - 367 - for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 368 - if (!cmd->len[i]) 369 - continue; 370 - memcpy((u8 *)__get_dynamic_array(hcmd) + offset, 371 - cmd->data[i], cmd->len[i]); 372 - offset += cmd->len[i]; 373 - } 374 - ), 375 - TP_printk("[%s] hcmd %#.2x (%ssync)", 376 - __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0], 377 - __entry->flags & CMD_ASYNC ? "a" : "") 378 - ); 379 - 380 - TRACE_EVENT(iwlwifi_dev_rx, 381 - TP_PROTO(const struct device *dev, const struct iwl_trans *trans, 382 - void *rxbuf, size_t len), 383 - TP_ARGS(dev, trans, rxbuf, len), 384 - TP_STRUCT__entry( 385 - DEV_ENTRY 386 - __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, rxbuf, len)) 387 - ), 388 - TP_fast_assign( 389 - DEV_ASSIGN; 390 - memcpy(__get_dynamic_array(rxbuf), rxbuf, 391 - iwl_rx_trace_len(trans, rxbuf, len)); 392 - ), 393 - TP_printk("[%s] RX cmd %#.2x", 394 - __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4]) 395 - ); 396 - 397 - TRACE_EVENT(iwlwifi_dev_tx, 398 - TP_PROTO(const struct device *dev, struct sk_buff *skb, 399 - void *tfd, size_t tfdlen, 400 - void *buf0, size_t buf0_len, 401 - void *buf1, size_t buf1_len), 402 - TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), 403 - TP_STRUCT__entry( 404 - DEV_ENTRY 405 - 406 - __field(size_t, framelen) 407 - __dynamic_array(u8, tfd, tfdlen) 408 - 409 - /* 410 - * Do not insert between or below these items, 411 - * we want to keep the frame together (except 412 - * for the possible padding). 413 - */ 414 - __dynamic_array(u8, buf0, buf0_len) 415 - __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len) 416 - ), 417 - TP_fast_assign( 418 - DEV_ASSIGN; 419 - __entry->framelen = buf0_len + buf1_len; 420 - memcpy(__get_dynamic_array(tfd), tfd, tfdlen); 421 - memcpy(__get_dynamic_array(buf0), buf0, buf0_len); 422 - if (!iwl_trace_data(skb)) 423 - memcpy(__get_dynamic_array(buf1), buf1, buf1_len); 424 - ), 425 - TP_printk("[%s] TX %.2x (%zu bytes)", 426 - __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], 427 - __entry->framelen) 428 - ); 429 - 430 - TRACE_EVENT(iwlwifi_dev_ucode_error, 431 - TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, 432 - u32 data1, u32 data2, u32 line, u32 blink1, 433 - u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, 434 - u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, 435 - u32 brd_ver), 436 - TP_ARGS(dev, desc, tsf_low, data1, data2, line, 437 - blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, 438 - gp3, ucode_ver, hw_ver, brd_ver), 439 - TP_STRUCT__entry( 440 - DEV_ENTRY 441 - __field(u32, desc) 442 - __field(u32, tsf_low) 443 - __field(u32, data1) 444 - __field(u32, data2) 445 - __field(u32, line) 446 - __field(u32, blink1) 447 - __field(u32, blink2) 448 - __field(u32, ilink1) 449 - __field(u32, ilink2) 450 - __field(u32, bcon_time) 451 - __field(u32, gp1) 452 - __field(u32, gp2) 453 - __field(u32, gp3) 454 - __field(u32, ucode_ver) 455 - __field(u32, hw_ver) 456 - __field(u32, brd_ver) 457 - ), 458 - TP_fast_assign( 459 - DEV_ASSIGN; 460 - __entry->desc = desc; 461 - __entry->tsf_low = tsf_low; 462 - __entry->data1 = data1; 463 - __entry->data2 = data2; 464 - __entry->line = line; 465 - __entry->blink1 = blink1; 466 - __entry->blink2 = blink2; 467 - __entry->ilink1 = ilink1; 468 - __entry->ilink2 = ilink2; 469 - __entry->bcon_time = bcon_time; 470 - __entry->gp1 = gp1; 471 - __entry->gp2 = gp2; 472 - __entry->gp3 = gp3; 473 - __entry->ucode_ver = ucode_ver; 474 - __entry->hw_ver = hw_ver; 475 - __entry->brd_ver = brd_ver; 476 - ), 477 - TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " 478 - "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " 479 - "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " 480 - "hw 0x%08X brd 0x%08X", 481 - __get_str(dev), __entry->desc, __entry->tsf_low, 482 - __entry->data1, 483 - __entry->data2, __entry->line, __entry->blink1, 484 - __entry->blink2, __entry->ilink1, __entry->ilink2, 485 - __entry->bcon_time, __entry->gp1, __entry->gp2, 486 - __entry->gp3, __entry->ucode_ver, __entry->hw_ver, 487 - __entry->brd_ver) 488 - ); 489 - 490 - TRACE_EVENT(iwlwifi_dev_ucode_event, 491 - TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), 492 - TP_ARGS(dev, time, data, ev), 493 - TP_STRUCT__entry( 494 - DEV_ENTRY 495 - 496 - __field(u32, time) 497 - __field(u32, data) 498 - __field(u32, ev) 499 - ), 500 - TP_fast_assign( 501 - DEV_ASSIGN; 502 - __entry->time = time; 503 - __entry->data = data; 504 - __entry->ev = ev; 505 - ), 506 - TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", 507 - __get_str(dev), __entry->time, __entry->data, __entry->ev) 508 - ); 509 89 #endif /* __IWLWIFI_DEVICE_TRACE */ 510 - 511 - #undef TRACE_INCLUDE_PATH 512 - #define TRACE_INCLUDE_PATH . 513 - #undef TRACE_INCLUDE_FILE 514 - #define TRACE_INCLUDE_FILE iwl-devtrace 515 - #include <trace/define_trace.h>
+7
drivers/usb/host/xhci-trace.h
··· 14 14 #undef TRACE_SYSTEM 15 15 #define TRACE_SYSTEM xhci-hcd 16 16 17 + /* 18 + * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a 19 + * legitimate C variable. It is not exported to user space. 20 + */ 21 + #undef TRACE_SYSTEM_VAR 22 + #define TRACE_SYSTEM_VAR xhci_hcd 23 + 17 24 #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 18 25 #define __XHCI_TRACE_H 19 26
+4 -1
include/asm-generic/vmlinux.lds.h
··· 124 124 #define FTRACE_EVENTS() . = ALIGN(8); \ 125 125 VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 126 126 *(_ftrace_events) \ 127 - VMLINUX_SYMBOL(__stop_ftrace_events) = .; 127 + VMLINUX_SYMBOL(__stop_ftrace_events) = .; \ 128 + VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \ 129 + *(_ftrace_enum_map) \ 130 + VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .; 128 131 #else 129 132 #define FTRACE_EVENTS() 130 133 #endif
+2 -2
include/linux/ftrace_event.h
··· 202 202 struct ftrace_event_call; 203 203 204 204 struct ftrace_event_class { 205 - char *system; 205 + const char *system; 206 206 void *probe; 207 207 #ifdef CONFIG_PERF_EVENTS 208 208 void *perf_probe; ··· 285 285 struct tracepoint *tp; 286 286 }; 287 287 struct trace_event event; 288 - const char *print_fmt; 288 + char *print_fmt; 289 289 struct event_filter *filter; 290 290 void *mod; 291 291 void *data;
+2
include/linux/module.h
··· 338 338 #ifdef CONFIG_EVENT_TRACING 339 339 struct ftrace_event_call **trace_events; 340 340 unsigned int num_trace_events; 341 + struct trace_enum_map **trace_enums; 342 + unsigned int num_trace_enums; 341 343 #endif 342 344 #ifdef CONFIG_FTRACE_MCOUNT_RECORD 343 345 unsigned int num_ftrace_callsites;
+8
include/linux/tracepoint.h
··· 36 36 struct tracepoint_func __rcu *funcs; 37 37 }; 38 38 39 + struct trace_enum_map { 40 + const char *system; 41 + const char *enum_string; 42 + unsigned long enum_value; 43 + }; 44 + 39 45 extern int 40 46 tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); 41 47 extern int ··· 92 86 #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ 93 87 94 88 #define PARAMS(args...) args 89 + 90 + #define TRACE_DEFINE_ENUM(x) 95 91 96 92 #endif /* _LINUX_TRACEPOINT_H */ 97 93
+88 -69
include/trace/events/9p.h
··· 6 6 7 7 #include <linux/tracepoint.h> 8 8 9 + #define P9_MSG_T \ 10 + EM( P9_TLERROR, "P9_TLERROR" ) \ 11 + EM( P9_RLERROR, "P9_RLERROR" ) \ 12 + EM( P9_TSTATFS, "P9_TSTATFS" ) \ 13 + EM( P9_RSTATFS, "P9_RSTATFS" ) \ 14 + EM( P9_TLOPEN, "P9_TLOPEN" ) \ 15 + EM( P9_RLOPEN, "P9_RLOPEN" ) \ 16 + EM( P9_TLCREATE, "P9_TLCREATE" ) \ 17 + EM( P9_RLCREATE, "P9_RLCREATE" ) \ 18 + EM( P9_TSYMLINK, "P9_TSYMLINK" ) \ 19 + EM( P9_RSYMLINK, "P9_RSYMLINK" ) \ 20 + EM( P9_TMKNOD, "P9_TMKNOD" ) \ 21 + EM( P9_RMKNOD, "P9_RMKNOD" ) \ 22 + EM( P9_TRENAME, "P9_TRENAME" ) \ 23 + EM( P9_RRENAME, "P9_RRENAME" ) \ 24 + EM( P9_TREADLINK, "P9_TREADLINK" ) \ 25 + EM( P9_RREADLINK, "P9_RREADLINK" ) \ 26 + EM( P9_TGETATTR, "P9_TGETATTR" ) \ 27 + EM( P9_RGETATTR, "P9_RGETATTR" ) \ 28 + EM( P9_TSETATTR, "P9_TSETATTR" ) \ 29 + EM( P9_RSETATTR, "P9_RSETATTR" ) \ 30 + EM( P9_TXATTRWALK, "P9_TXATTRWALK" ) \ 31 + EM( P9_RXATTRWALK, "P9_RXATTRWALK" ) \ 32 + EM( P9_TXATTRCREATE, "P9_TXATTRCREATE" ) \ 33 + EM( P9_RXATTRCREATE, "P9_RXATTRCREATE" ) \ 34 + EM( P9_TREADDIR, "P9_TREADDIR" ) \ 35 + EM( P9_RREADDIR, "P9_RREADDIR" ) \ 36 + EM( P9_TFSYNC, "P9_TFSYNC" ) \ 37 + EM( P9_RFSYNC, "P9_RFSYNC" ) \ 38 + EM( P9_TLOCK, "P9_TLOCK" ) \ 39 + EM( P9_RLOCK, "P9_RLOCK" ) \ 40 + EM( P9_TGETLOCK, "P9_TGETLOCK" ) \ 41 + EM( P9_RGETLOCK, "P9_RGETLOCK" ) \ 42 + EM( P9_TLINK, "P9_TLINK" ) \ 43 + EM( P9_RLINK, "P9_RLINK" ) \ 44 + EM( P9_TMKDIR, "P9_TMKDIR" ) \ 45 + EM( P9_RMKDIR, "P9_RMKDIR" ) \ 46 + EM( P9_TRENAMEAT, "P9_TRENAMEAT" ) \ 47 + EM( P9_RRENAMEAT, "P9_RRENAMEAT" ) \ 48 + EM( P9_TUNLINKAT, "P9_TUNLINKAT" ) \ 49 + EM( P9_RUNLINKAT, "P9_RUNLINKAT" ) \ 50 + EM( P9_TVERSION, "P9_TVERSION" ) \ 51 + EM( P9_RVERSION, "P9_RVERSION" ) \ 52 + EM( P9_TAUTH, "P9_TAUTH" ) \ 53 + EM( P9_RAUTH, "P9_RAUTH" ) \ 54 + EM( P9_TATTACH, "P9_TATTACH" ) \ 55 + EM( P9_RATTACH, "P9_RATTACH" ) \ 56 + EM( P9_TERROR, "P9_TERROR" ) \ 57 + EM( P9_RERROR, "P9_RERROR" ) \ 58 + EM( P9_TFLUSH, "P9_TFLUSH" ) \ 59 + EM( P9_RFLUSH, "P9_RFLUSH" ) \ 60 + EM( P9_TWALK, "P9_TWALK" ) \ 61 + EM( P9_RWALK, "P9_RWALK" ) \ 62 + EM( P9_TOPEN, "P9_TOPEN" ) \ 63 + EM( P9_ROPEN, "P9_ROPEN" ) \ 64 + EM( P9_TCREATE, "P9_TCREATE" ) \ 65 + EM( P9_RCREATE, "P9_RCREATE" ) \ 66 + EM( P9_TREAD, "P9_TREAD" ) \ 67 + EM( P9_RREAD, "P9_RREAD" ) \ 68 + EM( P9_TWRITE, "P9_TWRITE" ) \ 69 + EM( P9_RWRITE, "P9_RWRITE" ) \ 70 + EM( P9_TCLUNK, "P9_TCLUNK" ) \ 71 + EM( P9_RCLUNK, "P9_RCLUNK" ) \ 72 + EM( P9_TREMOVE, "P9_TREMOVE" ) \ 73 + EM( P9_RREMOVE, "P9_RREMOVE" ) \ 74 + EM( P9_TSTAT, "P9_TSTAT" ) \ 75 + EM( P9_RSTAT, "P9_RSTAT" ) \ 76 + EM( P9_TWSTAT, "P9_TWSTAT" ) \ 77 + EMe(P9_RWSTAT, "P9_RWSTAT" ) 78 + 79 + /* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */ 80 + #undef EM 81 + #undef EMe 82 + #define EM(a, b) TRACE_DEFINE_ENUM(a); 83 + #define EMe(a, b) TRACE_DEFINE_ENUM(a); 84 + 85 + P9_MSG_T 86 + 87 + /* 88 + * Now redefine the EM() and EMe() macros to map the enums to the strings 89 + * that will be printed in the output. 90 + */ 91 + #undef EM 92 + #undef EMe 93 + #define EM(a, b) { a, b }, 94 + #define EMe(a, b) { a, b } 95 + 9 96 #define show_9p_op(type) \ 10 - __print_symbolic(type, \ 11 - { P9_TLERROR, "P9_TLERROR" }, \ 12 - { P9_RLERROR, "P9_RLERROR" }, \ 13 - { P9_TSTATFS, "P9_TSTATFS" }, \ 14 - { P9_RSTATFS, "P9_RSTATFS" }, \ 15 - { P9_TLOPEN, "P9_TLOPEN" }, \ 16 - { P9_RLOPEN, "P9_RLOPEN" }, \ 17 - { P9_TLCREATE, "P9_TLCREATE" }, \ 18 - { P9_RLCREATE, "P9_RLCREATE" }, \ 19 - { P9_TSYMLINK, "P9_TSYMLINK" }, \ 20 - { P9_RSYMLINK, "P9_RSYMLINK" }, \ 21 - { P9_TMKNOD, "P9_TMKNOD" }, \ 22 - { P9_RMKNOD, "P9_RMKNOD" }, \ 23 - { P9_TRENAME, "P9_TRENAME" }, \ 24 - { P9_RRENAME, "P9_RRENAME" }, \ 25 - { P9_TREADLINK, "P9_TREADLINK" }, \ 26 - { P9_RREADLINK, "P9_RREADLINK" }, \ 27 - { P9_TGETATTR, "P9_TGETATTR" }, \ 28 - { P9_RGETATTR, "P9_RGETATTR" }, \ 29 - { P9_TSETATTR, "P9_TSETATTR" }, \ 30 - { P9_RSETATTR, "P9_RSETATTR" }, \ 31 - { P9_TXATTRWALK, "P9_TXATTRWALK" }, \ 32 - { P9_RXATTRWALK, "P9_RXATTRWALK" }, \ 33 - { P9_TXATTRCREATE, "P9_TXATTRCREATE" }, \ 34 - { P9_RXATTRCREATE, "P9_RXATTRCREATE" }, \ 35 - { P9_TREADDIR, "P9_TREADDIR" }, \ 36 - { P9_RREADDIR, "P9_RREADDIR" }, \ 37 - { P9_TFSYNC, "P9_TFSYNC" }, \ 38 - { P9_RFSYNC, "P9_RFSYNC" }, \ 39 - { P9_TLOCK, "P9_TLOCK" }, \ 40 - { P9_RLOCK, "P9_RLOCK" }, \ 41 - { P9_TGETLOCK, "P9_TGETLOCK" }, \ 42 - { P9_RGETLOCK, "P9_RGETLOCK" }, \ 43 - { P9_TLINK, "P9_TLINK" }, \ 44 - { P9_RLINK, "P9_RLINK" }, \ 45 - { P9_TMKDIR, "P9_TMKDIR" }, \ 46 - { P9_RMKDIR, "P9_RMKDIR" }, \ 47 - { P9_TRENAMEAT, "P9_TRENAMEAT" }, \ 48 - { P9_RRENAMEAT, "P9_RRENAMEAT" }, \ 49 - { P9_TUNLINKAT, "P9_TUNLINKAT" }, \ 50 - { P9_RUNLINKAT, "P9_RUNLINKAT" }, \ 51 - { P9_TVERSION, "P9_TVERSION" }, \ 52 - { P9_RVERSION, "P9_RVERSION" }, \ 53 - { P9_TAUTH, "P9_TAUTH" }, \ 54 - { P9_RAUTH, "P9_RAUTH" }, \ 55 - { P9_TATTACH, "P9_TATTACH" }, \ 56 - { P9_RATTACH, "P9_RATTACH" }, \ 57 - { P9_TERROR, "P9_TERROR" }, \ 58 - { P9_RERROR, "P9_RERROR" }, \ 59 - { P9_TFLUSH, "P9_TFLUSH" }, \ 60 - { P9_RFLUSH, "P9_RFLUSH" }, \ 61 - { P9_TWALK, "P9_TWALK" }, \ 62 - { P9_RWALK, "P9_RWALK" }, \ 63 - { P9_TOPEN, "P9_TOPEN" }, \ 64 - { P9_ROPEN, "P9_ROPEN" }, \ 65 - { P9_TCREATE, "P9_TCREATE" }, \ 66 - { P9_RCREATE, "P9_RCREATE" }, \ 67 - { P9_TREAD, "P9_TREAD" }, \ 68 - { P9_RREAD, "P9_RREAD" }, \ 69 - { P9_TWRITE, "P9_TWRITE" }, \ 70 - { P9_RWRITE, "P9_RWRITE" }, \ 71 - { P9_TCLUNK, "P9_TCLUNK" }, \ 72 - { P9_RCLUNK, "P9_RCLUNK" }, \ 73 - { P9_TREMOVE, "P9_TREMOVE" }, \ 74 - { P9_RREMOVE, "P9_RREMOVE" }, \ 75 - { P9_TSTAT, "P9_TSTAT" }, \ 76 - { P9_RSTAT, "P9_RSTAT" }, \ 77 - { P9_TWSTAT, "P9_TWSTAT" }, \ 78 - { P9_RWSTAT, "P9_RWSTAT" }) 97 + __print_symbolic(type, P9_MSG_T) 79 98 80 99 TRACE_EVENT(9p_client_req, 81 100 TP_PROTO(struct p9_client *clnt, int8_t type, int tag),
+2 -2
include/trace/events/btrfs.h
··· 962 962 __entry->ip = IP 963 963 ), 964 964 965 - TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, 965 + TP_printk("state=%p; mask = %s; caller = %pS", __entry->state, 966 966 show_gfp_flags(__entry->mask), (void *)__entry->ip) 967 967 ); 968 968 ··· 982 982 __entry->ip = IP 983 983 ), 984 984 985 - TP_printk(" state=%p; caller = %pF", __entry->state, 985 + TP_printk(" state=%p; caller = %pS", __entry->state, 986 986 (void *)__entry->ip) 987 987 ); 988 988
+1 -1
include/trace/events/ext3.h
··· 144 144 __entry->ip = IP; 145 145 ), 146 146 147 - TP_printk("dev %d,%d ino %lu caller %pF", 147 + TP_printk("dev %d,%d ino %lu caller %pS", 148 148 MAJOR(__entry->dev), MINOR(__entry->dev), 149 149 (unsigned long) __entry->ino, (void *)__entry->ip) 150 150 );
+3 -3
include/trace/events/ext4.h
··· 240 240 __entry->ip = IP; 241 241 ), 242 242 243 - TP_printk("dev %d,%d ino %lu caller %pF", 243 + TP_printk("dev %d,%d ino %lu caller %pS", 244 244 MAJOR(__entry->dev), MINOR(__entry->dev), 245 245 (unsigned long) __entry->ino, (void *)__entry->ip) 246 246 ); ··· 1762 1762 __entry->rsv_blocks = rsv_blocks; 1763 1763 ), 1764 1764 1765 - TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF", 1765 + TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pS", 1766 1766 MAJOR(__entry->dev), MINOR(__entry->dev), 1767 1767 __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip) 1768 1768 ); ··· 1784 1784 __entry->blocks = blocks; 1785 1785 ), 1786 1786 1787 - TP_printk("dev %d,%d blocks, %d caller %pF", 1787 + TP_printk("dev %d,%d blocks, %d caller %pS", 1788 1788 MAJOR(__entry->dev), MINOR(__entry->dev), 1789 1789 __entry->blocks, (void *)__entry->ip) 1790 1790 );
+30
include/trace/events/f2fs.h
··· 9 9 #define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev) 10 10 #define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino 11 11 12 + TRACE_DEFINE_ENUM(NODE); 13 + TRACE_DEFINE_ENUM(DATA); 14 + TRACE_DEFINE_ENUM(META); 15 + TRACE_DEFINE_ENUM(META_FLUSH); 16 + TRACE_DEFINE_ENUM(CURSEG_HOT_DATA); 17 + TRACE_DEFINE_ENUM(CURSEG_WARM_DATA); 18 + TRACE_DEFINE_ENUM(CURSEG_COLD_DATA); 19 + TRACE_DEFINE_ENUM(CURSEG_HOT_NODE); 20 + TRACE_DEFINE_ENUM(CURSEG_WARM_NODE); 21 + TRACE_DEFINE_ENUM(CURSEG_COLD_NODE); 22 + TRACE_DEFINE_ENUM(NO_CHECK_TYPE); 23 + TRACE_DEFINE_ENUM(GC_GREEDY); 24 + TRACE_DEFINE_ENUM(GC_CB); 25 + TRACE_DEFINE_ENUM(FG_GC); 26 + TRACE_DEFINE_ENUM(BG_GC); 27 + TRACE_DEFINE_ENUM(LFS); 28 + TRACE_DEFINE_ENUM(SSR); 29 + TRACE_DEFINE_ENUM(__REQ_RAHEAD); 30 + TRACE_DEFINE_ENUM(__REQ_WRITE); 31 + TRACE_DEFINE_ENUM(__REQ_SYNC); 32 + TRACE_DEFINE_ENUM(__REQ_NOIDLE); 33 + TRACE_DEFINE_ENUM(__REQ_FLUSH); 34 + TRACE_DEFINE_ENUM(__REQ_FUA); 35 + TRACE_DEFINE_ENUM(__REQ_PRIO); 36 + TRACE_DEFINE_ENUM(__REQ_META); 37 + TRACE_DEFINE_ENUM(CP_UMOUNT); 38 + TRACE_DEFINE_ENUM(CP_FASTBOOT); 39 + TRACE_DEFINE_ENUM(CP_SYNC); 40 + TRACE_DEFINE_ENUM(CP_DISCARD); 41 + 12 42 #define show_block_type(type) \ 13 43 __print_symbolic(type, \ 14 44 { NODE, "NODE" }, \
+7
include/trace/events/intel-sst.h
··· 1 1 #undef TRACE_SYSTEM 2 2 #define TRACE_SYSTEM intel-sst 3 3 4 + /* 5 + * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a 6 + * legitimate C variable. It is not exported to user space. 7 + */ 8 + #undef TRACE_SYSTEM_VAR 9 + #define TRACE_SYSTEM_VAR intel_sst 10 + 4 11 #if !defined(_TRACE_INTEL_SST_H) || defined(TRACE_HEADER_MULTI_READ) 5 12 #define _TRACE_INTEL_SST_H 6 13
+27 -12
include/trace/events/irq.h
··· 9 9 struct irqaction; 10 10 struct softirq_action; 11 11 12 - #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } 12 + #define SOFTIRQ_NAME_LIST \ 13 + softirq_name(HI) \ 14 + softirq_name(TIMER) \ 15 + softirq_name(NET_TX) \ 16 + softirq_name(NET_RX) \ 17 + softirq_name(BLOCK) \ 18 + softirq_name(BLOCK_IOPOLL) \ 19 + softirq_name(TASKLET) \ 20 + softirq_name(SCHED) \ 21 + softirq_name(HRTIMER) \ 22 + softirq_name_end(RCU) 23 + 24 + #undef softirq_name 25 + #undef softirq_name_end 26 + 27 + #define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ); 28 + #define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ); 29 + 30 + SOFTIRQ_NAME_LIST 31 + 32 + #undef softirq_name 33 + #undef softirq_name_end 34 + 35 + #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }, 36 + #define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq } 37 + 13 38 #define show_softirq_name(val) \ 14 - __print_symbolic(val, \ 15 - softirq_name(HI), \ 16 - softirq_name(TIMER), \ 17 - softirq_name(NET_TX), \ 18 - softirq_name(NET_RX), \ 19 - softirq_name(BLOCK), \ 20 - softirq_name(BLOCK_IOPOLL), \ 21 - softirq_name(TASKLET), \ 22 - softirq_name(SCHED), \ 23 - softirq_name(HRTIMER), \ 24 - softirq_name(RCU)) 39 + __print_symbolic(val, SOFTIRQ_NAME_LIST) 25 40 26 41 /** 27 42 * irq_handler_entry - called immediately before the irq action handler
+32 -10
include/trace/events/migrate.h
··· 7 7 #include <linux/tracepoint.h> 8 8 9 9 #define MIGRATE_MODE \ 10 - {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \ 11 - {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \ 12 - {MIGRATE_SYNC, "MIGRATE_SYNC"} 10 + EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \ 11 + EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \ 12 + EMe(MIGRATE_SYNC, "MIGRATE_SYNC") 13 + 13 14 14 15 #define MIGRATE_REASON \ 15 - {MR_COMPACTION, "compaction"}, \ 16 - {MR_MEMORY_FAILURE, "memory_failure"}, \ 17 - {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \ 18 - {MR_SYSCALL, "syscall_or_cpuset"}, \ 19 - {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \ 20 - {MR_NUMA_MISPLACED, "numa_misplaced"}, \ 21 - {MR_CMA, "cma"} 16 + EM( MR_COMPACTION, "compaction") \ 17 + EM( MR_MEMORY_FAILURE, "memory_failure") \ 18 + EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \ 19 + EM( MR_SYSCALL, "syscall_or_cpuset") \ 20 + EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \ 21 + EM( MR_NUMA_MISPLACED, "numa_misplaced") \ 22 + EMe(MR_CMA, "cma") 23 + 24 + /* 25 + * First define the enums in the above macros to be exported to userspace 26 + * via TRACE_DEFINE_ENUM(). 27 + */ 28 + #undef EM 29 + #undef EMe 30 + #define EM(a, b) TRACE_DEFINE_ENUM(a); 31 + #define EMe(a, b) TRACE_DEFINE_ENUM(a); 32 + 33 + MIGRATE_MODE 34 + MIGRATE_REASON 35 + 36 + /* 37 + * Now redefine the EM() and EMe() macros to map the enums to the strings 38 + * that will be printed in the output. 39 + */ 40 + #undef EM 41 + #undef EMe 42 + #define EM(a, b) {a, b}, 43 + #define EMe(a, b) {a, b} 22 44 23 45 TRACE_EVENT(mm_migrate_pages, 24 46
+2 -2
include/trace/events/module.h
··· 84 84 __assign_str(name, mod->name); 85 85 ), 86 86 87 - TP_printk("%s call_site=%pf refcnt=%d", 87 + TP_printk("%s call_site=%ps refcnt=%d", 88 88 __get_str(name), (void *)__entry->ip, __entry->refcnt) 89 89 ); 90 90 ··· 121 121 __assign_str(name, name); 122 122 ), 123 123 124 - TP_printk("%s wait=%d call_site=%pf", 124 + TP_printk("%s wait=%d call_site=%ps", 125 125 __get_str(name), (int)__entry->wait, (void *)__entry->ip) 126 126 ); 127 127
+5 -5
include/trace/events/random.h
··· 22 22 __entry->IP = IP; 23 23 ), 24 24 25 - TP_printk("bytes %d caller %pF", 25 + TP_printk("bytes %d caller %pS", 26 26 __entry->bytes, (void *)__entry->IP) 27 27 ); 28 28 ··· 43 43 __entry->IP = IP; 44 44 ), 45 45 46 - TP_printk("%s pool: bytes %d caller %pF", 46 + TP_printk("%s pool: bytes %d caller %pS", 47 47 __entry->pool_name, __entry->bytes, (void *)__entry->IP) 48 48 ); 49 49 ··· 82 82 ), 83 83 84 84 TP_printk("%s pool: bits %d entropy_count %d entropy_total %d " 85 - "caller %pF", __entry->pool_name, __entry->bits, 85 + "caller %pS", __entry->pool_name, __entry->bits, 86 86 __entry->entropy_count, __entry->entropy_total, 87 87 (void *)__entry->IP) 88 88 ); ··· 207 207 __entry->IP = IP; 208 208 ), 209 209 210 - TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP) 210 + TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP) 211 211 ); 212 212 213 213 DEFINE_EVENT(random__get_random_bytes, get_random_bytes, ··· 242 242 __entry->IP = IP; 243 243 ), 244 244 245 - TP_printk("%s pool: nbytes %d entropy_count %d caller %pF", 245 + TP_printk("%s pool: nbytes %d entropy_count %d caller %pS", 246 246 __entry->pool_name, __entry->nbytes, __entry->entropy_count, 247 247 (void *)__entry->IP) 248 248 );
+44 -18
include/trace/events/sunrpc.h
··· 179 179 180 180 ); 181 181 182 + /* 183 + * First define the enums in the below macros to be exported to userspace 184 + * via TRACE_DEFINE_ENUM(). 185 + */ 186 + #undef EM 187 + #undef EMe 188 + #define EM(a, b) TRACE_DEFINE_ENUM(a); 189 + #define EMe(a, b) TRACE_DEFINE_ENUM(a); 190 + 191 + #define RPC_SHOW_SOCKET \ 192 + EM( SS_FREE, "FREE" ) \ 193 + EM( SS_UNCONNECTED, "UNCONNECTED" ) \ 194 + EM( SS_CONNECTING, "CONNECTING," ) \ 195 + EM( SS_CONNECTED, "CONNECTED," ) \ 196 + EMe(SS_DISCONNECTING, "DISCONNECTING" ) 197 + 182 198 #define rpc_show_socket_state(state) \ 183 - __print_symbolic(state, \ 184 - { SS_FREE, "FREE" }, \ 185 - { SS_UNCONNECTED, "UNCONNECTED" }, \ 186 - { SS_CONNECTING, "CONNECTING," }, \ 187 - { SS_CONNECTED, "CONNECTED," }, \ 188 - { SS_DISCONNECTING, "DISCONNECTING" }) 199 + __print_symbolic(state, RPC_SHOW_SOCKET) 200 + 201 + RPC_SHOW_SOCKET 202 + 203 + #define RPC_SHOW_SOCK \ 204 + EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ 205 + EM( TCP_SYN_SENT, "SYN_SENT" ) \ 206 + EM( TCP_SYN_RECV, "SYN_RECV" ) \ 207 + EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ 208 + EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ 209 + EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ 210 + EM( TCP_CLOSE, "CLOSE" ) \ 211 + EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ 212 + EM( TCP_LAST_ACK, "LAST_ACK" ) \ 213 + EM( TCP_LISTEN, "LISTEN" ) \ 214 + EMe( TCP_CLOSING, "CLOSING" ) 189 215 190 216 #define rpc_show_sock_state(state) \ 191 - __print_symbolic(state, \ 192 - { TCP_ESTABLISHED, "ESTABLISHED" }, \ 193 - { TCP_SYN_SENT, "SYN_SENT" }, \ 194 - { TCP_SYN_RECV, "SYN_RECV" }, \ 195 - { TCP_FIN_WAIT1, "FIN_WAIT1" }, \ 196 - { TCP_FIN_WAIT2, "FIN_WAIT2" }, \ 197 - { TCP_TIME_WAIT, "TIME_WAIT" }, \ 198 - { TCP_CLOSE, "CLOSE" }, \ 199 - { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \ 200 - { TCP_LAST_ACK, "LAST_ACK" }, \ 201 - { TCP_LISTEN, "LISTEN" }, \ 202 - { TCP_CLOSING, "CLOSING" }) 217 + __print_symbolic(state, RPC_SHOW_SOCK) 218 + 219 + RPC_SHOW_SOCK 220 + 221 + /* 222 + * Now redefine the EM() and EMe() macros to map the enums to the strings 223 + * that will be printed in the output. 224 + */ 225 + #undef EM 226 + #undef EMe 227 + #define EM(a, b) {a, b}, 228 + #define EMe(a, b) {a, b} 203 229 204 230 DECLARE_EVENT_CLASS(xs_socket_event, 205 231
+25 -5
include/trace/events/tlb.h
··· 7 7 #include <linux/mm_types.h> 8 8 #include <linux/tracepoint.h> 9 9 10 - #define TLB_FLUSH_REASON \ 11 - { TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" }, \ 12 - { TLB_REMOTE_SHOOTDOWN, "remote shootdown" }, \ 13 - { TLB_LOCAL_SHOOTDOWN, "local shootdown" }, \ 14 - { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" } 10 + #define TLB_FLUSH_REASON \ 11 + EM( TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" ) \ 12 + EM( TLB_REMOTE_SHOOTDOWN, "remote shootdown" ) \ 13 + EM( TLB_LOCAL_SHOOTDOWN, "local shootdown" ) \ 14 + EMe( TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" ) 15 + 16 + /* 17 + * First define the enums in TLB_FLUSH_REASON to be exported to userspace 18 + * via TRACE_DEFINE_ENUM(). 19 + */ 20 + #undef EM 21 + #undef EMe 22 + #define EM(a,b) TRACE_DEFINE_ENUM(a); 23 + #define EMe(a,b) TRACE_DEFINE_ENUM(a); 24 + 25 + TLB_FLUSH_REASON 26 + 27 + /* 28 + * Now redefine the EM() and EMe() macros to map the enums to the strings 29 + * that will be printed in the output. 30 + */ 31 + #undef EM 32 + #undef EMe 33 + #define EM(a,b) { a, b }, 34 + #define EMe(a,b) { a, b } 15 35 16 36 TRACE_EVENT_CONDITION(tlb_flush, 17 37
+50 -25
include/trace/events/v4l2.h
··· 6 6 7 7 #include <linux/tracepoint.h> 8 8 9 - #define show_type(type) \ 10 - __print_symbolic(type, \ 11 - { V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" }, \ 12 - { V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" }, \ 13 - { V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" }, \ 14 - { V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" }, \ 15 - { V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" }, \ 16 - { V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" }, \ 17 - { V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" }, \ 18 - { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\ 19 - { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\ 20 - { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \ 21 - { V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" }, \ 22 - { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" }) 9 + /* Enums require being exported to userspace, for user tool parsing */ 10 + #undef EM 11 + #undef EMe 12 + #define EM(a, b) TRACE_DEFINE_ENUM(a); 13 + #define EMe(a, b) TRACE_DEFINE_ENUM(a); 14 + 15 + #define show_type(type) \ 16 + __print_symbolic(type, SHOW_TYPE) 17 + 18 + #define SHOW_TYPE \ 19 + EM( V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" ) \ 20 + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" ) \ 21 + EM( V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" ) \ 22 + EM( V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" ) \ 23 + EM( V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" ) \ 24 + EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" ) \ 25 + EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" ) \ 26 + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \ 27 + EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \ 28 + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \ 29 + EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \ 30 + EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" ) 31 + 32 + SHOW_TYPE 23 33 24 34 #define show_field(field) \ 25 - __print_symbolic(field, \ 26 - { V4L2_FIELD_ANY, "ANY" }, \ 27 - { V4L2_FIELD_NONE, "NONE" }, \ 28 - { V4L2_FIELD_TOP, "TOP" }, \ 29 - { V4L2_FIELD_BOTTOM, "BOTTOM" }, \ 30 - { V4L2_FIELD_INTERLACED, "INTERLACED" }, \ 31 - { V4L2_FIELD_SEQ_TB, "SEQ_TB" }, \ 32 - { V4L2_FIELD_SEQ_BT, "SEQ_BT" }, \ 33 - { V4L2_FIELD_ALTERNATE, "ALTERNATE" }, \ 34 - { V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" }, \ 35 - { V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" }) 35 + __print_symbolic(field, SHOW_FIELD) 36 + 37 + #define SHOW_FIELD \ 38 + EM( V4L2_FIELD_ANY, "ANY" ) \ 39 + EM( V4L2_FIELD_NONE, "NONE" ) \ 40 + EM( V4L2_FIELD_TOP, "TOP" ) \ 41 + EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \ 42 + EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \ 43 + EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \ 44 + EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \ 45 + EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \ 46 + EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \ 47 + EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" ) 48 + 49 + SHOW_FIELD 50 + 51 + /* 52 + * Now redefine the EM() and EMe() macros to map the enums to the strings 53 + * that will be printed in the output. 54 + */ 55 + #undef EM 56 + #undef EMe 57 + #define EM(a, b) {a, b}, 58 + #define EMe(a, b) {a, b} 59 + 60 + /* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */ 36 61 37 62 #define show_timecode_type(type) \ 38 63 __print_symbolic(type, \
+25 -8
include/trace/events/writeback.h
··· 23 23 {I_REFERENCED, "I_REFERENCED"} \ 24 24 ) 25 25 26 + /* enums need to be exported to user space */ 27 + #undef EM 28 + #undef EMe 29 + #define EM(a,b) TRACE_DEFINE_ENUM(a); 30 + #define EMe(a,b) TRACE_DEFINE_ENUM(a); 31 + 26 32 #define WB_WORK_REASON \ 27 - {WB_REASON_BACKGROUND, "background"}, \ 28 - {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \ 29 - {WB_REASON_SYNC, "sync"}, \ 30 - {WB_REASON_PERIODIC, "periodic"}, \ 31 - {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \ 32 - {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \ 33 - {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \ 34 - {WB_REASON_FORKER_THREAD, "forker_thread"} 33 + EM( WB_REASON_BACKGROUND, "background") \ 34 + EM( WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages") \ 35 + EM( WB_REASON_SYNC, "sync") \ 36 + EM( WB_REASON_PERIODIC, "periodic") \ 37 + EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \ 38 + EM( WB_REASON_FREE_MORE_MEM, "free_more_memory") \ 39 + EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \ 40 + EMe(WB_REASON_FORKER_THREAD, "forker_thread") 41 + 42 + WB_WORK_REASON 43 + 44 + /* 45 + * Now redefine the EM() and EMe() macros to map the enums to the strings 46 + * that will be printed in the output. 47 + */ 48 + #undef EM 49 + #undef EMe 50 + #define EM(a,b) { a, b }, 51 + #define EMe(a,b) { a, b } 35 52 36 53 struct wb_writeback_work; 37 54
+36 -5
include/trace/ftrace.h
··· 18 18 19 19 #include <linux/ftrace_event.h> 20 20 21 + #ifndef TRACE_SYSTEM_VAR 22 + #define TRACE_SYSTEM_VAR TRACE_SYSTEM 23 + #endif 24 + 25 + #define __app__(x, y) str__##x##y 26 + #define __app(x, y) __app__(x, y) 27 + 28 + #define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name) 29 + 30 + #define TRACE_MAKE_SYSTEM_STR() \ 31 + static const char TRACE_SYSTEM_STRING[] = \ 32 + __stringify(TRACE_SYSTEM) 33 + 34 + TRACE_MAKE_SYSTEM_STR(); 35 + 36 + #undef TRACE_DEFINE_ENUM 37 + #define TRACE_DEFINE_ENUM(a) \ 38 + static struct trace_enum_map __used __initdata \ 39 + __##TRACE_SYSTEM##_##a = \ 40 + { \ 41 + .system = TRACE_SYSTEM_STRING, \ 42 + .enum_string = #a, \ 43 + .enum_value = a \ 44 + }; \ 45 + static struct trace_enum_map __used \ 46 + __attribute__((section("_ftrace_enum_map"))) \ 47 + *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a 48 + 21 49 /* 22 50 * DECLARE_EVENT_CLASS can be used to add a generic function 23 51 * handlers for events. That is, if all events have the same ··· 133 105 134 106 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 135 107 136 - 137 108 /* 138 109 * Stage 2 of the trace events. 139 110 * ··· 148 121 * to keep the offset of each array from the beginning of the event. 149 122 * The size of an array is also encoded, in the higher 16 bits of <item>. 150 123 */ 124 + 125 + #undef TRACE_DEFINE_ENUM 126 + #define TRACE_DEFINE_ENUM(a) 151 127 152 128 #undef __field 153 129 #define __field(type, item) ··· 569 539 * .trace = ftrace_raw_output_<call>, <-- stage 2 570 540 * }; 571 541 * 572 - * static const char print_fmt_<call>[] = <TP_printk>; 542 + * static char print_fmt_<call>[] = <TP_printk>; 573 543 * 574 544 * static struct ftrace_event_class __used event_class_<template> = { 575 545 * .system = "<system>", ··· 720 690 #undef DECLARE_EVENT_CLASS 721 691 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 722 692 _TRACE_PERF_PROTO(call, PARAMS(proto)); \ 723 - static const char print_fmt_##call[] = print; \ 693 + static char print_fmt_##call[] = print; \ 724 694 static struct ftrace_event_class __used __refdata event_class_##call = { \ 725 - .system = __stringify(TRACE_SYSTEM), \ 695 + .system = TRACE_SYSTEM_STRING, \ 726 696 .define_fields = ftrace_define_fields_##call, \ 727 697 .fields = LIST_HEAD_INIT(event_class_##call.fields),\ 728 698 .raw_init = trace_event_raw_init, \ ··· 749 719 #undef DEFINE_EVENT_PRINT 750 720 #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 751 721 \ 752 - static const char print_fmt_##call[] = print; \ 722 + static char print_fmt_##call[] = print; \ 753 723 \ 754 724 static struct ftrace_event_call __used event_##call = { \ 755 725 .class = &event_class_##template, \ ··· 765 735 766 736 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 767 737 738 + #undef TRACE_SYSTEM_VAR 768 739 769 740 #ifdef CONFIG_PERF_EVENTS 770 741
+3
kernel/module.c
··· 2770 2770 mod->trace_events = section_objs(info, "_ftrace_events", 2771 2771 sizeof(*mod->trace_events), 2772 2772 &mod->num_trace_events); 2773 + mod->trace_enums = section_objs(info, "_ftrace_enum_map", 2774 + sizeof(*mod->trace_enums), 2775 + &mod->num_trace_enums); 2773 2776 #endif 2774 2777 #ifdef CONFIG_TRACING 2775 2778 mod->trace_bprintk_fmt_start = section_objs(info, "__trace_printk_fmt",
+28
kernel/trace/Kconfig
··· 599 599 600 600 If unsure, say N 601 601 602 + config TRACE_ENUM_MAP_FILE 603 + bool "Show enum mappings for trace events" 604 + depends on TRACING 605 + help 606 + The "print fmt" of the trace events will show the enum names instead 607 + of their values. This can cause problems for user space tools that 608 + use this string to parse the raw data as user space does not know 609 + how to convert the string to its value. 610 + 611 + To fix this, there's a special macro in the kernel that can be used 612 + to convert the enum into its value. If this macro is used, then the 613 + print fmt strings will have the enums converted to their values. 614 + 615 + If something does not get converted properly, this option can be 616 + used to show what enums the kernel tried to convert. 617 + 618 + This option is for debugging the enum conversions. A file is created 619 + in the tracing directory called "enum_map" that will show the enum 620 + names matched with their values and what trace event system they 621 + belong too. 622 + 623 + Normally, the mapping of the strings to values will be freed after 624 + boot up or module load. With this option, they will not be freed, as 625 + they are needed for the "enum_map" file. Enabling this option will 626 + increase the memory footprint of the running kernel. 627 + 628 + If unsure, say N 629 + 602 630 endif # FTRACE 603 631 604 632 endif # TRACING_SUPPORT
+14 -8
kernel/trace/ftrace.c
··· 249 249 static inline void update_function_graph_func(void) { } 250 250 #endif 251 251 252 + 253 + static ftrace_func_t ftrace_ops_get_list_func(struct ftrace_ops *ops) 254 + { 255 + /* 256 + * If this is a dynamic ops or we force list func, 257 + * then it needs to call the list anyway. 258 + */ 259 + if (ops->flags & FTRACE_OPS_FL_DYNAMIC || FTRACE_FORCE_LIST_FUNC) 260 + return ftrace_ops_list_func; 261 + 262 + return ftrace_ops_get_func(ops); 263 + } 264 + 252 265 static void update_ftrace_function(void) 253 266 { 254 267 ftrace_func_t func; ··· 283 270 * then have the mcount trampoline call the function directly. 284 271 */ 285 272 } else if (ftrace_ops_list->next == &ftrace_list_end) { 286 - func = ftrace_ops_get_func(ftrace_ops_list); 273 + func = ftrace_ops_get_list_func(ftrace_ops_list); 287 274 288 275 } else { 289 276 /* Just use the default ftrace_ops */ ··· 5221 5208 */ 5222 5209 ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops) 5223 5210 { 5224 - /* 5225 - * If this is a dynamic ops or we force list func, 5226 - * then it needs to call the list anyway. 5227 - */ 5228 - if (ops->flags & FTRACE_OPS_FL_DYNAMIC || FTRACE_FORCE_LIST_FUNC) 5229 - return ftrace_ops_list_func; 5230 - 5231 5211 /* 5232 5212 * If the func handles its own recursion, call it directly. 5233 5213 * Otherwise call the recursion protected function that
+3 -7
kernel/trace/ring_buffer.c
··· 2679 2679 2680 2680 static __always_inline int trace_recursive_lock(void) 2681 2681 { 2682 - unsigned int val = this_cpu_read(current_context); 2682 + unsigned int val = __this_cpu_read(current_context); 2683 2683 int bit; 2684 2684 2685 2685 if (in_interrupt()) { ··· 2696 2696 return 1; 2697 2697 2698 2698 val |= (1 << bit); 2699 - this_cpu_write(current_context, val); 2699 + __this_cpu_write(current_context, val); 2700 2700 2701 2701 return 0; 2702 2702 } 2703 2703 2704 2704 static __always_inline void trace_recursive_unlock(void) 2705 2705 { 2706 - unsigned int val = this_cpu_read(current_context); 2707 - 2708 - val--; 2709 - val &= this_cpu_read(current_context); 2710 - this_cpu_write(current_context, val); 2706 + __this_cpu_and(current_context, __this_cpu_read(current_context) - 1); 2711 2707 } 2712 2708 2713 2709 #else
+303 -1
kernel/trace/trace.c
··· 125 125 /* When set, tracing will stop when a WARN*() is hit */ 126 126 int __disable_trace_on_warning; 127 127 128 + #ifdef CONFIG_TRACE_ENUM_MAP_FILE 129 + /* Map of enums to their values, for "enum_map" file */ 130 + struct trace_enum_map_head { 131 + struct module *mod; 132 + unsigned long length; 133 + }; 134 + 135 + union trace_enum_map_item; 136 + 137 + struct trace_enum_map_tail { 138 + /* 139 + * "end" is first and points to NULL as it must be different 140 + * than "mod" or "enum_string" 141 + */ 142 + union trace_enum_map_item *next; 143 + const char *end; /* points to NULL */ 144 + }; 145 + 146 + static DEFINE_MUTEX(trace_enum_mutex); 147 + 148 + /* 149 + * The trace_enum_maps are saved in an array with two extra elements, 150 + * one at the beginning, and one at the end. The beginning item contains 151 + * the count of the saved maps (head.length), and the module they 152 + * belong to if not built in (head.mod). The ending item contains a 153 + * pointer to the next array of saved enum_map items. 154 + */ 155 + union trace_enum_map_item { 156 + struct trace_enum_map map; 157 + struct trace_enum_map_head head; 158 + struct trace_enum_map_tail tail; 159 + }; 160 + 161 + static union trace_enum_map_item *trace_enum_maps; 162 + #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ 163 + 128 164 static int tracing_set_tracer(struct trace_array *tr, const char *buf); 129 165 130 166 #define MAX_TRACER_SIZE 100 ··· 3946 3910 .write = tracing_saved_cmdlines_size_write, 3947 3911 }; 3948 3912 3913 + #ifdef CONFIG_TRACE_ENUM_MAP_FILE 3914 + static union trace_enum_map_item * 3915 + update_enum_map(union trace_enum_map_item *ptr) 3916 + { 3917 + if (!ptr->map.enum_string) { 3918 + if (ptr->tail.next) { 3919 + ptr = ptr->tail.next; 3920 + /* Set ptr to the next real item (skip head) */ 3921 + ptr++; 3922 + } else 3923 + return NULL; 3924 + } 3925 + return ptr; 3926 + } 3927 + 3928 + static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) 3929 + { 3930 + union trace_enum_map_item *ptr = v; 3931 + 3932 + /* 3933 + * Paranoid! If ptr points to end, we don't want to increment past it. 3934 + * This really should never happen. 3935 + */ 3936 + ptr = update_enum_map(ptr); 3937 + if (WARN_ON_ONCE(!ptr)) 3938 + return NULL; 3939 + 3940 + ptr++; 3941 + 3942 + (*pos)++; 3943 + 3944 + ptr = update_enum_map(ptr); 3945 + 3946 + return ptr; 3947 + } 3948 + 3949 + static void *enum_map_start(struct seq_file *m, loff_t *pos) 3950 + { 3951 + union trace_enum_map_item *v; 3952 + loff_t l = 0; 3953 + 3954 + mutex_lock(&trace_enum_mutex); 3955 + 3956 + v = trace_enum_maps; 3957 + if (v) 3958 + v++; 3959 + 3960 + while (v && l < *pos) { 3961 + v = enum_map_next(m, v, &l); 3962 + } 3963 + 3964 + return v; 3965 + } 3966 + 3967 + static void enum_map_stop(struct seq_file *m, void *v) 3968 + { 3969 + mutex_unlock(&trace_enum_mutex); 3970 + } 3971 + 3972 + static int enum_map_show(struct seq_file *m, void *v) 3973 + { 3974 + union trace_enum_map_item *ptr = v; 3975 + 3976 + seq_printf(m, "%s %ld (%s)\n", 3977 + ptr->map.enum_string, ptr->map.enum_value, 3978 + ptr->map.system); 3979 + 3980 + return 0; 3981 + } 3982 + 3983 + static const struct seq_operations tracing_enum_map_seq_ops = { 3984 + .start = enum_map_start, 3985 + .next = enum_map_next, 3986 + .stop = enum_map_stop, 3987 + .show = enum_map_show, 3988 + }; 3989 + 3990 + static int tracing_enum_map_open(struct inode *inode, struct file *filp) 3991 + { 3992 + if (tracing_disabled) 3993 + return -ENODEV; 3994 + 3995 + return seq_open(filp, &tracing_enum_map_seq_ops); 3996 + } 3997 + 3998 + static const struct file_operations tracing_enum_map_fops = { 3999 + .open = tracing_enum_map_open, 4000 + .read = seq_read, 4001 + .llseek = seq_lseek, 4002 + .release = seq_release, 4003 + }; 4004 + 4005 + static inline union trace_enum_map_item * 4006 + trace_enum_jmp_to_tail(union trace_enum_map_item *ptr) 4007 + { 4008 + /* Return tail of array given the head */ 4009 + return ptr + ptr->head.length + 1; 4010 + } 4011 + 4012 + static void 4013 + trace_insert_enum_map_file(struct module *mod, struct trace_enum_map **start, 4014 + int len) 4015 + { 4016 + struct trace_enum_map **stop; 4017 + struct trace_enum_map **map; 4018 + union trace_enum_map_item *map_array; 4019 + union trace_enum_map_item *ptr; 4020 + 4021 + stop = start + len; 4022 + 4023 + /* 4024 + * The trace_enum_maps contains the map plus a head and tail item, 4025 + * where the head holds the module and length of array, and the 4026 + * tail holds a pointer to the next list. 4027 + */ 4028 + map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL); 4029 + if (!map_array) { 4030 + pr_warning("Unable to allocate trace enum mapping\n"); 4031 + return; 4032 + } 4033 + 4034 + mutex_lock(&trace_enum_mutex); 4035 + 4036 + if (!trace_enum_maps) 4037 + trace_enum_maps = map_array; 4038 + else { 4039 + ptr = trace_enum_maps; 4040 + for (;;) { 4041 + ptr = trace_enum_jmp_to_tail(ptr); 4042 + if (!ptr->tail.next) 4043 + break; 4044 + ptr = ptr->tail.next; 4045 + 4046 + } 4047 + ptr->tail.next = map_array; 4048 + } 4049 + map_array->head.mod = mod; 4050 + map_array->head.length = len; 4051 + map_array++; 4052 + 4053 + for (map = start; (unsigned long)map < (unsigned long)stop; map++) { 4054 + map_array->map = **map; 4055 + map_array++; 4056 + } 4057 + memset(map_array, 0, sizeof(*map_array)); 4058 + 4059 + mutex_unlock(&trace_enum_mutex); 4060 + } 4061 + 4062 + static void trace_create_enum_file(struct dentry *d_tracer) 4063 + { 4064 + trace_create_file("enum_map", 0444, d_tracer, 4065 + NULL, &tracing_enum_map_fops); 4066 + } 4067 + 4068 + #else /* CONFIG_TRACE_ENUM_MAP_FILE */ 4069 + static inline void trace_create_enum_file(struct dentry *d_tracer) { } 4070 + static inline void trace_insert_enum_map_file(struct module *mod, 4071 + struct trace_enum_map **start, int len) { } 4072 + #endif /* !CONFIG_TRACE_ENUM_MAP_FILE */ 4073 + 4074 + static void trace_insert_enum_map(struct module *mod, 4075 + struct trace_enum_map **start, int len) 4076 + { 4077 + struct trace_enum_map **map; 4078 + 4079 + if (len <= 0) 4080 + return; 4081 + 4082 + map = start; 4083 + 4084 + trace_event_enum_update(map, len); 4085 + 4086 + trace_insert_enum_map_file(mod, start, len); 4087 + } 4088 + 3949 4089 static ssize_t 3950 4090 tracing_set_trace_read(struct file *filp, char __user *ubuf, 3951 4091 size_t cnt, loff_t *ppos) ··· 6739 6527 return NULL; 6740 6528 } 6741 6529 6530 + extern struct trace_enum_map *__start_ftrace_enum_maps[]; 6531 + extern struct trace_enum_map *__stop_ftrace_enum_maps[]; 6532 + 6533 + static void __init trace_enum_init(void) 6534 + { 6535 + int len; 6536 + 6537 + len = __stop_ftrace_enum_maps - __start_ftrace_enum_maps; 6538 + trace_insert_enum_map(NULL, __start_ftrace_enum_maps, len); 6539 + } 6540 + 6541 + #ifdef CONFIG_MODULES 6542 + static void trace_module_add_enums(struct module *mod) 6543 + { 6544 + if (!mod->num_trace_enums) 6545 + return; 6546 + 6547 + /* 6548 + * Modules with bad taint do not have events created, do 6549 + * not bother with enums either. 6550 + */ 6551 + if (trace_module_has_bad_taint(mod)) 6552 + return; 6553 + 6554 + trace_insert_enum_map(mod, mod->trace_enums, mod->num_trace_enums); 6555 + } 6556 + 6557 + #ifdef CONFIG_TRACE_ENUM_MAP_FILE 6558 + static void trace_module_remove_enums(struct module *mod) 6559 + { 6560 + union trace_enum_map_item *map; 6561 + union trace_enum_map_item **last = &trace_enum_maps; 6562 + 6563 + if (!mod->num_trace_enums) 6564 + return; 6565 + 6566 + mutex_lock(&trace_enum_mutex); 6567 + 6568 + map = trace_enum_maps; 6569 + 6570 + while (map) { 6571 + if (map->head.mod == mod) 6572 + break; 6573 + map = trace_enum_jmp_to_tail(map); 6574 + last = &map->tail.next; 6575 + map = map->tail.next; 6576 + } 6577 + if (!map) 6578 + goto out; 6579 + 6580 + *last = trace_enum_jmp_to_tail(map)->tail.next; 6581 + kfree(map); 6582 + out: 6583 + mutex_unlock(&trace_enum_mutex); 6584 + } 6585 + #else 6586 + static inline void trace_module_remove_enums(struct module *mod) { } 6587 + #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ 6588 + 6589 + static int trace_module_notify(struct notifier_block *self, 6590 + unsigned long val, void *data) 6591 + { 6592 + struct module *mod = data; 6593 + 6594 + switch (val) { 6595 + case MODULE_STATE_COMING: 6596 + trace_module_add_enums(mod); 6597 + break; 6598 + case MODULE_STATE_GOING: 6599 + trace_module_remove_enums(mod); 6600 + break; 6601 + } 6602 + 6603 + return 0; 6604 + } 6605 + 6606 + static struct notifier_block trace_module_nb = { 6607 + .notifier_call = trace_module_notify, 6608 + .priority = 0, 6609 + }; 6610 + #endif /* CONFIG_MODULES */ 6611 + 6742 6612 static __init int tracer_init_tracefs(void) 6743 6613 { 6744 6614 struct dentry *d_tracer; ··· 6844 6550 6845 6551 trace_create_file("saved_cmdlines_size", 0644, d_tracer, 6846 6552 NULL, &tracing_saved_cmdlines_size_fops); 6553 + 6554 + trace_enum_init(); 6555 + 6556 + trace_create_enum_file(d_tracer); 6557 + 6558 + #ifdef CONFIG_MODULES 6559 + register_module_notifier(&trace_module_nb); 6560 + #endif 6847 6561 6848 6562 #ifdef CONFIG_DYNAMIC_FTRACE 6849 6563 trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, ··· 7179 6877 tracepoint_printk = 0; 7180 6878 } 7181 6879 tracer_alloc_buffers(); 7182 - trace_event_init(); 6880 + trace_event_init(); 7183 6881 } 7184 6882 7185 6883 __init static int clear_boot_tracer(void)
+2
kernel/trace/trace.h
··· 1309 1309 1310 1310 #ifdef CONFIG_EVENT_TRACING 1311 1311 void trace_event_init(void); 1312 + void trace_event_enum_update(struct trace_enum_map **map, int len); 1312 1313 #else 1313 1314 static inline void __init trace_event_init(void) { } 1315 + static inlin void trace_event_enum_update(struct trace_enum_map **map, int len) { } 1314 1316 #endif 1315 1317 1316 1318 extern struct trace_iterator *tracepoint_print_iter;
+3 -3
kernel/trace/trace_entries.h
··· 223 223 __dynamic_array( u32, buf ) 224 224 ), 225 225 226 - F_printk("%pf: %s", 226 + F_printk("%ps: %s", 227 227 (void *)__entry->ip, __entry->fmt), 228 228 229 229 FILTER_OTHER ··· 238 238 __dynamic_array( char, buf ) 239 239 ), 240 240 241 - F_printk("%pf: %s", 241 + F_printk("%ps: %s", 242 242 (void *)__entry->ip, __entry->buf), 243 243 244 244 FILTER_OTHER ··· 253 253 __field( const char *, str ) 254 254 ), 255 255 256 - F_printk("%pf: %s", 256 + F_printk("%ps: %s", 257 257 (void *)__entry->ip, __entry->str), 258 258 259 259 FILTER_OTHER
+120 -1
kernel/trace/trace_events.c
··· 1704 1704 return 0; 1705 1705 } 1706 1706 1707 + static char *enum_replace(char *ptr, struct trace_enum_map *map, int len) 1708 + { 1709 + int rlen; 1710 + int elen; 1711 + 1712 + /* Find the length of the enum value as a string */ 1713 + elen = snprintf(ptr, 0, "%ld", map->enum_value); 1714 + /* Make sure there's enough room to replace the string with the value */ 1715 + if (len < elen) 1716 + return NULL; 1717 + 1718 + snprintf(ptr, elen + 1, "%ld", map->enum_value); 1719 + 1720 + /* Get the rest of the string of ptr */ 1721 + rlen = strlen(ptr + len); 1722 + memmove(ptr + elen, ptr + len, rlen); 1723 + /* Make sure we end the new string */ 1724 + ptr[elen + rlen] = 0; 1725 + 1726 + return ptr + elen; 1727 + } 1728 + 1729 + static void update_event_printk(struct ftrace_event_call *call, 1730 + struct trace_enum_map *map) 1731 + { 1732 + char *ptr; 1733 + int quote = 0; 1734 + int len = strlen(map->enum_string); 1735 + 1736 + for (ptr = call->print_fmt; *ptr; ptr++) { 1737 + if (*ptr == '\\') { 1738 + ptr++; 1739 + /* paranoid */ 1740 + if (!*ptr) 1741 + break; 1742 + continue; 1743 + } 1744 + if (*ptr == '"') { 1745 + quote ^= 1; 1746 + continue; 1747 + } 1748 + if (quote) 1749 + continue; 1750 + if (isdigit(*ptr)) { 1751 + /* skip numbers */ 1752 + do { 1753 + ptr++; 1754 + /* Check for alpha chars like ULL */ 1755 + } while (isalnum(*ptr)); 1756 + /* 1757 + * A number must have some kind of delimiter after 1758 + * it, and we can ignore that too. 1759 + */ 1760 + continue; 1761 + } 1762 + if (isalpha(*ptr) || *ptr == '_') { 1763 + if (strncmp(map->enum_string, ptr, len) == 0 && 1764 + !isalnum(ptr[len]) && ptr[len] != '_') { 1765 + ptr = enum_replace(ptr, map, len); 1766 + /* Hmm, enum string smaller than value */ 1767 + if (WARN_ON_ONCE(!ptr)) 1768 + return; 1769 + /* 1770 + * No need to decrement here, as enum_replace() 1771 + * returns the pointer to the character passed 1772 + * the enum, and two enums can not be placed 1773 + * back to back without something in between. 1774 + * We can skip that something in between. 1775 + */ 1776 + continue; 1777 + } 1778 + skip_more: 1779 + do { 1780 + ptr++; 1781 + } while (isalnum(*ptr) || *ptr == '_'); 1782 + /* 1783 + * If what comes after this variable is a '.' or 1784 + * '->' then we can continue to ignore that string. 1785 + */ 1786 + if (*ptr == '.' || (ptr[0] == '-' && ptr[1] == '>')) { 1787 + ptr += *ptr == '.' ? 1 : 2; 1788 + goto skip_more; 1789 + } 1790 + /* 1791 + * Once again, we can skip the delimiter that came 1792 + * after the string. 1793 + */ 1794 + continue; 1795 + } 1796 + } 1797 + } 1798 + 1799 + void trace_event_enum_update(struct trace_enum_map **map, int len) 1800 + { 1801 + struct ftrace_event_call *call, *p; 1802 + const char *last_system = NULL; 1803 + int last_i; 1804 + int i; 1805 + 1806 + down_write(&trace_event_sem); 1807 + list_for_each_entry_safe(call, p, &ftrace_events, list) { 1808 + /* events are usually grouped together with systems */ 1809 + if (!last_system || call->class->system != last_system) { 1810 + last_i = 0; 1811 + last_system = call->class->system; 1812 + } 1813 + 1814 + for (i = last_i; i < len; i++) { 1815 + if (call->class->system == map[i]->system) { 1816 + /* Save the first system if need be */ 1817 + if (!last_i) 1818 + last_i = i; 1819 + update_event_printk(call, map[i]); 1820 + } 1821 + } 1822 + } 1823 + up_write(&trace_event_sem); 1824 + } 1825 + 1707 1826 static struct ftrace_event_file * 1708 1827 trace_create_new_event(struct ftrace_event_call *call, 1709 1828 struct trace_array *tr) ··· 2034 1915 2035 1916 static struct notifier_block trace_module_nb = { 2036 1917 .notifier_call = trace_module_notify, 2037 - .priority = 0, 1918 + .priority = 1, /* higher than trace.c module notify */ 2038 1919 }; 2039 1920 #endif /* CONFIG_MODULES */ 2040 1921
+1 -1
kernel/trace/trace_export.c
··· 177 177 }, \ 178 178 .event.type = etype, \ 179 179 .print_fmt = print, \ 180 - .flags = TRACE_EVENT_FL_IGNORE_ENABLE | TRACE_EVENT_FL_USE_CALL_FILTER, \ 180 + .flags = TRACE_EVENT_FL_IGNORE_ENABLE, \ 181 181 }; \ 182 182 struct ftrace_event_call __used \ 183 183 __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
+3 -2
kernel/trace/trace_kprobe.c
··· 250 250 #define fetch_file_offset_string_size NULL 251 251 252 252 /* Fetch type information table */ 253 - const struct fetch_type kprobes_fetch_type_table[] = { 253 + static const struct fetch_type kprobes_fetch_type_table[] = { 254 254 /* Special types */ 255 255 [FETCH_TYPE_STRING] = __ASSIGN_FETCH_TYPE("string", string, string, 256 256 sizeof(u32), 1, "__data_loc char[]"), ··· 760 760 761 761 /* Parse fetch argument */ 762 762 ret = traceprobe_parse_probe_arg(arg, &tk->tp.size, parg, 763 - is_return, true); 763 + is_return, true, 764 + kprobes_fetch_type_table); 764 765 if (ret) { 765 766 pr_info("Parse error at argument[%d]. (%d)\n", i, ret); 766 767 goto error;
+7 -12
kernel/trace/trace_probe.c
··· 356 356 357 357 /* Recursive argument parser */ 358 358 static int parse_probe_arg(char *arg, const struct fetch_type *t, 359 - struct fetch_param *f, bool is_return, bool is_kprobe) 359 + struct fetch_param *f, bool is_return, bool is_kprobe, 360 + const struct fetch_type *ftbl) 360 361 { 361 - const struct fetch_type *ftbl; 362 362 unsigned long param; 363 363 long offset; 364 364 char *tmp; 365 365 int ret = 0; 366 - 367 - ftbl = is_kprobe ? kprobes_fetch_type_table : uprobes_fetch_type_table; 368 - BUG_ON(ftbl == NULL); 369 366 370 367 switch (arg[0]) { 371 368 case '$': ··· 444 447 dprm->fetch_size = get_fetch_size_function(t, 445 448 dprm->fetch, ftbl); 446 449 ret = parse_probe_arg(arg, t2, &dprm->orig, is_return, 447 - is_kprobe); 450 + is_kprobe, ftbl); 448 451 if (ret) 449 452 kfree(dprm); 450 453 else { ··· 502 505 503 506 /* String length checking wrapper */ 504 507 int traceprobe_parse_probe_arg(char *arg, ssize_t *size, 505 - struct probe_arg *parg, bool is_return, bool is_kprobe) 508 + struct probe_arg *parg, bool is_return, bool is_kprobe, 509 + const struct fetch_type *ftbl) 506 510 { 507 - const struct fetch_type *ftbl; 508 511 const char *t; 509 512 int ret; 510 - 511 - ftbl = is_kprobe ? kprobes_fetch_type_table : uprobes_fetch_type_table; 512 - BUG_ON(ftbl == NULL); 513 513 514 514 if (strlen(arg) > MAX_ARGSTR_LEN) { 515 515 pr_info("Argument is too long.: %s\n", arg); ··· 529 535 } 530 536 parg->offset = *size; 531 537 *size += parg->type->size; 532 - ret = parse_probe_arg(arg, parg->type, &parg->fetch, is_return, is_kprobe); 538 + ret = parse_probe_arg(arg, parg->type, &parg->fetch, is_return, 539 + is_kprobe, ftbl); 533 540 534 541 if (ret >= 0 && t != NULL) 535 542 ret = __parse_bitfield_probe_arg(t, parg->type, &parg->fetch);
+2 -8
kernel/trace/trace_probe.h
··· 229 229 #define FETCH_TYPE_STRING 0 230 230 #define FETCH_TYPE_STRSIZE 1 231 231 232 - /* 233 - * Fetch type information table. 234 - * It's declared as a weak symbol due to conditional compilation. 235 - */ 236 - extern __weak const struct fetch_type kprobes_fetch_type_table[]; 237 - extern __weak const struct fetch_type uprobes_fetch_type_table[]; 238 - 239 232 #ifdef CONFIG_KPROBE_EVENT 240 233 struct symbol_cache; 241 234 unsigned long update_symbol_cache(struct symbol_cache *sc); ··· 326 333 } 327 334 328 335 extern int traceprobe_parse_probe_arg(char *arg, ssize_t *size, 329 - struct probe_arg *parg, bool is_return, bool is_kprobe); 336 + struct probe_arg *parg, bool is_return, bool is_kprobe, 337 + const struct fetch_type *ftbl); 330 338 331 339 extern int traceprobe_conflict_field_name(const char *name, 332 340 struct probe_arg *args, int narg);
+3 -2
kernel/trace/trace_uprobe.c
··· 196 196 DEFINE_FETCH_file_offset(string_size) 197 197 198 198 /* Fetch type information table */ 199 - const struct fetch_type uprobes_fetch_type_table[] = { 199 + static const struct fetch_type uprobes_fetch_type_table[] = { 200 200 /* Special types */ 201 201 [FETCH_TYPE_STRING] = __ASSIGN_FETCH_TYPE("string", string, string, 202 202 sizeof(u32), 1, "__data_loc char[]"), ··· 535 535 536 536 /* Parse fetch argument */ 537 537 ret = traceprobe_parse_probe_arg(arg, &tu->tp.size, parg, 538 - is_return, false); 538 + is_return, false, 539 + uprobes_fetch_type_table); 539 540 if (ret) { 540 541 pr_info("Parse error at argument[%d]. (%d)\n", i, ret); 541 542 goto error;
+1
net/mac80211/trace.c
··· 8 8 #include "debug.h" 9 9 #define CREATE_TRACE_POINTS 10 10 #include "trace.h" 11 + #include "trace_msg.h" 11 12 12 13 #ifdef CONFIG_MAC80211_MESSAGE_TRACING 13 14 void __sdata_info(const char *fmt, ...)
-38
net/mac80211/trace.h
··· 2312 2312 ) 2313 2313 ); 2314 2314 2315 - #ifdef CONFIG_MAC80211_MESSAGE_TRACING 2316 - #undef TRACE_SYSTEM 2317 - #define TRACE_SYSTEM mac80211_msg 2318 - 2319 - #define MAX_MSG_LEN 100 2320 - 2321 - DECLARE_EVENT_CLASS(mac80211_msg_event, 2322 - TP_PROTO(struct va_format *vaf), 2323 - 2324 - TP_ARGS(vaf), 2325 - 2326 - TP_STRUCT__entry( 2327 - __dynamic_array(char, msg, MAX_MSG_LEN) 2328 - ), 2329 - 2330 - TP_fast_assign( 2331 - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 2332 - MAX_MSG_LEN, vaf->fmt, 2333 - *vaf->va) >= MAX_MSG_LEN); 2334 - ), 2335 - 2336 - TP_printk("%s", __get_str(msg)) 2337 - ); 2338 - 2339 - DEFINE_EVENT(mac80211_msg_event, mac80211_info, 2340 - TP_PROTO(struct va_format *vaf), 2341 - TP_ARGS(vaf) 2342 - ); 2343 - DEFINE_EVENT(mac80211_msg_event, mac80211_dbg, 2344 - TP_PROTO(struct va_format *vaf), 2345 - TP_ARGS(vaf) 2346 - ); 2347 - DEFINE_EVENT(mac80211_msg_event, mac80211_err, 2348 - TP_PROTO(struct va_format *vaf), 2349 - TP_ARGS(vaf) 2350 - ); 2351 - #endif 2352 - 2353 2315 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ 2354 2316 2355 2317 #undef TRACE_INCLUDE_PATH
+53
net/mac80211/trace_msg.h
··· 1 + #ifdef CONFIG_MAC80211_MESSAGE_TRACING 2 + 3 + #if !defined(__MAC80211_MSG_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) 4 + #define __MAC80211_MSG_DRIVER_TRACE 5 + 6 + #include <linux/tracepoint.h> 7 + #include <net/mac80211.h> 8 + #include "ieee80211_i.h" 9 + 10 + #undef TRACE_SYSTEM 11 + #define TRACE_SYSTEM mac80211_msg 12 + 13 + #define MAX_MSG_LEN 100 14 + 15 + DECLARE_EVENT_CLASS(mac80211_msg_event, 16 + TP_PROTO(struct va_format *vaf), 17 + 18 + TP_ARGS(vaf), 19 + 20 + TP_STRUCT__entry( 21 + __dynamic_array(char, msg, MAX_MSG_LEN) 22 + ), 23 + 24 + TP_fast_assign( 25 + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), 26 + MAX_MSG_LEN, vaf->fmt, 27 + *vaf->va) >= MAX_MSG_LEN); 28 + ), 29 + 30 + TP_printk("%s", __get_str(msg)) 31 + ); 32 + 33 + DEFINE_EVENT(mac80211_msg_event, mac80211_info, 34 + TP_PROTO(struct va_format *vaf), 35 + TP_ARGS(vaf) 36 + ); 37 + DEFINE_EVENT(mac80211_msg_event, mac80211_dbg, 38 + TP_PROTO(struct va_format *vaf), 39 + TP_ARGS(vaf) 40 + ); 41 + DEFINE_EVENT(mac80211_msg_event, mac80211_err, 42 + TP_PROTO(struct va_format *vaf), 43 + TP_ARGS(vaf) 44 + ); 45 + #endif /* !__MAC80211_MSG_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ 46 + 47 + #undef TRACE_INCLUDE_PATH 48 + #define TRACE_INCLUDE_PATH . 49 + #undef TRACE_INCLUDE_FILE 50 + #define TRACE_INCLUDE_FILE trace_msg 51 + #include <trace/define_trace.h> 52 + 53 + #endif
+82 -2
samples/trace_events/trace-events-sample.h
··· 22 22 * protection, just like TRACE_INCLUDE_FILE. 23 23 */ 24 24 #undef TRACE_SYSTEM 25 - #define TRACE_SYSTEM sample 25 + #define TRACE_SYSTEM sample-trace 26 + 27 + /* 28 + * TRACE_SYSTEM is expected to be a C valid variable (alpha-numeric 29 + * and underscore), although it may start with numbers. If for some 30 + * reason it is not, you need to add the following lines: 31 + */ 32 + #undef TRACE_SYSTEM_VAR 33 + #define TRACE_SYSTEM_VAR sample_trace 34 + /* 35 + * But the above is only needed if TRACE_SYSTEM is not alpha-numeric 36 + * and underscored. By default, TRACE_SYSTEM_VAR will be equal to 37 + * TRACE_SYSTEM. As TRACE_SYSTEM_VAR must be alpha-numeric, if 38 + * TRACE_SYSTEM is not, then TRACE_SYSTEM_VAR must be defined with 39 + * only alpha-numeric and underscores. 40 + * 41 + * The TRACE_SYSTEM_VAR is only used internally and not visible to 42 + * user space. 43 + */ 26 44 27 45 /* 28 46 * Notice that this file is not protected like a normal header. ··· 198 180 ; 199 181 return i; 200 182 } 183 + 184 + enum { 185 + TRACE_SAMPLE_FOO = 2, 186 + TRACE_SAMPLE_BAR = 4, 187 + TRACE_SAMPLE_ZOO = 8, 188 + }; 201 189 #endif 190 + 191 + /* 192 + * If enums are used in the TP_printk(), their names will be shown in 193 + * format files and not their values. This can cause problems with user 194 + * space programs that parse the format files to know how to translate 195 + * the raw binary trace output into human readable text. 196 + * 197 + * To help out user space programs, any enum that is used in the TP_printk() 198 + * should be defined by TRACE_DEFINE_ENUM() macro. All that is needed to 199 + * be done is to add this macro with the enum within it in the trace 200 + * header file, and it will be converted in the output. 201 + */ 202 + 203 + TRACE_DEFINE_ENUM(TRACE_SAMPLE_FOO); 204 + TRACE_DEFINE_ENUM(TRACE_SAMPLE_BAR); 205 + TRACE_DEFINE_ENUM(TRACE_SAMPLE_ZOO); 202 206 203 207 TRACE_EVENT(foo_bar, 204 208 ··· 246 206 __assign_bitmask(cpus, cpumask_bits(mask), num_possible_cpus()); 247 207 ), 248 208 249 - TP_printk("foo %s %d %s %s (%s)", __entry->foo, __entry->bar, 209 + TP_printk("foo %s %d %s %s %s %s (%s)", __entry->foo, __entry->bar, 210 + 211 + /* 212 + * Notice here the use of some helper functions. This includes: 213 + * 214 + * __print_symbolic( variable, { value, "string" }, ... ), 215 + * 216 + * The variable is tested against each value of the { } pair. If 217 + * the variable matches one of the values, then it will print the 218 + * string in that pair. If non are matched, it returns a string 219 + * version of the number (if __entry->bar == 7 then "7" is returned). 220 + */ 221 + __print_symbolic(__entry->bar, 222 + { 0, "zero" }, 223 + { TRACE_SAMPLE_FOO, "TWO" }, 224 + { TRACE_SAMPLE_BAR, "FOUR" }, 225 + { TRACE_SAMPLE_ZOO, "EIGHT" }, 226 + { 10, "TEN" } 227 + ), 228 + 229 + /* 230 + * __print_flags( variable, "delim", { value, "flag" }, ... ), 231 + * 232 + * This is similar to __print_symbolic, except that it tests the bits 233 + * of the value. If ((FLAG & variable) == FLAG) then the string is 234 + * printed. If more than one flag matches, then each one that does is 235 + * also printed with delim in between them. 236 + * If not all bits are accounted for, then the not found bits will be 237 + * added in hex format: 0x506 will show BIT2|BIT4|0x500 238 + */ 239 + __print_flags(__entry->bar, "|", 240 + { 1, "BIT1" }, 241 + { 2, "BIT2" }, 242 + { 4, "BIT3" }, 243 + { 8, "BIT4" } 244 + ), 245 + /* 246 + * __print_array( array, len, element_size ) 247 + * 248 + * This prints out the array that is defined by __array in a nice format. 249 + */ 250 250 __print_array(__get_dynamic_array(list), 251 251 __get_dynamic_array_len(list), 252 252 sizeof(int)),
+1 -1
tools/lib/traceevent/event-parse.c
··· 3976 3976 if (asprintf(&arg->atom.atom, "%lld", ip) < 0) 3977 3977 goto out_free; 3978 3978 3979 - /* skip the first "%pf: " */ 3979 + /* skip the first "%ps: " */ 3980 3980 for (ptr = fmt + 5, bptr = data + field->offset; 3981 3981 bptr < data + size && *ptr; ptr++) { 3982 3982 int ls = 0;