Skip to contentSkip to conversation

tracing/timerlat: move interface_lock definition up

PATCH In review Arnd Bergmann 2 participants 2 messages Sep 9, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing/timerlat: move interface_lock definition up

From: Arnd Bergmann <[email protected]>

The definition was previously moved into an #ifdef block by accident and now causes a build failure when CONFIG_TIMERLAT_TRACER is disabled:

In file included from include/linux/seqlock.h:19,
from kernel/trace/trace_osnoise.c:20:
kernel/trace/trace_osnoise.c: In function 'osnoise_sleep':
kernel/trace/trace_osnoise.c:1631:21: error: 'interface_lock' undeclared (first use in this function); did you mean 'trace_clock'?

 1631 |         mutex_lock(&interface_lock);
      |                     ^~~~~~~~~~~~~~

Move it up some more to be outside of that #ifdef again.

Fixes e6a53481da29 ("tracing/timerlat: Only clear timer if a kthread exists")

---
It looks like the regression already made it into 6.11-rc7 as part of
https://lore.kernel.org/lkml/[email protected]/
so this fixup (if correct) is needed for 6.11 as well

---
 kernel/trace/trace_osnoise.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/trace/trace_osnoise.c +5 -5
index 20c6660762a3..acfd57689af6 100644
@@ -228,6 +228,11 @@ static inline struct osnoise_variables *this_cpu_osn_var(void)
 	return this_cpu_ptr(&per_cpu_osnoise_var);
 }
 
+/*
+ * Protect the interface.
+ */
+static struct mutex interface_lock;
+
 #ifdef CONFIG_TIMERLAT_TRACER
 /*
  * Runtime information for the timer mode.
@@ -252,11 +257,6 @@ static inline struct timerlat_variables *this_cpu_tmr_var(void)
 	return this_cpu_ptr(&per_cpu_timerlat_var);
 }
 
-/*
- * Protect the interface.
- */
-static struct mutex interface_lock;
-
 /*
  * tlat_var_reset - Reset the values of the given timerlat_variables
  */
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 6 lines · On Mon, 9 Sep 2024 13:53:20 +0000 Arnd Bergmann <[email protected]> wrote:

From: Arnd Bergmann <[email protected]>

The definition was previously moved into an #ifdef block by accident and now causes a build failure when CONFIG_TIMERLAT_TRACER is disabled:

Quoted 8 lines

In file included from include/linux/seqlock.h:19,
from kernel/trace/trace_osnoise.c:20:
kernel/trace/trace_osnoise.c: In function 'osnoise_sleep':
kernel/trace/trace_osnoise.c:1631:21: error: 'interface_lock' undeclared (first use in this function); did you mean 'trace_clock'?

 1631 |         mutex_lock(&interface_lock);
      |                     ^~~~~~~~~~~~~~

Move it up some more to be outside of that #ifdef again.

Thanks, but for some reason I never got your email. I only noticed this from Patchwork, and I'm replying via lore.

I also fixed it due to someone else reporting the bug. I'm currently running mine through my tests, although it is the exact same change as yours.

https://lore.kernel.org/linux-trace-kernel/[email protected]/

-- Steve

Quoted 40 lines
Fixes e6a53481da29 ("tracing/timerlat: Only clear timer if a kthread exists")

---
It looks like the regression already made it into 6.11-rc7 as part of
https://lore.kernel.org/lkml/[email protected]/
so this fixup (if correct) is needed for 6.11 as well

---
 kernel/trace/trace_osnoise.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/trace/trace_osnoise.c +5 -5
index 20c6660762a3..acfd57689af6 100644
@@ -228,6 +228,11 @@ static inline struct osnoise_variables *this_cpu_osn_var(void)
 	return this_cpu_ptr(&per_cpu_osnoise_var);
 }
 
+/*
+ * Protect the interface.
+ */
+static struct mutex interface_lock;
+
 #ifdef CONFIG_TIMERLAT_TRACER
 /*
  * Runtime information for the timer mode.
@@ -252,11 +257,6 @@ static inline struct timerlat_variables *this_cpu_tmr_var(void)
 	return this_cpu_ptr(&per_cpu_timerlat_var);
 }
 
-/*
- * Protect the interface.
- */
-static struct mutex interface_lock;
-
 /*
  * tlat_var_reset - Reset the values of the given timerlat_variables
  */