From 5e22c27b94232371a9dd58abc868439a9e050fec Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 12 May 2021 16:21:50 -0400 Subject: [PATCH] Add experimental bitwise enum config option Only generate the bitwise enumerations when CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build does not generate traces which lead to warnings when viewed with babeltrace 1.x and babeltrace 2 with default options. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: Id54ae3df470b9cdbc0edc0a528fa79532493d1ad --- Kconfig | 11 +++++++++++ Makefile | 24 +++++++++++++++++++++--- README.md | 15 +++++++++++++++ lttng-events.c | 3 +++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/Kconfig b/Kconfig index 0ea35092..abaa4120 100644 --- a/Kconfig +++ b/Kconfig @@ -14,4 +14,15 @@ config LTTNG If unsure, say N. +config LTTNG_EXPERIMENTAL_BITWISE_ENUM + bool "LTTng experimental bitwise enum support" + default n + depends on LTTNG + help + Enable experimental bitwise enumerations. The traces produced with + this option enabled will generate warnings when read by trace + viewers with default options. + + If unsure, say N. + source "lttng/tests/Kconfig" diff --git a/Makefile b/Makefile index a9aff3f1..c6173690 100644 --- a/Makefile +++ b/Makefile @@ -147,18 +147,36 @@ KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) CFLAGS = $(EXTCFLAGS) +# Experimental bitwise enum defaults to disabled. +CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM ?= n + +# Emulate Kconfig behavior of setting defines for config options. +LKCPPFLAGS = $(KCPPFLAGS) +ifeq ($(CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM),y) +LKCPPFLAGS += -DCONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM=y +endif + default: modules modules: - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules + $(MAKE) -C $(KERNELDIR) M=$(PWD) \ + CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ + KCPPFLAGS='$(LKCPPFLAGS)' \ + modules modules_install: - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install + $(MAKE) -C $(KERNELDIR) M=$(PWD) \ + CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ + KCPPFLAGS='$(LKCPPFLAGS)' \ + modules_install clean: $(MAKE) -C $(KERNELDIR) M=$(PWD) clean %.i: %.c - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@ + $(MAKE) -C $(KERNELDIR) M=$(PWD) \ + CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ + KCPPFLAGS='$(LKCPPFLAGS)' \ + $@ endif # KERNELRELEASE diff --git a/README.md b/README.md index 7b04cd83..fc083249 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,21 @@ available from LTTng: - `CONFIG_KALLSYMS_ALL`: state dump of mapping between block device number and name +### LTTng specific kernel config options + +The following kernel configuration options are provided by LTTng: + + - `CONFIG_LTTNG`: Build LTTng (Defaults to 'm'). + - `CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM`: Enable the experimental bitwise + enumerations (Defaults to 'n'). This can be enabled by building with: + + make CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM=y + + - `CONFIG_LTTNG_CLOCK_PLUGIN_TEST`: Build the test clock plugin (Defaults to + 'm'). This plugin overrides the trace clock and should always be built as a + module for testing. + + Customization/Extension ----------------------- diff --git a/lttng-events.c b/lttng-events.c index 3450fa40..dfd112ab 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -3096,6 +3096,9 @@ static int __init lttng_events_init(void) #else ""); #endif +#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM + printk(KERN_NOTICE "LTTng: Experimental bitwise enum enabled.\n"); +#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ return 0; error_hotplug: -- 2.34.1