On Tue, 30 Jul 2024 11:35:27 +0100
Gary Guo [off-list ref] wrote:
quoted
+/*
+ * Declare an exported function that Rust code can call to trigger this
+ * tracepoint. This function does not include the static branch; that is done
+ * in Rust to avoid a function call when the tracepoint is disabled.
+ */
+#define DEFINE_RUST_DO_TRACE(name, proto, args)
+#define DEFINE_RUST_DO_TRACE_REAL(name, proto, args) \
+ notrace void rust_do_trace_##name(proto) \
+ { \
+ __DO_TRACE(name, \
+ TP_ARGS(args), \
+ cpu_online(raw_smp_processor_id()), 0); \
I guess this doesn't support conditions. Currently the conditions are
specified during declaration and not during definition.
Would it make sense to have
static inline void do_trace_##name(proto)
{
__DO_TRACE(name, TP_ARGS(args), TP_CONDITION(cond), 0);
But where is the "cond" passed in from?
I guess in the future if you want to add conditions, you would then just
add:
#define DEFINE_RUST_DO_TRACE_REAL_CONDITION(name, proto, args, cond) \
notrace void rust_do_trace_##name(proto) \
{ \
__DO_TRACE(name, \
TP_ARGS(args), \
cpu_online(raw_smp_processor_id()) && \
TP_CONDITION(cond), 0); \
-- Steve
}
in `__DECLARE_TRACE` and then simply call it in `rust_do_trace_##name`?
quoted