All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] rust: add suppord for dynamic debug
@ 2025-06-11 20:29 Andrew Ballance
  2025-06-11 20:29 ` [RFC PATCH 1/3] rust: static jump: add support for nested arguments Andrew Ballance
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andrew Ballance @ 2025-06-11 20:29 UTC (permalink / raw)
  To: jbaron, jim.cromie, daniel.almeida, acourbot, ojeda, alex.gaynor,
	boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
	tmgross, dakr, gregkh, rafael, rostedt, andrewjballance
  Cc: viresh.kumar, lina+kernel, tamird, jubalh, rust-for-linux,
	linux-kernel

This patch series adds support for dynamic debug to the rust
pr_debug! and dev_dbg! macros.

I have tested it and it and it does work but, there are a few
differences between this and the c version (hence why this is a rfc).

rust does not have an equivlant to the C __func__ macro. so, for the
time being this hard codes the function name to be the name of the
macro e.g. "pr_debug!" and "dev_dbg!".

This uses the module_path! macro to get the module name, which will not
be exactly the same as the c version if a kernel module contains multiple
rust modules. e.g. it might be "kernel_module_name::rust_module_name".
this does give a more accurate description of where the print statement
is located but it exactly what the c version does.

This patch series also had to make a small change to the static_branch!
macro so that it allows keys that are nested multiple structs deep within
a static variable. 

Closes: https://github.com/Rust-for-Linux/linux/issues/453
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/Dynamic.20Debug.3F/with/519289668

Andrew Ballance (3):
  rust: static jump: add support for nested arguments
  rust: device add support for dynamic debug to pr_debug!
  rust: device add support for dynamic debug to dev_dbg!

 rust/bindings/bindings_helper.h |   1 +
 rust/kernel/device.rs           | 102 ++++++++++++++++++-
 rust/kernel/jump_label.rs       |  10 +-
 rust/kernel/print.rs            | 167 +++++++++++++++++++++++++++++++-
 4 files changed, 269 insertions(+), 11 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-06-12  7:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 20:29 [RFC PATCH 0/3] rust: add suppord for dynamic debug Andrew Ballance
2025-06-11 20:29 ` [RFC PATCH 1/3] rust: static jump: add support for nested arguments Andrew Ballance
2025-06-11 21:32   ` Alice Ryhl
2025-06-11 20:29 ` [RFC PATCH 2/3] rust: device add support for dynamic debug to pr_debug! Andrew Ballance
2025-06-11 21:38   ` Alice Ryhl
2025-06-12  4:02     ` Andrew Ballance
2025-06-12  7:17       ` Alice Ryhl
2025-06-11 20:29 ` [RFC PATCH 3/3] rust: device add support for dynamic debug to dev_dbg! Andrew Ballance
2025-06-11 20:36 ` [RFC PATCH 0/3] rust: add suppord for dynamic debug Andrew Ballance

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.