-
Notifications
You must be signed in to change notification settings - Fork 484
Description
C Binder has many tracepoints. Here is one:
linux/drivers/android/binder_trace.h
Lines 22 to 35 in 11439c4
| TRACE_EVENT(binder_ioctl, | |
| TP_PROTO(unsigned int cmd, unsigned long arg), | |
| TP_ARGS(cmd, arg), | |
| TP_STRUCT__entry( | |
| __field(unsigned int, cmd) | |
| __field(unsigned long, arg) | |
| ), | |
| TP_fast_assign( | |
| __entry->cmd = cmd; | |
| __entry->arg = arg; | |
| ), | |
| TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg) | |
| ); |
Rust Binder implements an equivalent one here:
linux/drivers/android/binder/rust_binder_events.h
Lines 18 to 31 in 11439c4
| TRACE_EVENT(rust_binder_ioctl, | |
| TP_PROTO(unsigned int cmd, unsigned long arg), | |
| TP_ARGS(cmd, arg), | |
| TP_STRUCT__entry( | |
| __field(unsigned int, cmd) | |
| __field(unsigned long, arg) | |
| ), | |
| TP_fast_assign( | |
| __entry->cmd = cmd; | |
| __entry->arg = arg; | |
| ), | |
| TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg) | |
| ); |
together with:
linux/drivers/android/binder/trace.rs
Lines 22 to 26 in 11439c4
| #[inline] | |
| pub(crate) fn trace_ioctl(cmd: u32, arg: usize) { | |
| // SAFETY: Always safe to call. | |
| unsafe { rust_binder_ioctl(cmd, arg as c_ulong) } | |
| } |
However, many tracepoints are missing. To work on this issue, pick one of them and submit a patch adding it. Please compare with the implementation found here in Android's fork, but it may need adjustments when upstreamed.
Oh, also, the current tracepoints are called rust_binder_*, but the rust_ prefix should be removed because the name is part of the uapi, and userspace expects tracepoints to have the old names.