[PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites

Vineeth Pillai (Google) posted 15 patches 3 weeks, 4 days ago
There is a newer version of this series
[PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Vineeth Pillai (Google) 3 weeks, 4 days ago
Replace trace_foo() with the new trace_invoke_foo() at sites already
guarded by trace_foo_enabled(), avoiding a redundant
static_branch_unlikely() re-evaluation inside the tracepoint.
trace_invoke_foo() calls the tracepoint callbacks directly without
utilizing the static branch again.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vineeth Pillai (Google) <vineeth@bitbyteword.org>
Assisted-by: Claude:claude-sonnet-4-6
---
 drivers/spi/spi-axi-spi-engine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c
index 48ee5bf481738..44e618bab2f0b 100644
--- a/drivers/spi/spi-axi-spi-engine.c
+++ b/drivers/spi/spi-axi-spi-engine.c
@@ -953,7 +953,7 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,
 		struct spi_transfer *xfer;
 
 		list_for_each_entry(xfer, &msg->transfers, transfer_list)
-			trace_spi_transfer_start(msg, xfer);
+			trace_invoke_spi_transfer_start(msg, xfer);
 	}
 
 	spin_lock_irqsave(&spi_engine->lock, flags);
@@ -987,7 +987,7 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,
 		struct spi_transfer *xfer;
 
 		list_for_each_entry(xfer, &msg->transfers, transfer_list)
-			trace_spi_transfer_stop(msg, xfer);
+			trace_invoke_spi_transfer_stop(msg, xfer);
 	}
 
 out:
-- 
2.53.0
Re: [PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Mark Brown 3 weeks, 4 days ago
On Thu, Mar 12, 2026 at 11:05:08AM -0400, Vineeth Pillai (Google) wrote:
> Replace trace_foo() with the new trace_invoke_foo() at sites already
> guarded by trace_foo_enabled(), avoiding a redundant
> static_branch_unlikely() re-evaluation inside the tracepoint.
> trace_invoke_foo() calls the tracepoint callbacks directly without
> utilizing the static branch again.

Acked-by: Mark Brown <broonie@kernel.org>

though not loving the naming here, I'll have a hard time figuring out
what the weird call is about next time I look at that code
Re: [PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Steven Rostedt 3 weeks, 4 days ago
On Thu, 12 Mar 2026 15:34:20 +0000
Mark Brown <broonie@kernel.org> wrote:

> though not loving the naming here, I'll have a hard time figuring out
> what the weird call is about next time I look at that code

Would:

	trace_call__foo()

Be better?

Or do you have another name we should use?

-- Steve
Re: [PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Mark Brown 3 weeks, 4 days ago
On Thu, Mar 12, 2026 at 11:42:54AM -0400, Steven Rostedt wrote:
> Mark Brown <broonie@kernel.org> wrote:

> > though not loving the naming here, I'll have a hard time figuring out
> > what the weird call is about next time I look at that code

> Would:

> 	trace_call__foo()

> Be better?

> Or do you have another name we should use?

Possibly an _unchecked or something?  Honestly the suggestion someone
had for _do seemed OK to me.  Part of it is that I wouldn't think of
tracepoints as being something that I'd call.
Re: [PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Steven Rostedt 3 weeks, 4 days ago
On Thu, 12 Mar 2026 16:54:00 +0000
Mark Brown <broonie@kernel.org> wrote:

> Possibly an _unchecked or something?  Honestly the suggestion someone
> had for _do seemed OK to me.  Part of it is that I wouldn't think of
> tracepoints as being something that I'd call.

The "__do_trace.." is an internal function I don't want to expose.

I'm thinking of: call_trace_foo(), as that should be pretty obvious to what
it is.

I want to avoid the do_trace_foo() because that's usually the name of the
wrapper code that is done in header files. Where the header calls:

 do_trace_foo()

and the C file has:

void do_trace_foo(..)
{
	trace_foo(..);
}

Which could be:

void do_trace_foo(..)
{
	call_trace(..);
}

And remove the static branch there.

-- Steve
Re: [PATCH 13/15] spi: Use trace_invoke_##name() at guarded tracepoint call sites
Posted by Mark Brown 3 weeks, 4 days ago
On Thu, Mar 12, 2026 at 01:00:22PM -0400, Steven Rostedt wrote:
> Mark Brown <broonie@kernel.org> wrote:

> > Possibly an _unchecked or something?  Honestly the suggestion someone
> > had for _do seemed OK to me.  Part of it is that I wouldn't think of
> > tracepoints as being something that I'd call.

> The "__do_trace.." is an internal function I don't want to expose.

> I'm thinking of: call_trace_foo(), as that should be pretty obvious to what
> it is.

Yeah, like I day it was the concept of there being a call in a
tracepoint that was a bit of a surprise.  It was more a grumble than
anything else, I did ack the change.