Re: [RFC][PATCH 00/10] tracing: Use TRACE_DEFINE_ENUM() to show enum values

Steven Rostedt
2015-03-31T22:56:33Z

On Wed, 1 Apr 2015 08:30:05 +1100
Dave Chinner <david@fromorbit.com> wrote:

> On Fri, Mar 27, 2015 at 05:37:04PM -0400, Steven Rostedt wrote:
> >
> > As there are many tracepoints that use __print_symbolic() to translate
> > numbers into ASCII strings, and several of these translate enums as
> > well, it causes a problem for user space tools that read the tracepoint
> > format files and have to translate the binary data to their associated
> > strings.
> .....
> > Steven Rostedt (Red Hat) (10):
> > tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values
> > tracing: Allow for modules to export their trace enums as well
> > x86/tlb/trace: Export enums in used by tlb_flush tracepoint
> > net/9p/tracing: Export enums in tracepoints to userspace
> > f2fs: Export the enums in the tracepoints to userspace
> > irq/tracing: Export enums in tracepoints to user space
> > mm: tracing: Export enums in tracepoints to user space
> > SUNRPC: Export enums in tracepoints to user space
> > v4l: Export enums used by tracepoints to user space
> > writeback: Export enums used by tracepoint to user space
>
> So are you expecting subsystem maintainers to modify their tracing
> code to do this, or is this just the first round of changes you are
> making? e.g:
>
> $ grep print_symbolic fs/xfs/xfs_trace.h
> __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
> __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
> __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
> __print_symbolic(__entry->type, XFS_IO_TYPES),
> __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
> __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
> __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
> __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
> __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),

Note, it only is needed for enums. Those look to be macros (#define),
which does not have a problem (the value is shown to userspace, not the
name).

> $
>
> And a quick git grep indicates there are a lot that you haven't
> converted in this patchset...

But yes, I only covered the include/trace/events/*.h files. I'm sure
there's others I would need to update. But this can be done
incrementally.

-- Steve