Steven Rostedt (Red Hat)
0c564a538a
tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values
...
Several tracepoints use the helper functions __print_symbolic() or
__print_flags() and pass in enums that do the mapping between the
binary data stored and the value to print. This works well for reading
the ASCII trace files, but when the data is read via userspace tools
such as perf and trace-cmd, the conversion of the binary value to a
human string format is lost if an enum is used, as userspace does not
have access to what the ENUM is.
For example, the tracepoint trace_tlb_flush() has:
__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" })
Which maps the enum values to the strings they represent. But perf and
trace-cmd do no know what value TLB_LOCAL_MM_SHOOTDOWN is, and would
not be able to map it.
With TRACE_DEFINE_ENUM(), developers can place these in the event header
files and ftrace will convert the enums to their values:
By 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);
$ cat /sys/kernel/debug/tracing/events/tlb/tlb_flush/format
[...]
__print_symbolic(REC->reason,
{ 0, "flush on task switch" },
{ 1, "remote shootdown" },
{ 2, "local shootdown" },
{ 3, "local mm shootdown" })
The above is what userspace expects to see, and tools do not need to
be modified to parse them.
Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org
Cc: Guilherme Cox <cox@computer.org>
Cc: Tony Luck <tony.luck@gmail.com>
Cc: Xie XiuQi <xiexiuqi@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-04-08 09:39:56 -04:00
..
bitops
arch: Mass conversion of smp_mb__*()
2014-04-18 14:20:48 +02:00
4level-fixup.h
mm, asm-generic: define PUD_SHIFT in <asm-generic/4level-fixup.h>
2015-02-11 17:06:03 -08:00
atomic-long.h
atomic.h
locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read()
2014-10-03 06:06:23 +02:00
atomic64.h
locking,arch: Rewrite generic atomic support
2014-08-14 12:48:14 +02:00
audit_change_attr.h
audit: Modify a set of system calls in audit class definitions
2014-01-17 17:01:46 -05:00
audit_dir_write.h
audit_read.h
audit_signal.h
audit_write.h
audit: Modify a set of system calls in audit class definitions
2014-01-17 17:01:46 -05:00
barrier.h
arch: Add lightweight memory barriers dma_rmb() and dma_wmb()
2014-12-11 21:15:06 -05:00
bitops.h
arch: Prepare for smp_mb__{before,after}_atomic()
2014-04-18 11:40:30 +02:00
bitsperlong.h
bug.h
bug: Make BUG() always stop the machine
2014-04-07 16:36:10 -07:00
bugs.h
cache.h
cacheflush.h
checksum.h
clkdev.h
asm-generic: COMMON_CLK defines __clk_{get,put}
2014-09-25 18:00:45 -07:00
cmpxchg-local.h
LLVMLinux: Remove warning about returning an uninitialized variable
2014-04-09 13:44:35 -07:00
cmpxchg.h
cputime.h
cputime_jiffies.h
sched, time: Fix build error with 64 bit cputime_t on 32 bit systems
2014-10-03 05:46:55 +02:00
cputime_nsecs.h
sched, time: Fix build error with 64 bit cputime_t on 32 bit systems
2014-10-03 05:46:55 +02:00
current.h
delay.h
device.h
div64.h
dma-coherent.h
DMA-API: Change dma_declare_coherent_memory() CPU address to phys_addr_t
2014-05-20 16:55:23 -06:00
dma-contiguous.h
asm-generic: Add dma-contiguous.h
2014-09-22 13:35:51 +02:00
dma-mapping-broken.h
dma-mapping-common.h
Merge branch 'for-v3.18' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
2014-10-10 16:56:08 -04:00
dma.h
early_ioremap.h
mm: create generic early_ioremap() support
2014-04-07 16:36:15 -07:00
emergency-restart.h
exec.h
fb.h
fixmap.h
arm64: fixmap: fix missing sub-page offset for earlyprintk
2014-05-03 22:20:31 +01:00
ftrace.h
futex.h
asm-generic: add generic futex for !CONFIG_SMP
2014-12-08 12:55:48 +08:00
getorder.h
gpio.h
gpio: Increase ARCH_NR_GPIOs to 512
2014-09-23 17:51:39 +02:00
hardirq.h
hugetlb.h
mm: Fix generic hugetlb pte check return type.
2013-10-02 20:02:35 -04:00
hw_irq.h
ide_iops.h
int-ll64.h
io-64-nonatomic-hi-lo.h
readq/writeq: Add explicit lo_hi_[read|write]_q and hi_lo_[read|write]_q
2014-07-04 13:27:30 +02:00
io-64-nonatomic-lo-hi.h
readq/writeq: Add explicit lo_hi_[read|write]_q and hi_lo_[read|write]_q
2014-07-04 13:27:30 +02:00
io.h
Merge branch 'io' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into asm-generic
2014-11-11 19:55:45 +01:00
ioctl.h
include/asm-generic/ioctl.h: fix _IOC_TYPECHECK sparse error
2014-06-06 16:08:13 -07:00
iomap.h
Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP
2014-04-07 16:36:11 -07:00
irq.h
irq_regs.h
irq_work.h
irq_work: Introduce arch_irq_work_has_interrupt()
2014-09-13 18:38:07 +02:00
irqflags.h
Kbuild.asm
kdebug.h
kmap_types.h
kvm_para.h
KVM: add kvm_para_available to asm-generic/kvm_para.h
2013-06-05 13:21:29 +03:00
libata-portmap.h
linkage.h
local.h
local64.h
mcs_spinlock.h
locking/mcs: Allow architecture specific asm files to be used for contended case
2014-02-09 21:18:52 +01:00
memory_model.h
__page_to_pfn: Fix typo in comment
2013-10-14 15:28:29 +02:00
mm_hooks.h
mm: Make arch_unmap()/bprm_mm_init() available to all architectures
2014-11-19 11:54:13 +01:00
mmu.h
mmu_context.h
asm-generic: Remove asm-generic arch_bprm_mm_init()
2014-11-22 21:52:08 +01:00
module.h
msi.h
asm-generic: Add msi.h
2014-11-23 13:01:47 +01:00
mutex-dec.h
arch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not
2013-06-26 12:10:55 +02:00
mutex-null.h
arch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not
2013-06-26 12:10:55 +02:00
mutex-xchg.h
arch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not
2013-06-26 12:10:55 +02:00
mutex.h
page.h
param.h
parport.h
pci-bridge.h
pci-dma-compat.h
pci-dma-compat: add pci_zalloc_consistent helper
2014-08-08 15:57:28 -07:00
pci.h
pci_iomap.h
pci: add pci_iomap_range
2015-01-21 16:28:49 +10:30
percpu.h
percpu: preffity percpu header files
2014-06-17 19:12:40 -04:00
pgalloc.h
pgtable-nopmd.h
pgtable-nopud.h
pgtable.h
mm: remove remaining references to NUMA hinting bits and helpers
2015-02-12 18:54:08 -08:00
preempt.h
sched: Kill task_preempt_count()
2014-10-28 10:47:56 +01:00
ptrace.h
qrwlock.h
locking/rwlocks: Introduce 'qrwlocks' - fair, queued rwlocks
2014-06-06 07:58:28 +02:00
qrwlock_types.h
locking/rwlocks: Introduce 'qrwlocks' - fair, queued rwlocks
2014-06-06 07:58:28 +02:00
resource.h
asm-generic: remove _STK_LIM_MAX
2014-05-15 00:32:09 +01:00
rtc.h
rwsem.h
asm-generic: rwsem: de-PPCify rwsem.h
2014-03-14 18:02:08 +00:00
scatterlist.h
seccomp.h
asm-generic: add generic seccomp.h for secure computing mode 1
2014-11-28 10:24:58 +00:00
sections.h
nosave: consolidate __nosave_{begin,end} in <asm/sections.h>
2014-10-09 22:26:04 -04:00
segment.h
serial.h
siginfo.h
constify copy_siginfo_to_user{,32}()
2013-11-09 00:16:29 -05:00
signal.h
simd.h
crypto: create generic version of ablk_helper
2013-09-24 06:02:24 +10:00
sizes.h
spinlock.h
statfs.h
string.h
switch_to.h
syscall.h
syscall.h: fix doc text for syscall_get_arch()
2014-09-23 16:20:00 -04:00
syscalls.h
termios-base.h
termios.h
timex.h
tlb.h
mm: mmu_gather: use tlb->end != 0 only for TLB invalidation
2015-01-13 15:20:40 +13:00
tlbflush.h
topology.h
trace_clock.h
uaccess-unaligned.h
uaccess.h
asm-generic: uaccess: Spelling s/a ny/any/
2014-01-02 10:45:23 +01:00
unaligned.h
asm-generic: allow generic unaligned access if the arch supports it
2014-05-08 10:22:23 +02:00
unistd.h
We get rid of the general module prefix confusion with a binary config option,
2013-05-05 10:58:06 -07:00
user.h
vga.h
vmlinux.lds.h
tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values
2015-04-08 09:39:56 -04:00
vtime.h
include/asm-generic/vtime.h: avoid zero-length file
2013-09-30 14:31:02 -07:00
word-at-a-time.h
word-at-a-time: simplify big-endian zero_bytemask macro
2014-05-01 08:57:44 -07:00
xor.h