Skip to content

Commit 077faf3

Browse files
tzstoyanovacmel
authored andcommitted
libtraceevent: Move traceevent plugins in its own subdirectory
All traceevent plugins code is moved to tools/lib/traceevent/plugins subdirectory. It makes traceevent implementation in trace-cmd and in kernel tree consistent. There is no changes in the way libtraceevent and plugins are compiled and installed. Committer notes: Applied fixup provided by Steven, fixing the tools/perf/Makefile.perf target for the plugin dynamic list file. Problem noticed when cross building to aarch64 from a Ubuntu 19.04 container. Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: linux-trace-devel@vger.kernel.org Link: http://lore.kernel.org/lkml/20190923115929.453b68f1@oasis.local.home Link: http://lore.kernel.org/lkml/20190919212542.377333393@goodmis.org Link: http://lore.kernel.org/linux-trace-devel/20190917105055.18983-1-tz.stoyanov@gmail.com Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent d69094f commit 077faf3

15 files changed

Lines changed: 250 additions & 91 deletions

‎tools/lib/traceevent/Build‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,3 @@ libtraceevent-y += parse-utils.o
66
libtraceevent-y += kbuffer-parse.o
77
libtraceevent-y += tep_strerror.o
88
libtraceevent-y += event-parse-api.o
9-
10-
plugin_jbd2-y += plugin_jbd2.o
11-
plugin_hrtimer-y += plugin_hrtimer.o
12-
plugin_kmem-y += plugin_kmem.o
13-
plugin_kvm-y += plugin_kvm.o
14-
plugin_mac80211-y += plugin_mac80211.o
15-
plugin_sched_switch-y += plugin_sched_switch.o
16-
plugin_function-y += plugin_function.o
17-
plugin_xen-y += plugin_xen.o
18-
plugin_scsi-y += plugin_scsi.o
19-
plugin_cfg80211-y += plugin_cfg80211.o

‎tools/lib/traceevent/Makefile‎

Lines changed: 16 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,6 @@ export man_dir man_dir_SQ INSTALL
5858
export DESTDIR DESTDIR_SQ
5959
export EVENT_PARSE_VERSION
6060

61-
set_plugin_dir := 1
62-
63-
# Set plugin_dir to preffered global plugin location
64-
# If we install under $HOME directory we go under
65-
# $(HOME)/.local/lib/traceevent/plugins
66-
#
67-
# We dont set PLUGIN_DIR in case we install under $HOME
68-
# directory, because by default the code looks under:
69-
# $(HOME)/.local/lib/traceevent/plugins by default.
70-
#
71-
ifeq ($(plugin_dir),)
72-
ifeq ($(prefix),$(HOME))
73-
override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
74-
set_plugin_dir := 0
75-
else
76-
override plugin_dir = $(libdir)/traceevent/plugins
77-
endif
78-
endif
79-
80-
ifeq ($(set_plugin_dir),1)
81-
PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
82-
PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
83-
endif
84-
8561
include ../../scripts/Makefile.include
8662

8763
# copy a bit from Linux kbuild
@@ -105,7 +81,6 @@ export prefix libdir src obj
10581
# Shell quotes
10682
libdir_SQ = $(subst ','\'',$(libdir))
10783
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
108-
plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
10984

11085
CONFIG_INCLUDES =
11186
CONFIG_LIBS =
@@ -151,29 +126,14 @@ MAKEOVERRIDES=
151126
export srctree OUTPUT CC LD CFLAGS V
152127
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
153128

154-
PLUGINS = plugin_jbd2.so
155-
PLUGINS += plugin_hrtimer.so
156-
PLUGINS += plugin_kmem.so
157-
PLUGINS += plugin_kvm.so
158-
PLUGINS += plugin_mac80211.so
159-
PLUGINS += plugin_sched_switch.so
160-
PLUGINS += plugin_function.so
161-
PLUGINS += plugin_xen.so
162-
PLUGINS += plugin_scsi.so
163-
PLUGINS += plugin_cfg80211.so
164-
165-
PLUGINS := $(addprefix $(OUTPUT),$(PLUGINS))
166-
PLUGINS_IN := $(PLUGINS:.so=-in.o)
167-
168129
TE_IN := $(OUTPUT)libtraceevent-in.o
169130
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
170-
DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
171131

172-
CMD_TARGETS = $(LIB_TARGET) $(PLUGINS) $(DYNAMIC_LIST_FILE)
132+
CMD_TARGETS = $(LIB_TARGET)
173133

174134
TARGETS = $(CMD_TARGETS)
175135

176-
all: all_cmd
136+
all: all_cmd plugins
177137

178138
all_cmd: $(CMD_TARGETS)
179139

@@ -188,17 +148,6 @@ $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
188148
$(OUTPUT)libtraceevent.a: $(TE_IN)
189149
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
190150

191-
$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
192-
$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)
193-
194-
plugins: $(PLUGINS)
195-
196-
__plugin_obj = $(notdir $@)
197-
plugin_obj = $(__plugin_obj:-in.o=)
198-
199-
$(PLUGINS_IN): force
200-
$(Q)$(MAKE) $(build)=$(plugin_obj)
201-
202151
$(OUTPUT)%.so: $(OUTPUT)%-in.o
203152
$(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^
204153

@@ -258,25 +207,6 @@ define do_install
258207
$(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2'
259208
endef
260209

261-
define do_install_plugins
262-
for plugin in $1; do \
263-
$(call do_install,$$plugin,$(plugin_dir_SQ)); \
264-
done
265-
endef
266-
267-
define do_generate_dynamic_list_file
268-
symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
269-
xargs echo "U w W" | tr 'w ' 'W\n' | sort -u | xargs echo`;\
270-
if [ "$$symbol_type" = "U W" ];then \
271-
(echo '{'; \
272-
$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
273-
echo '};'; \
274-
) > $2; \
275-
else \
276-
(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
277-
fi
278-
endef
279-
280210
PKG_CONFIG_FILE = libtraceevent.pc
281211
define do_install_pkgconfig_file
282212
if [ -n "${pkgconfig_dir}" ]; then \
@@ -296,10 +226,6 @@ install_lib: all_cmd install_plugins install_headers install_pkgconfig
296226
$(call do_install_mkdir,$(libdir_SQ)); \
297227
cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
298228

299-
install_plugins: $(PLUGINS)
300-
$(call QUIET_INSTALL, trace_plugins) \
301-
$(call do_install_plugins, $(PLUGINS))
302-
303229
install_pkgconfig:
304230
$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
305231
$(call do_install_pkgconfig_file,$(prefix))
@@ -313,7 +239,7 @@ install_headers:
313239

314240
install: install_lib
315241

316-
clean:
242+
clean: clean_plugins
317243
$(call QUIET_CLEAN, libtraceevent) \
318244
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
319245
$(RM) TRACEEVENT-CFLAGS tags TAGS; \
@@ -351,7 +277,19 @@ help:
351277
@echo ' doc-install - install the man pages'
352278
@echo ' doc-uninstall - uninstall the man pages'
353279
@echo''
354-
PHONY += force plugins
280+
281+
PHONY += plugins
282+
plugins:
283+
$(call descend,plugins)
284+
285+
PHONY += install_plugins
286+
install_plugins:
287+
$(call descend,plugins,install)
288+
289+
PHONY += clean_plugins
290+
clean_plugins:
291+
$(call descend,plugins,clean)
292+
355293
force:
356294

357295
# Declare the contents of the .PHONY variable as phony. We keep that

‎tools/lib/traceevent/plugins/Build‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
plugin_jbd2-y += plugin_jbd2.o
2+
plugin_hrtimer-y += plugin_hrtimer.o
3+
plugin_kmem-y += plugin_kmem.o
4+
plugin_kvm-y += plugin_kvm.o
5+
plugin_mac80211-y += plugin_mac80211.o
6+
plugin_sched_switch-y += plugin_sched_switch.o
7+
plugin_function-y += plugin_function.o
8+
plugin_xen-y += plugin_xen.o
9+
plugin_scsi-y += plugin_scsi.o
10+
plugin_cfg80211-y += plugin_cfg80211.o

0 commit comments

Comments
 (0)