]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust_binder: add `transaction_received` tracepoint
authorMohamad Alsadhan <mo@sdhn.cc>
Tue, 17 Mar 2026 14:49:45 +0000 (17:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2026 10:18:22 +0000 (12:18 +0200)
Add Rust Binder `transaction_received` tracepoint decalaration and
wire in the corresponding trace call when a transaction work item is
accepted for execution.

Signed-off-by: Mohamad Alsadhan <mo@sdhn.cc>
Link: https://patch.msgid.link/20260317-rust-binder-trace-v3-4-6fae4fbcf637@sdhn.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder/rust_binder_events.h
drivers/android/binder/trace.rs
drivers/android/binder/transaction.rs

index 62b587c7c4946513420fe7ecf959a98bab43e346..8a0b72bf025500901c4540f4ed00f2ce7cfc2032 100644 (file)
@@ -99,6 +99,18 @@ TRACE_EVENT(binder_transaction,
                  __entry->reply, __entry->flags, __entry->code)
 );
 
+TRACE_EVENT(binder_transaction_received,
+       TP_PROTO(rust_binder_transaction t),
+       TP_ARGS(t),
+       TP_STRUCT__entry(
+               __field(int, debug_id)
+       ),
+       TP_fast_assign(
+               __entry->debug_id = rust_binder_transaction_debug_id(t);
+       ),
+       TP_printk("transaction=%d", __entry->debug_id)
+);
+
 #endif /* _RUST_BINDER_TRACE_H */
 
 /* This part must be outside protection */
index 1f62b2276740b29265c655b6e754ba71437a512d..d96afdb79c658cf3d84b458910ca4651c8d6de56 100644 (file)
@@ -17,6 +17,7 @@ declare_trace! {
     unsafe fn binder_write_done(ret: c_int);
     unsafe fn binder_wait_for_work(proc_work: bool, transaction_stack: bool, thread_todo: bool);
     unsafe fn binder_transaction(reply: bool, t: rust_binder_transaction, thread: *mut task_struct);
+    unsafe fn binder_transaction_received(t: rust_binder_transaction);
 }
 
 #[inline]
@@ -70,3 +71,9 @@ pub(crate) fn trace_transaction(reply: bool, t: &Transaction, thread: Option<&Ta
     // valid or null.
     unsafe { binder_transaction(reply, raw_transaction(t), thread) }
 }
+
+#[inline]
+pub(crate) fn trace_transaction_received(t: &Transaction) {
+    // SAFETY: The raw transaction is valid for the duration of this call.
+    unsafe { binder_transaction_received(raw_transaction(t)) }
+}
index 5dff3d655c4d368f965674bc993a37f042ddadf2..47d5e4d88b07cc7d695e484598a768151a9d1e1d 100644 (file)
@@ -451,6 +451,8 @@ impl DeliverToRead for Transaction {
 
         self.drop_outstanding_txn();
 
+        crate::trace::trace_transaction_received(&self);
+
         // When this is not a reply and not a oneway transaction, update `current_transaction`. If
         // it's a reply, `current_transaction` has already been updated appropriately.
         if self.target_node.is_some() && tr_sec.transaction_data.flags & TF_ONE_WAY == 0 {