Skip to contentSkip to conversation

tracing: A couple of fixes for v6.8

PATCH New Steven Rostedt 1 participant 3 messages Feb 13, 2024

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: A couple of fixes for v6.8

Two tracing fixes for v6.8:

- Fix the #ifndef that didn't have CONFIG_ on HAVE_DYNAMIC_FTRACE_WITH_REGS The fix to have dynamic trampolines work with x86 broke arm64 as the config used in the #ifdef was HAVE_DYNAMIC_FTRACE_WITH_REGS and not CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS which removed the fix that the previous fix was to fix.

- Fix tracing_on state
The code to test if "tracing_on" is set used ring_buffer_record_is_on() which returns false if the ring buffer isn't able to be written to. But the ring buffer disable has several bits that disable it. One is internal disabling which is used for resizing and other modifications of the ring buffer. But the "tracing_on" user space visibile flag should only report if tracing is actually on and not internally disabled, as this can cause confusion as writing "1" when it is disabled will not enable it.

Instead use ring_buffer_record_is_set_on() which shows the user space visible settings.

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/urgent

Head SHA1: a6eaa24f1cc2c7aecec6047556bdfe32042094c3

Petr Pavlu (1):
tracing: Fix HAVE_DYNAMIC_FTRACE_WITH_REGS ifdef

Sven Schnelle (1):
tracing: Use ring_buffer_record_is_set_on() in tracer_tracing_is_on()

----

 kernel/trace/ftrace.c | 2 +-
 kernel/trace/trace.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 tracing: Fix HAVE_DYNAMIC_FTRACE_WITH_REGS ifdef

From: Petr Pavlu <[email protected]>

Commit a8b9cf62ade1 ("ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default") attempted to fix an issue with direct trampolines on x86, see its description for details. However, it wrongly referenced the HAVE_DYNAMIC_FTRACE_WITH_REGS config option and the problem is still present.

Add the missing "CONFIG_" prefix for the logic to work as intended.

Fixes a8b9cf62ade1 ("ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default")
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ftrace.c +1 -1
index c060d5b47910..83ba342aef31 100644
@@ -5331,7 +5331,7 @@ static int register_ftrace_function_nolock(struct ftrace_ops *ops);
  * not support ftrace_regs_caller but direct_call, use SAVE_ARGS so that it
  * jumps from ftrace_caller for multiple ftrace_ops.
  */
-#ifndef HAVE_DYNAMIC_FTRACE_WITH_REGS
+#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS
 #define MULTI_FLAGS (FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_ARGS)
 #else
 #define MULTI_FLAGS (FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS)
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/2 tracing: Use ring_buffer_record_is_set_on() in tracer_tracing_is_on()

In reply to Steven Rostedt

From: Sven Schnelle <[email protected]>

tracer_tracing_is_on() checks whether record_disabled is not zero. This checks both the record_disabled counter and the RB_BUFFER_OFF flag. Reading the source it looks like this function should only check for the RB_BUFFER_OFF flag. Therefore use ring_buffer_record_is_set_on(). This fixes spurious fails in the 'test for function traceon/off triggers' test from the ftrace testsuite when the system is under load.

---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 9ff8a439d674..aa54810e8b56 100644
@@ -1532,7 +1532,7 @@ void disable_trace_on_warning(void)
 bool tracer_tracing_is_on(struct trace_array *tr)
 {
 	if (tr->array_buffer.buffer)
-		return ring_buffer_record_is_on(tr->array_buffer.buffer);
+		return ring_buffer_record_is_set_on(tr->array_buffer.buffer);
 	return !tr->buffer_disabled;
 }
 
Signature · 1 line
2.43.0