Re: [PATCH v4 2/2] rust: add tracepoint support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Jul 2024 11:35:27 +0100
Gary Guo <gary@xxxxxxxxxxx> wrote:

> > +/*
> > + * 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`?
> 
> > +	}
> > +
> >  /*




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux