[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240822103443.6a6ae051@gandalf.local.home>
Date: Thu, 22 Aug 2024 10:34:43 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Luis Claudio R. Goncalves" <lgoncalv@...hat.com>
Cc: tglozar@...hat.com, linux-trace-kernel@...r.kernel.org,
linux-kernel@...r.kernel.org, jkacur@...hat.com
Subject: Re: [PATCH] tracing/timerlat: Check tlat_var for NULL in
timerlat_fd_release
On Thu, 22 Aug 2024 08:20:52 -0300
"Luis Claudio R. Goncalves" <lgoncalv@...hat.com> wrote:
> You mean the
>
> + if (!tlat_var->kthread) {
> + /* the fd has been closed already */
>
> bit or the kthread handling in rtla itself?
>
> As Tomas already said, thank you for testing and reviewing the suggested fix!
The close only happens once, but the kthread does get freed elsewhere.
I used my new persistent ring buffer to debug this! I'll be posting some
more patches that allow trace_printk() and friends to use the persistent
ring buffer (or any instance) soon.
For this bug, I would recommend instead doing:
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 66a871553d4a..53de719f35cb 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -2579,7 +2587,8 @@ static int timerlat_fd_release(struct inode *inode, struct file *file)
osn_var = per_cpu_ptr(&per_cpu_osnoise_var, cpu);
tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);
- hrtimer_cancel(&tlat_var->timer);
+ if (tlat_var->kthread)
+ hrtimer_cancel(&tlat_var->timer);
memset(tlat_var, 0, sizeof(*tlat_var));
osn_var->sampling = 0;
-- Steve
Powered by blists - more mailing lists