Skip to content

Commit

Permalink
Merge tag 'trace-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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
  ...
  • Loading branch information
torvalds committed Apr 14, 2015
2 parents 3f3c73d + 9828413 commit eeee78c
Show file tree
Hide file tree
Showing 52 changed files with 1,959 additions and 909 deletions.
7 changes: 7 additions & 0 deletions arch/s390/kvm/trace-s390.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace-s390

/*
* The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
* legitimate C variable. It is not exported to user space.
*/
#undef TRACE_SYSTEM_VAR
#define TRACE_SYSTEM_VAR kvm_s390

/*
* Trace point for the creation of the kvm instance.
*/
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/drm_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#undef TRACE_SYSTEM
#define TRACE_SYSTEM drm
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE drm_trace

TRACE_EVENT(drm_vblank_event,
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/i915/i915_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#undef TRACE_SYSTEM
#define TRACE_SYSTEM i915
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE i915_trace

/* pipe updates */
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/radeon/radeon_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#undef TRACE_SYSTEM
#define TRACE_SYSTEM radeon
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE radeon_trace

TRACE_EVENT(radeon_bo_create,
Expand Down
102 changes: 102 additions & 0 deletions drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ)
#define __TRACE_BRCMSMAC_H

#include <linux/tracepoint.h>

#undef TRACE_SYSTEM
#define TRACE_SYSTEM brcmsmac

/*
* We define a tracepoint, its arguments, its printk format and its
* 'fast binary record' layout.
*/
TRACE_EVENT(brcms_timer,
/* TPPROTO is the prototype of the function called by this tracepoint */
TP_PROTO(struct brcms_timer *t),
/*
* TPARGS(firstarg, p) are the parameters names, same as found in the
* prototype.
*/
TP_ARGS(t),
/*
* Fast binary tracing: define the trace record via TP_STRUCT__entry().
* You can think about it like a regular C structure local variable
* definition.
*/
TP_STRUCT__entry(
__field(uint, ms)
__field(uint, set)
__field(uint, periodic)
),
TP_fast_assign(
__entry->ms = t->ms;
__entry->set = t->set;
__entry->periodic = t->periodic;
),
TP_printk(
"ms=%u set=%u periodic=%u",
__entry->ms, __entry->set, __entry->periodic
)
);

TRACE_EVENT(brcms_dpc,
TP_PROTO(unsigned long data),
TP_ARGS(data),
TP_STRUCT__entry(
__field(unsigned long, data)
),
TP_fast_assign(
__entry->data = data;
),
TP_printk(
"data=%p",
(void *)__entry->data
)
);

TRACE_EVENT(brcms_macintstatus,
TP_PROTO(const struct device *dev, int in_isr, u32 macintstatus,
u32 mask),
TP_ARGS(dev, in_isr, macintstatus, mask),
TP_STRUCT__entry(
__string(dev, dev_name(dev))
__field(int, in_isr)
__field(u32, macintstatus)
__field(u32, mask)
),
TP_fast_assign(
__assign_str(dev, dev_name(dev));
__entry->in_isr = in_isr;
__entry->macintstatus = macintstatus;
__entry->mask = mask;
),
TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev),
__entry->in_isr, __entry->macintstatus, __entry->mask)
);
#endif /* __TRACE_BRCMSMAC_H */

#ifdef CONFIG_BRCM_TRACING

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE brcms_trace_brcmsmac
#include <trace/define_trace.h>

#endif /* CONFIG_BRCM_TRACING */
88 changes: 88 additions & 0 deletions drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#if !defined(__TRACE_BRCMSMAC_MSG_H) || defined(TRACE_HEADER_MULTI_READ)
#define __TRACE_BRCMSMAC_MSG_H

#include <linux/tracepoint.h>

#undef TRACE_SYSTEM
#define TRACE_SYSTEM brcmsmac_msg

#define MAX_MSG_LEN 100

DECLARE_EVENT_CLASS(brcms_msg_event,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf),
TP_STRUCT__entry(
__dynamic_array(char, msg, MAX_MSG_LEN)
),
TP_fast_assign(
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
),
TP_printk("%s", __get_str(msg))
);

DEFINE_EVENT(brcms_msg_event, brcms_info,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);

DEFINE_EVENT(brcms_msg_event, brcms_warn,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);

DEFINE_EVENT(brcms_msg_event, brcms_err,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);

DEFINE_EVENT(brcms_msg_event, brcms_crit,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);

TRACE_EVENT(brcms_dbg,
TP_PROTO(u32 level, const char *func, struct va_format *vaf),
TP_ARGS(level, func, vaf),
TP_STRUCT__entry(
__field(u32, level)
__string(func, func)
__dynamic_array(char, msg, MAX_MSG_LEN)
),
TP_fast_assign(
__entry->level = level;
__assign_str(func, func);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
),
TP_printk("%s: %s", __get_str(func), __get_str(msg))
);
#endif /* __TRACE_BRCMSMAC_MSG_H */

#ifdef CONFIG_BRCM_TRACING

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_msg
#include <trace/define_trace.h>

#endif /* CONFIG_BRCM_TRACING */
110 changes: 110 additions & 0 deletions drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#if !defined(__TRACE_BRCMSMAC_TX_H) || defined(TRACE_HEADER_MULTI_READ)
#define __TRACE_BRCMSMAC_TX_H

#include <linux/tracepoint.h>

#undef TRACE_SYSTEM
#define TRACE_SYSTEM brcmsmac_tx

TRACE_EVENT(brcms_txdesc,
TP_PROTO(const struct device *dev,
void *txh, size_t txh_len),
TP_ARGS(dev, txh, txh_len),
TP_STRUCT__entry(
__string(dev, dev_name(dev))
__dynamic_array(u8, txh, txh_len)
),
TP_fast_assign(
__assign_str(dev, dev_name(dev));
memcpy(__get_dynamic_array(txh), txh, txh_len);
),
TP_printk("[%s] txdesc", __get_str(dev))
);

TRACE_EVENT(brcms_txstatus,
TP_PROTO(const struct device *dev, u16 framelen, u16 frameid,
u16 status, u16 lasttxtime, u16 sequence, u16 phyerr,
u16 ackphyrxsh),
TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr,
ackphyrxsh),
TP_STRUCT__entry(
__string(dev, dev_name(dev))
__field(u16, framelen)
__field(u16, frameid)
__field(u16, status)
__field(u16, lasttxtime)
__field(u16, sequence)
__field(u16, phyerr)
__field(u16, ackphyrxsh)
),
TP_fast_assign(
__assign_str(dev, dev_name(dev));
__entry->framelen = framelen;
__entry->frameid = frameid;
__entry->status = status;
__entry->lasttxtime = lasttxtime;
__entry->sequence = sequence;
__entry->phyerr = phyerr;
__entry->ackphyrxsh = ackphyrxsh;
),
TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x "
"Seq %#04x PHYTxStatus %#04x RxAck %#04x",
__get_str(dev), __entry->frameid, __entry->status,
__entry->lasttxtime, __entry->sequence, __entry->phyerr,
__entry->ackphyrxsh)
);

TRACE_EVENT(brcms_ampdu_session,
TP_PROTO(const struct device *dev, unsigned max_ampdu_len,
u16 max_ampdu_frames, u16 ampdu_len, u16 ampdu_frames,
u16 dma_len),
TP_ARGS(dev, max_ampdu_len, max_ampdu_frames, ampdu_len, ampdu_frames,
dma_len),
TP_STRUCT__entry(
__string(dev, dev_name(dev))
__field(unsigned, max_ampdu_len)
__field(u16, max_ampdu_frames)
__field(u16, ampdu_len)
__field(u16, ampdu_frames)
__field(u16, dma_len)
),
TP_fast_assign(
__assign_str(dev, dev_name(dev));
__entry->max_ampdu_len = max_ampdu_len;
__entry->max_ampdu_frames = max_ampdu_frames;
__entry->ampdu_len = ampdu_len;
__entry->ampdu_frames = ampdu_frames;
__entry->dma_len = dma_len;
),
TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u",
__get_str(dev), __entry->max_ampdu_len,
__entry->max_ampdu_frames, __entry->ampdu_len,
__entry->ampdu_frames, __entry->dma_len)
);
#endif /* __TRACE_BRCMSMAC_TX_H */

#ifdef CONFIG_BRCM_TRACING

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_tx
#include <trace/define_trace.h>

#endif /* CONFIG_BRCM_TRACING */
Loading

0 comments on commit eeee78c

Please sign in to comment.