Re: [PATCH 6.12 419/602] selftests/ftrace: Reset triggers at top level before instance loop

Harshit Mogalapalli <[email protected]> Fri, 31 Jul 2026 21:06:11 +0530
Newsgroups dev.linux.lists.patches,org.kernel.vger.stable
Message-ID <[email protected]>
On 30/07/26 7:43 pm, Greg Kroah-Hartman wrote:
> 6.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Masami Hiramatsu (Google) <[email protected]>
> 
> commit 1a087033a6bad73b4140020b40e819b0933aafc3 upstream.
> 
> When running instance tests, 'ftracetest' creates a new ftrace instance
> and runs the tests inside it. Before starting each test, it executes
> 'initialize_system()' to reset the ftrace state to initial-state.
> 
> However, since 'initialize_system()' is executed in the context of the
> instance directory, it only cleans up triggers and filters of that
> instance.
> Any triggers or dynamic events left behind in the top-level instance by
> previous failed top-level tests, are left completely untouched. These
> top-level leftovers can cause subsequent instance-based tests to fail
> or even crash the kernel.
> 
> Fix this by executing 'initialize_system()' in the top-level tracing
> directory once before entering the instance loop.
> 
> Cc: [email protected]
> Link: https://patch.msgid.link/178425671889.84440.9477850701738666404.stgit@devnote2
> Fixes: b5b77be812de ("selftests: ftrace: Allow some tests to be run in a tracing instance")
> Assisted-by: Antigravity:gemini-3.5-flash
> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
> Signed-off-by: Steven Rostedt <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>   tools/testing/selftests/ftrace/ftracetest |    1 +
>   1 file changed, 1 insertion(+)
> 
> --- a/tools/testing/selftests/ftrace/ftracetest
> +++ b/tools/testing/selftests/ftrace/ftracetest
> @@ -483,6 +483,7 @@ for t in $TEST_CASES; do
>   done
>   
>   # Test on instance loop
> +(cd $TRACING_DIR; initialize_system)
>   INSTANCE=" (instance) "

Hi Greg/Sasha,

I ran an AI-assisted backport review and checked this manually. The
backport calls a helper that does not exist on 6.12.y.

The backport adds:

	(cd $TRACING_DIR; initialize_system)

But 6.12.y defines:

   	initialize_ftrace()

The helper rename came from upstream commit a0aa283c53a7, which is not
present on this branch. I think this is a wrong adaptation;


Lets drop it, as we anyway don't backport selftests apart from bpf to 
stable ?


thanks,
harshit

>   for t in $TEST_CASES; do
>     test_on_instance $t || continue
> 
> 
>