Skip to content

Commit eeee78c

Browse files
committed
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 ...
2 parents 3f3c73d + 9828413 commit eeee78c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1959
-909
lines changed

arch/s390/kvm/trace-s390.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
#undef TRACE_INCLUDE_FILE
1010
#define TRACE_INCLUDE_FILE trace-s390
1111

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+
1219
/*
1320
* Trace point for the creation of the kvm instance.
1421
*/

drivers/gpu/drm/drm_trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#undef TRACE_SYSTEM
99
#define TRACE_SYSTEM drm
10-
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
1110
#define TRACE_INCLUDE_FILE drm_trace
1211

1312
TRACE_EVENT(drm_vblank_event,

drivers/gpu/drm/i915/i915_trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#undef TRACE_SYSTEM
1414
#define TRACE_SYSTEM i915
15-
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
1615
#define TRACE_INCLUDE_FILE i915_trace
1716

1817
/* pipe updates */

drivers/gpu/drm/radeon/radeon_trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#undef TRACE_SYSTEM
1111
#define TRACE_SYSTEM radeon
12-
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
1312
#define TRACE_INCLUDE_FILE radeon_trace
1413

1514
TRACE_EVENT(radeon_bo_create,
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 */
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 */
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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 */

0 commit comments

Comments
 (0)