* [PATCH v2 1/3] libtracefs utest: Only use online CPUs during tests
2026-09-23 20:56 ` [PATCH v2 0/3] Ubuntu patches Benjamin Drung
@ 2026-09-23 20:56 ` Benjamin Drung
2026-09-23 20:56 ` [PATCH v2 2/3] libtracefs: Use LIBTRACEFS_STATIC for utest Benjamin Drung
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Benjamin Drung @ 2026-09-23 20:56 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Adrien Nader, Benjamin Drung
From: Adrien Nader <adrien.nader@canonical.com>
We cannot do operations over offline cores. Virtual machines can
routinely announce the presence of all of the host's cores and only make
some of them online.
This change assumes that all the online CPUs are continuously numbered
and start at 0. While this is not perfect, it is still an improvement
and might be enough, especially considering this touches tests only.
Signed-off-by: Adrien Nader <adrien.nader@canonical.com>
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
---
utest/tracefs-utest.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index e3ff215..665c7d9 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -181,7 +181,7 @@ static void save_affinity(void)
{
int cpus;
- cpus = sysconf(_SC_NPROCESSORS_CONF);
+ cpus = sysconf(_SC_NPROCESSORS_ONLN);
cpuset_save = CPU_ALLOC(cpus);
cpuset = CPU_ALLOC(cpus);
cpu_size = CPU_ALLOC_SIZE(cpus);
@@ -216,7 +216,7 @@ static void test_iter_write(struct tracefs_instance *instance)
int cpus;
int ret;
- cpus = sysconf(_SC_NPROCESSORS_CONF);
+ cpus = sysconf(_SC_NPROCESSORS_ONLN);
save_affinity();
path = tracefs_instance_get_file(instance, "trace_marker");
@@ -243,7 +243,7 @@ static void test_iter_write(struct tracefs_instance *instance)
static void iter_raw_events_on_cpu(struct tracefs_instance *instance, int cpu, bool snapshot)
{
- int cpus = sysconf(_SC_NPROCESSORS_CONF);
+ int cpus = sysconf(_SC_NPROCESSORS_ONLN);
cpu_set_t *cpuset = NULL;
int cpu_size = 0;
int check = 0;
@@ -292,7 +292,7 @@ static void iter_raw_events_on_cpu(struct tracefs_instance *instance, int cpu, b
static void test_instance_iter_raw_events(struct tracefs_instance *instance)
{
- int cpus = sysconf(_SC_NPROCESSORS_CONF);
+ int cpus = sysconf(_SC_NPROCESSORS_ONLN);
int ret;
int i;
@@ -317,7 +317,7 @@ static void test_iter_raw_events(void)
static void test_instance_iter_snapshot_events(struct tracefs_instance *instance)
{
- int cpus = sysconf(_SC_NPROCESSORS_CONF);
+ int cpus = sysconf(_SC_NPROCESSORS_ONLN);
int i;
iter_raw_events_on_cpu(instance, -1, true);
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 2/3] libtracefs: Use LIBTRACEFS_STATIC for utest
2026-09-23 20:56 ` [PATCH v2 0/3] Ubuntu patches Benjamin Drung
2026-09-23 20:56 ` [PATCH v2 1/3] libtracefs utest: Only use online CPUs during tests Benjamin Drung
@ 2026-09-23 20:56 ` Benjamin Drung
2026-09-23 20:56 ` [PATCH v2 3/3] libtracefs: Support EXTRA_LIBS " Benjamin Drung
2026-09-24 19:45 ` [PATCH v2 0/3] Ubuntu patches Steven Rostedt
3 siblings, 0 replies; 8+ messages in thread
From: Benjamin Drung @ 2026-09-23 20:56 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Benjamin Drung
The top-level Makefile already sets `LIBTRACEFS_STATIC`. To allow
overriding the static libtracefs library using just this variable, use
`LIBTRACEFS_STATIC` in the utest Makefile as well.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
---
utest/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/utest/Makefile b/utest/Makefile
index f10b709..9bd3dea 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -10,9 +10,11 @@ OBJS =
OBJS += trace-utest.o
OBJS += tracefs-utest.o
+LIBTRACEFS_STATIC ?= $(obj)/lib/libtracefs.a
+
LIBS += -lcunit \
-ldl \
- $(obj)/lib/libtracefs.a
+ $(LIBTRACEFS_STATIC)
OBJS := $(OBJS:%.o=$(bdir)/%.o)
@@ -21,7 +23,7 @@ $(bdir):
$(OBJS): | $(bdir)
-$(bdir)/trace-utest: $(OBJS) $(obj)/lib/libtracefs.a
+$(bdir)/trace-utest: $(OBJS) $(LIBTRACEFS_STATIC)
$(Q)$(do_app_build)
$(bdir)/%.o: %.c
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] libtracefs: Support EXTRA_LIBS for utest
2026-09-23 20:56 ` [PATCH v2 0/3] Ubuntu patches Benjamin Drung
2026-09-23 20:56 ` [PATCH v2 1/3] libtracefs utest: Only use online CPUs during tests Benjamin Drung
2026-09-23 20:56 ` [PATCH v2 2/3] libtracefs: Use LIBTRACEFS_STATIC for utest Benjamin Drung
@ 2026-09-23 20:56 ` Benjamin Drung
2026-09-24 19:45 ` [PATCH v2 0/3] Ubuntu patches Steven Rostedt
3 siblings, 0 replies; 8+ messages in thread
From: Benjamin Drung @ 2026-09-23 20:56 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Benjamin Drung
Allow building the utest against the system installed libtracefs library
by tweaking the make variables:
```
make LIBTRACEFS_STATIC= EXTRA_LIBS=-ltracefs test
```
Note: This still requires making `tfs_find_debug_tracing_dir` available.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
---
utest/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utest/Makefile b/utest/Makefile
index 9bd3dea..bcb87b6 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -14,7 +14,8 @@ LIBTRACEFS_STATIC ?= $(obj)/lib/libtracefs.a
LIBS += -lcunit \
-ldl \
- $(LIBTRACEFS_STATIC)
+ $(LIBTRACEFS_STATIC) \
+ $(EXTRA_LIBS)
OBJS := $(OBJS:%.o=$(bdir)/%.o)
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] Ubuntu patches
2026-09-23 20:56 ` [PATCH v2 0/3] Ubuntu patches Benjamin Drung
` (2 preceding siblings ...)
2026-09-23 20:56 ` [PATCH v2 3/3] libtracefs: Support EXTRA_LIBS " Benjamin Drung
@ 2026-09-24 19:45 ` Steven Rostedt
3 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-09-24 19:45 UTC (permalink / raw)
To: Benjamin Drung; +Cc: linux-trace-devel
Thanks,
I'm actually in the middle of traveling until Oct 10th and will likely
not be able to look at these until then.I'm hoping to triage the bugs
and changes sent to the trace-cmd and library code in October.
-- Steve
On Wed, 23 Sep 2026 22:56:29 +0200
Benjamin Drung <benjamin.drung@canonical.com> wrote:
> Hi,
>
> with quite some delay, here are the requested changes.
>
> v2:
> - Added missing Signed-off-by tags.
>
> Adrien Nader (1):
> libtracefs utest: Only use online CPUs during tests
>
> Benjamin Drung (2):
> libtracefs: Use LIBTRACEFS_STATIC for utest
> libtracefs: Support EXTRA_LIBS for utest
>
> utest/Makefile | 7 +++++--
> utest/tracefs-utest.c | 10 +++++-----
> 2 files changed, 10 insertions(+), 7 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread