Skip to content

RFC TRACE_EVENT: cleanup for code-size reduction

Mathieu Desnoyers lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest31 of 32 patches 24 repliesIn review

31 of 32 patches are in this archive. The cover letter announces 32.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/32trace event sample remove semicolons, specify need for ifdef around declarationssamples/trace_events/trace-events-sample.h+13 -11 reply
3/32trace event block remove semicolumnsinclude/trace/events/block.h+22 -220 replies
4/32trace event ext4 remove semicolonsinclude/trace/events/ext4.h+74 -690 replies
5/32trace event irq remove semicolonsinclude/trace/events/irq.h+11 -60 replies
6/32trace event jbd2 remove semicolonsinclude/trace/events/jbd2.h+16 -110 replies
7/32trace event kmem remove semicolonsinclude/trace/events/kmem.h+16 -160 replies
8/32trace event kvm remove semicolonsarch/powerpc/kvm/trace.h arch/x86/kvm/mmutrace.h arch/x86/kvm/trace.h +1 more+63 -630 replies
9/32trace event lock remove semicolonsinclude/trace/events/lock.h+5 -50 replies
10/32trace event mce remove semicolonsinclude/trace/events/mce.h+1 -10 replies
11/32trace event module remove semicolonsinclude/trace/events/module.h+11 -60 replies
12/32trace event napi remove semicolonsinclude/trace/events/napi.h+1 -11 reply
13/32trace event net remove semicolonsinclude/trace/events/net.h+4 -41 reply
14/32trace event power remove semicolonsinclude/trace/events/power.h+14 -141 reply
15/32trace event sched remove trailing semicoloninclude/trace/events/sched.h+41 -360 replies
16/32trace event scsi remove semicolonsinclude/trace/events/scsi.h+11 -60 replies
17/32trace event signal remove semicolonsinclude/trace/events/signal.h+5 -50 replies
18/32trace event skb remove semicolonsinclude/trace/events/skb.h+3 -31 reply
19/32trace event syscalls remove semicolonsinclude/trace/events/syscalls.h+7 -20 replies
20/32trace event timer remove semicolonsinclude/trace/events/timer.h+14 -140 replies
21/32trace event vmscan remove semicolonsinclude/trace/events/vmscan.h+16 -160 replies
22/32trace event workqueue remove semicolonsinclude/trace/events/workqueue.h+5 -51 reply
23/32trace event writeback remove semicolonsinclude/trace/events/writeback.h+29 -240 replies
24/32trace event wireless remove semicolonsdrivers/net/wireless/iwlwifi/iwl-devtrace.h drivers/net/wireless/iwmc3200wifi/trace.h net/mac80211/driver-trace.h+76 -760 replies
25/32trace event video gpu remove semicolonsdrivers/gpu/drm/drm_trace.h drivers/gpu/drm/i915/i915_trace.h+29 -290 replies
26/32trace event gfs2 remove semicolonsfs/gfs2/trace_gfs2.h+13 -132 replies
27/32trace event xfs remove semicolonsfs/xfs/linux-2.6/xfs_trace.h+272 -2670 replies
28/32trace event powerpc remove semicolonsarch/powerpc/include/asm/trace.h arch/powerpc/platforms/cell/spufs/sputrace.h+18 -70 replies
29/32trace event asoc remove semicolonsinclude/trace/events/asoc.h+22 -1710 replies
30/32trace event compaction remove semicolonsinclude/trace/events/compaction.h+4 -40 replies
31/32trace event regulator remove semicolonsinclude/trace/events/regulator.h+10 -101 reply
32/32trace event btrfs remove semicolonsinclude/trace/events/btrfs.h+31 -260 replies

Reviews trailers per patch

8 of 31 patches have a Reviewed-by or Acked-by.

PatchSteven WhitehouseTejun HeoNeil Horman[email protected]Mark Brown
2/32
3/32
4/32
5/32
6/32
7/32
8/32
9/32
10/32
11/32
12/32A-b
13/32A-b
14/32A-b
15/32
16/32
17/32
18/32A-b
19/32
20/32
21/32
22/32A-b A-b
23/32
24/32
25/32
26/32A-b
27/32
28/32
29/32A-b
30/32
31/32A-b
32/32

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v1 thread

Cover letter [RFC patch 00/32] TRACE_EVENT: cleanup for code-size reduction

Hi,

I implemented the TRACE_EVENT macros as arrays of fields and arrays of events in LTTng, and realised that it could benefit Ftrace too by cutting down its code size. As I know that code size footprint is an issue Steven has been wanting to tackle for a while, I am sending this "semicolon removal" patchset, which is a prerequisite to be able to generate arrays of events.

The main difference between the approaches Ftrace and LTTng have taken is that Ftrace creates a "ftrace_define_fields_##call" function for each event which calls trace_define_field for each field of each event. In LTTng, I did the following (code snippet from [1]):

struct lttng_event_field {
        const char *name;
        const struct lttng_type type;
};
struct lttng_event_desc {
        const struct lttng_event_field *fields;
        const char *name;
        unsigned int nr_fields;
};

#undef DEFINE_EVENT

#define DEFINE_EVENT(_template, _name, _proto, _args)                          \
                {                                                              \
                        .fields = __event_fields___##_template,                \
                        .name = #_name,                                        \
                        .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
                },

#define TP_ID1(_token, _system) _token##_system #define TP_ID(_token, _system) TP_ID1(_token, _system)

static const struct lttng_event_desc TP_ID(__event_desc___, TRACE_SYSTEM)[] = { #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
};

And for creation of __event_fields___##_template, which allows to keep all fields in another array (which should be defined in a phase prior to the event array definition), I did:

#undef __field

#define __field(_type, _item)                                   \
        { .name = #_item, .type = { .atype = atype_integer, .name = #_type} },

(similar for __field_ext, __array, __dynamic_array, __string)

#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args /* Only one used in this phase */

#undef DECLARE_EVENT_CLASS

#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
        static const struct lttng_event_field __event_fields___##_name[] = { \
                _tstruct \
        };

For the declaration of struct lttng_type, which contains the field type information in a union, see [2].

Best regards,

Mathieu

[1] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-events.h;h=a05c29d56771b89807ffef035b7cd6df34a0b97f;hb=HEAD
[2] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-types.h;h=0192bffaf2f321f446f71a13901e2ab09fd69663;hb=HEAD

Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com