From: Jahnavi MN via B4 Relay <devnull+jahnavimn.google.com@kernel.org>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Christian Brauner" <brauner@kernel.org>,
"Carlos Llamas" <cmllamas@google.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
Jahnavi MN <jahnavimn@google.com>
Subject: [PATCH 2/7] rust_binder: Implement the BINDER_DEBUG_USER_ERROR logging mask for freezer-related operation
Date: Fri, 03 Jul 2026 15:29:23 +0000 [thread overview]
Message-ID: <20260703-rust_binder_debug_mask-v1-2-9bdf12b5325c@google.com> (raw)
In-Reply-To: <20260703-rust_binder_debug_mask-v1-0-9bdf12b5325c@google.com>
From: Jahnavi MN <jahnavimn@google.com>
This adds dynamic debug logs for:
- Requesting freeze notifications on invalid references, duplicate
cookies, or already active registrations.
- Completing freeze notifications that are not pending or not found.
- Clearing freeze notifications on invalid references, inactive
notifications, or cookie mismatches.
Signed-off-by: Jahnavi MN <jahnavimn@google.com>
---
drivers/android/binder/freeze.rs | 49 ++++++++++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 10 deletions(-)
diff --git a/drivers/android/binder/freeze.rs b/drivers/android/binder/freeze.rs
index 53b60035639a..d0559ed308ef 100644
--- a/drivers/android/binder/freeze.rs
+++ b/drivers/android/binder/freeze.rs
@@ -176,11 +176,18 @@ pub(crate) fn request_freeze_notif(
let mut node_refs_guard = self.node_refs.lock();
let node_refs = &mut *node_refs_guard;
let Some(info) = node_refs.by_handle.get_mut(&handle) else {
- pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION invalid ref {}\n", handle);
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_REQUEST_FREEZE_NOTIFICATION invalid ref {}",
+ handle
+ );
return Err(EINVAL);
};
if info.freeze().is_some() {
- pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION already set\n");
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_REQUEST_FREEZE_NOTIFICATION already set"
+ );
return Err(EINVAL);
}
let node_ref = info.node_ref();
@@ -188,7 +195,10 @@ pub(crate) fn request_freeze_notif(
if let rbtree::Entry::Occupied(ref dupe) = freeze_entry {
if !dupe.get().allow_duplicate(&node_ref.node) {
- pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION duplicate cookie\n");
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_REQUEST_FREEZE_NOTIFICATION duplicate cookie"
+ );
return Err(EINVAL);
}
}
@@ -238,7 +248,11 @@ pub(crate) fn freeze_notif_done(self: &Arc<Self>, reader: &mut UserSliceReader)
let mut node_refs_guard = self.node_refs.lock();
let node_refs = &mut *node_refs_guard;
let Some(freeze) = node_refs.freeze_listeners.get_mut(&cookie) else {
- pr_warn!("BC_FREEZE_NOTIFICATION_DONE {:016x} not found\n", cookie.0);
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_FREEZE_NOTIFICATION_DONE {:016x} not found",
+ cookie.0
+ );
return Err(EINVAL);
};
let mut clear_msg = None;
@@ -248,8 +262,9 @@ pub(crate) fn freeze_notif_done(self: &Arc<Self>, reader: &mut UserSliceReader)
freeze.num_cleared_duplicates += 1;
} else {
if !freeze.is_pending {
- pr_warn!(
- "BC_FREEZE_NOTIFICATION_DONE {:016x} not pending\n",
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_FREEZE_NOTIFICATION_DONE {:016x} not pending",
cookie.0
);
return Err(EINVAL);
@@ -277,19 +292,33 @@ pub(crate) fn clear_freeze_notif(self: &Arc<Self>, reader: &mut UserSliceReader)
let mut node_refs_guard = self.node_refs.lock();
let node_refs = &mut *node_refs_guard;
let Some(info) = node_refs.by_handle.get_mut(&handle) else {
- pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION invalid ref {}\n", handle);
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_CLEAR_FREEZE_NOTIFICATION invalid ref {}",
+ handle
+ );
return Err(EINVAL);
};
let Some(info_cookie) = info.freeze() else {
- pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION freeze notification not active\n");
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_CLEAR_FREEZE_NOTIFICATION freeze notification not active"
+ );
return Err(EINVAL);
};
if *info_cookie != cookie {
- pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION freeze notification cookie mismatch\n");
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_CLEAR_FREEZE_NOTIFICATION freeze notification cookie mismatch"
+ );
return Err(EINVAL);
}
let Some(listener) = node_refs.freeze_listeners.get_mut(&cookie) else {
- pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION invalid cookie {}\n", handle);
+ binder_debug!(
+ crate::debug::BINDER_DEBUG_USER_ERROR,
+ "BC_CLEAR_FREEZE_NOTIFICATION invalid cookie {}",
+ handle
+ );
return Err(EINVAL);
};
listener.is_clearing = true;
--
2.55.0.rc0.799.gd6f94ed593-goog
next prev parent reply other threads:[~2026-07-03 15:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 15:29 [PATCH 0/7] rust_binder : Implement dynamic debug logging mask Jahnavi MN via B4 Relay
2026-07-03 15:29 ` [PATCH 1/7] rust_binder: Add " Jahnavi MN via B4 Relay
2026-07-03 16:23 ` Gary Guo
2026-07-04 21:03 ` Alice Ryhl
2026-07-03 15:29 ` Jahnavi MN via B4 Relay [this message]
2026-07-03 15:29 ` [PATCH 3/7] rust_binder: Implement the BINDER_DEBUG_USER_ERROR logging mask for reference counting and death notification operations Jahnavi MN via B4 Relay
2026-07-04 21:14 ` Alice Ryhl
2026-07-03 15:29 ` [PATCH 4/7] rust_binder: Implement the BINDER_DEBUG_USER_ERROR logging mask for transaction parsing and protocol validation failures Jahnavi MN via B4 Relay
2026-07-03 15:29 ` [PATCH 5/7] rust_binder: Implement the BINDER_DEBUG_FAILED_TRANSACTION logging mask for transaction parsing and routing failures Jahnavi MN via B4 Relay
2026-07-03 15:29 ` [PATCH 6/7] rust_binder: Implement BINDER_DEBUG_FAILED_TRANSACTION logging for death notification allocation failures Jahnavi MN via B4 Relay
2026-07-04 21:17 ` Alice Ryhl
2026-07-03 15:29 ` [PATCH 7/7] rust_binder: Implement the BINDER_DEBUG_DEAD_TRANSACTION logging mask to trace in-flight cancellations during teardown Jahnavi MN via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260703-rust_binder_debug_mask-v1-2-9bdf12b5325c@google.com \
--to=devnull+jahnavimn.google.com@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=cmllamas@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jahnavimn@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tkjos@android.com \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox