From: linuxtestproject.agent@gmail.com
To: Praveen K Pandey <praveen@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] ftrace: Add common library for C implementation
Date: Mon, 8 Jun 2026 14:39:30 +0000 [thread overview]
Message-ID: <20260608143930.4256-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260608132526.42325-2-praveen@linux.ibm.com>
Hi Praveen,
On Mon, 8 Jun 2026 18:55:22 +0530, Praveen K Pandey wrote:
> ftrace: Add common library for C implementation
--- [PATCH 1/5] ---
> +// Made with Bob
What is this? This is a C++ style comment (kernel style requires
/* ... */) and seems like a leftover that should be removed.
> +int ftrace_set_tracer(const char *tracer)
> +{
> + char *path;
> + int ret;
`ret` is declared but never used in this function since
SAFE_FILE_PRINTF() is used for the write. Should be removed.
> + if (saved_state.trace_options) {
> + char *options = strdup(saved_state.trace_options);
> + char *token = strtok(options, "\n");
If strdup() returns NULL (OOM), passing NULL as the first argument
to strtok() on the first call is undefined behavior. The other
strdup() call in ftrace_initialize() checks for NULL, so this one
should too.
--- [PATCH 2/5] ---
> ftrace: Convert ftrace_regression01.sh to C
>
> Convert ftrace_regression01.sh to C using the new LTP test API.
> This test validates basic ftrace functionality by testing all
> available tracers.
The commit body does not match the test. The code (and the doc
block) test for a kernel panic triggered by userstacktrace with
page fault events, not "basic ftrace functionality by testing all
available tracers."
> - Sets .min_kver = "2.6.29" for kernel version requirement
The code does not set .min_kver at all. The commit body should
match the actual struct tst_test definition.
--- [PATCH 3/5] ---
> ftrace: Convert ftrace_regression02.sh to C
>
> - Sets .min_kver = "2.6.29" for kernel version requirement
The code sets .min_kver = "3.2", not "2.6.29".
--- [PATCH 4/5] ---
> +static volatile int stop_testing = 0;
> +static void stop_stress_tests(void)
> +{
> + int i;
> +
> + stop_testing = 1;
> +
> + for (i = 0; i < thread_count; i++) {
> + pthread_join(threads[i], NULL);
> + }
> +static void run_test(void)
> +{
> + ...
> + stop_stress_tests();
> +static void cleanup(void)
> +{
> + if (thread_count > 0) {
> + stop_testing = 1;
> + stop_stress_tests();
> + }
On the normal path, run_test() calls stop_stress_tests() which
joins all threads, then cleanup() is called and
stop_stress_tests() runs again. Calling pthread_join() on
already-joined threads is undefined behavior.
One fix: reset thread_count to 0 at the end of
stop_stress_tests().
Also, stop_testing is never reset to 0 between iterations, so
running with -i N would cause iterations 2+ to spawn threads
that exit immediately (all threads check
`while (!stop_testing)`). Both stop_testing and thread_count
should be re-initialized in run_test() or setup().
--- [PATCH 5/5] ---
> diff --git a/testcases/kernel/tracing/ftrace_test/Makefile
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> +
> +# C test binaries with shared library dependencies
> +ftrace_regression01: ftrace_lib.o
> +ftrace_regression02: ftrace_lib.o
> +ftrace_stress_test: ftrace_lib.o
The Makefile changes (FILTER_OUT_MAKE_TARGETS, library
dependencies, -lpthread) are deferred to patch 5, but the C
source files are added in patches 1-4. This means the build
breaks at every intermediate commit: patch 1 adds ftrace_lib.c
(which defines TST_NO_DEFAULT_MAIN and has no main()), but the
old Makefile's auto-detection tries to build it as a standalone
binary and the link fails. Patches 2-4 likewise cannot link
without the ftrace_lib.o dependency.
Each patch in the series must compile on its own. The Makefile
changes should be moved earlier, or folded into the respective
patches that add the C files.
Verdict: Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-06-08 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 13:25 [LTP] [PATCH v5 0/5] ftrace: Convert shell tests to C Praveen K Pandey
2026-06-08 13:25 ` [LTP] [PATCH v5 1/5] ftrace: Add common library for C implementation Praveen K Pandey
2026-06-08 14:39 ` linuxtestproject.agent [this message]
2026-06-08 13:25 ` [LTP] [PATCH v5 2/5] ftrace: Convert ftrace_regression01.sh to C Praveen K Pandey
2026-06-08 13:25 ` [LTP] [PATCH v5 3/5] ftrace: Convert ftrace_regression02.sh " Praveen K Pandey
2026-06-08 13:25 ` [LTP] [PATCH v5 4/5] ftrace: Convert ftrace_stress_test.sh " Praveen K Pandey
2026-06-08 13:25 ` [LTP] [PATCH v5 5/5] ftrace: Remove obsolete shell test files Praveen K Pandey
-- strict thread matches above, loose matches on Subject: below --
2026-06-09 4:16 [LTP] [PATCH v6 1/5] ftrace: Add common library for C implementation Praveen K Pandey
2026-06-09 5:14 ` [LTP] " linuxtestproject.agent
2026-06-08 5:49 [LTP] [LTP PATCH v4 1/5] " Praveen K Pandey
2026-06-08 9:01 ` [LTP] " linuxtestproject.agent
2026-06-07 4:41 [LTP] [LTP PATCH v3 1/5] " Praveen K Pandey
2026-06-07 8:02 ` [LTP] " linuxtestproject.agent
2026-06-06 19:58 [LTP] [LTP PATCH v2 1/5] " Praveen K Pandey
2026-06-06 21:11 ` [LTP] " linuxtestproject.agent
2026-06-06 14:31 [LTP] [LTP PATCH 1/5] " Praveen K Pandey
2026-06-06 15:26 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260608143930.4256-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=praveen@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.