From f97b3ad7269a3c816469d8aca28145797084ea1e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 29 Dec 2020 17:09:27 -0800 Subject: [PATCH] trace-cmd: update to 2.9.1 Fixed license information. Adjusted Makefile to new install paths. Backported upstream patch to fix compilation with musl. Replaces local and incomplete patch. Signed-off-by: Rosen Penev --- package/devel/trace-cmd/Makefile | 22 ++-- .../devel/trace-cmd/patches/100-musl.patch | 104 ++++++++++++++++++ .../patches/110-mac80211_tracepoint.patch | 10 +- .../devel/trace-cmd/patches/120-limits.patch | 24 ---- 4 files changed, 121 insertions(+), 39 deletions(-) create mode 100644 package/devel/trace-cmd/patches/100-musl.patch delete mode 100644 package/devel/trace-cmd/patches/120-limits.patch diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile index d1f73ae9bb..e15b04ad23 100644 --- a/package/devel/trace-cmd/Makefile +++ b/package/devel/trace-cmd/Makefile @@ -1,16 +1,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=trace-cmd -PKG_VERSION:=v2.6.1 -PKG_RELEASE:=3 +PKG_VERSION:=v2.9.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/ -PKG_HASH:=4eb79001778a77c0ada10265e7f4b5515a3e21a46f0a15c2e8cc614efdf3f5df +PKG_HASH:=9404fc3cf540ea795304608068c9db6cdb38b90584c7f3c43249785913d54b38 + +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=COPYING + PKG_INSTALL:=1 PKG_USE_MIPS16:=0 -PKG_LICENSE:=GPL-2.0 - PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -34,27 +36,27 @@ MAKE_FLAGS += \ NO_AUDIT=1 \ prefix=/usr -PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins +PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/traceevent/plugins PLUGINS_MAIN := function hrtimer mac80211 sched_switch TARGET_CFLAGS += --std=gnu99 -D_GNU_SOURCE define Package/trace-cmd/install - $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/trace-cmd/plugins + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/traceevent/plugins $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trace-cmd $(1)/usr/bin/ $(CP) \ $(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_MAIN)) \ - $(1)/usr/lib/trace-cmd/plugins + $(1)/usr/lib/traceevent/plugins endef define Package/trace-cmd-extra/install - $(INSTALL_DIR) $(1)/usr/lib/trace-cmd/plugins + $(INSTALL_DIR) $(1)/usr/lib/traceevent/plugins $(CP) \ $$(patsubst %,$(PLUGINS_DIR)/plugin_%.so, \ $$(filter-out $(PLUGINS_MAIN), \ $$(patsubst $(PLUGINS_DIR)/plugin_%.so,%, \ $$(wildcard $(PLUGINS_DIR)/plugin_*.so)))) \ - $(1)/usr/lib/trace-cmd/plugins + $(1)/usr/lib/traceevent/plugins endef $(eval $(call BuildPackage,trace-cmd)) diff --git a/package/devel/trace-cmd/patches/100-musl.patch b/package/devel/trace-cmd/patches/100-musl.patch new file mode 100644 index 0000000000..80b419eb82 --- /dev/null +++ b/package/devel/trace-cmd/patches/100-musl.patch @@ -0,0 +1,104 @@ +From 1a000636c1828eecdcec5360a51623ef4ffbff04 Mon Sep 17 00:00:00 2001 +From: Beniamin Sandu +Date: Mon, 30 Nov 2020 14:27:55 +0200 +Subject: trace-cmd: make it build against musl C library + +* add some missing headers and macros +* set pthread affinity using pthread_setaffinity_np after creating the thread +instead of pthread_attr_setaffinity_np (which seems to not be implemented +in musl) + +Tested using https://musl.cc/x86_64-linux-musl-native.tgz + +Link: https://lore.kernel.org/linux-trace-devel/20201130122755.31000-1-beniaminsandu@gmail.com + +Reviewed-by: Tzvetomir Stoyanov (VMware) +Signed-off-by: Beniamin Sandu +[ Fixed a whitespace issue ] +Signed-off-by: Steven Rostedt (VMware) +--- + include/trace-cmd/trace-cmd.h | 1 + + lib/trace-cmd/include/trace-cmd-local.h | 1 + + lib/tracefs/tracefs-events.c | 1 + + tracecmd/include/trace-local.h | 1 + + tracecmd/trace-tsync.c | 16 +++++++++++----- + 5 files changed, 20 insertions(+), 5 deletions(-) + +--- a/include/trace-cmd/trace-cmd.h ++++ b/include/trace-cmd/trace-cmd.h +@@ -6,6 +6,7 @@ + #ifndef _TRACE_CMD_H + #define _TRACE_CMD_H + ++#include + #include "traceevent/event-parse.h" + + #define TRACECMD_MAGIC { 23, 8, 68 } +--- a/lib/trace-cmd/include/trace-cmd-local.h ++++ b/lib/trace-cmd/include/trace-cmd-local.h +@@ -26,5 +26,6 @@ void warning(const char *fmt, ...); + #endif + #endif + ++#include + + #endif /* _TRACE_CMD_LOCAL_H */ +--- a/lib/tracefs/tracefs-events.c ++++ b/lib/tracefs/tracefs-events.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #include "kbuffer.h" + #include "tracefs.h" +--- a/tracecmd/include/trace-local.h ++++ b/tracecmd/include/trace-local.h +@@ -8,6 +8,7 @@ + + #include + #include /* for DIR */ ++#include + + #include "trace-cmd.h" + #include "event-utils.h" +--- a/tracecmd/trace-tsync.c ++++ b/tracecmd/trace-tsync.c +@@ -104,13 +104,16 @@ int tracecmd_host_tsync(struct buffer_in + + pthread_attr_init(&attrib); + pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE); +- if (!get_first_cpu(&pin_mask, &mask_size)) +- pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask); + + ret = pthread_create(&instance->tsync_thread, &attrib, + tsync_host_thread, &instance->tsync); +- if (!ret) ++ ++ if (!ret) { ++ if (!get_first_cpu(&pin_mask, &mask_size)) ++ pthread_setaffinity_np(instance->tsync_thread, mask_size, pin_mask); + instance->tsync_thread_running = true; ++ } ++ + if (pin_mask) + CPU_FREE(pin_mask); + pthread_attr_destroy(&attrib); +@@ -243,11 +246,14 @@ unsigned int tracecmd_guest_tsync(char * + pthread_attr_init(&attrib); + tsync->sync_proto = proto; + pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE); +- if (!get_first_cpu(&pin_mask, &mask_size)) +- pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask); + + ret = pthread_create(thr_id, &attrib, tsync_agent_thread, tsync); + ++ if (!ret) { ++ if (!get_first_cpu(&pin_mask, &mask_size)) ++ pthread_setaffinity_np(*thr_id, mask_size, pin_mask); ++ } ++ + if (pin_mask) + CPU_FREE(pin_mask); + pthread_attr_destroy(&attrib); diff --git a/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch b/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch index e2a68972a3..cffcaa06b5 100644 --- a/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch +++ b/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch @@ -1,16 +1,16 @@ ---- a/plugin_mac80211.c -+++ b/plugin_mac80211.c -@@ -179,12 +179,15 @@ static int drv_config(struct trace_seq * +--- a/lib/traceevent/plugins/plugin_mac80211.c ++++ b/lib/traceevent/plugins/plugin_mac80211.c +@@ -165,12 +165,15 @@ static int drv_config(struct trace_seq * { 2, "IDLE" }, { 3, "QOS"}, ); -- pevent_print_num_field(s, " chan:%d/", event, "center_freq", record, 1); +- tep_print_num_field(s, " chan:%d/", event, "center_freq", record, 1); - print_enum(s, event, "channel_type", data, - { 0, "noht" }, - { 1, "ht20" }, - { 2, "ht40-" }, - { 3, "ht40+" }); -+ pevent_print_num_field(s, " chan:%d@", event, "control_freq", record, 1); ++ tep_print_num_field(s, " chan:%d@", event, "control_freq", record, 1); + print_enum(s, event, "chan_width", data, + { 0, "20_noht" }, + { 1, "20" }, diff --git a/package/devel/trace-cmd/patches/120-limits.patch b/package/devel/trace-cmd/patches/120-limits.patch deleted file mode 100644 index b9d91cc03e..0000000000 --- a/package/devel/trace-cmd/patches/120-limits.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 293ff6d5bc9d3b8bfbc3c57d20d3d2d00986c168 Mon Sep 17 00:00:00 2001 -From: Alexander Couzens -Date: Sun, 26 Nov 2017 05:22:51 +0100 -Subject: [PATCH] trace-cmd listen: Include limits.h to define PATH_MAX - -PATH_MAX is defined by limits.h. On some system it's also -defined by dirent.h but not on musl. - -Signed-off-by: Alexander Couzens -Signed-off-by: Steven Rostedt (VMware) ---- - trace-listen.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/trace-listen.c -+++ b/trace-listen.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -- 2.30.2