From f73c5a4351807e11db1f69606cbeee3fabf847e6 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. Change-Id: Id45c7a78b280a7f35bbeafb80f2f6f5aa1ebbdc9 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- Makefile | 29 +++++++++++++++++++++++++---- README.md | 15 +++++++++++++++ src/Kconfig | 11 +++++++++++ src/lttng-events.c | 3 +++ 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3974ce8b..81bdedac 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,28 @@ else # KERNELRELEASE KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) +# 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)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src \ + CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ + KCPPFLAGS='$(LKCPPFLAGS)' \ + modules modules_install: - $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src \ + CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ + KCPPFLAGS='$(LKCPPFLAGS)' \ + modules_install clean: $(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean @@ -30,9 +45,15 @@ clean: # The following targets are used for development and debugging. They are not # part of the build system. %.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)' \ + $@ %.o: %.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/src/Kconfig b/src/Kconfig index e42e25e6..a2a7b8f1 100644 --- a/src/Kconfig +++ b/src/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/src/tests/Kconfig" diff --git a/src/lttng-events.c b/src/lttng-events.c index 89257bd6..af20bfcc 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -4362,6 +4362,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