]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Merge tag 'trace-rust-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Nov 2024 23:44:29 +0000 (15:44 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Nov 2024 23:44:29 +0000 (15:44 -0800)
Pull rust trace event support from Steven Rostedt:
 "Allow Rust code to have trace events

  Trace events is a popular way to debug what is happening inside the
  kernel or just to find out what is happening. Rust code is being added
  to the Linux kernel but it currently does not support the tracing
  infrastructure. Add support of trace events inside Rust code"

* tag 'trace-rust-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  rust: jump_label: skip formatting generated file
  jump_label: rust: pass a mut ptr to `static_key_count`
  samples: rust: fix `rust_print` build making it a combined module
  rust: add arch_static_branch
  jump_label: adjust inline asm to be consistent
  rust: samples: add tracepoint to Rust sample
  rust: add tracepoint support
  rust: add static_branch_unlikely for static_key_false

1  2 
MAINTAINERS
include/linux/tracepoint.h
include/trace/define_trace.h
rust/bindings/bindings_helper.h
rust/helpers/helpers.c
rust/kernel/lib.rs

diff --cc MAINTAINERS
Simple merge
index 425123e921ac7e13d0345f65a5644b5d2229845e,84c4924e499f0d49ea92ba8b6bd22cd0a42a701e..6073a8c7e38ce2ad9400365c9a1155dd25d388f8
@@@ -299,9 -304,14 +318,15 @@@ static inline struct tracepoint *tracep
  
  #define __DECLARE_TRACE_SYSCALL(name, proto, args, cond, data_proto)  \
        __DECLARE_TRACE_COMMON(name, PARAMS(proto), PARAMS(args), cond, PARAMS(data_proto)) \
+       static inline void __rust_do_trace_##name(proto)                \
+       {                                                               \
+               __DO_TRACE(name,                                        \
+                       TP_ARGS(args),                                  \
+                       TP_CONDITION(cond), 1);                         \
+       }                                                               \
        static inline void trace_##name(proto)                          \
        {                                                               \
 +              might_fault();                                          \
                if (static_branch_unlikely(&__tracepoint_##name.key))   \
                        __DO_TRACE(name,                                \
                                TP_ARGS(args),                          \
        void __probestub_##_name(void *__data, proto)                   \
        {                                                               \
        }                                                               \
-       DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);
+       DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);       \
+       DEFINE_RUST_DO_TRACE(_name, TP_PROTO(proto), TP_ARGS(args))
  
 -#define DEFINE_TRACE(name, proto, args)               \
 -      DEFINE_TRACE_FN(name, NULL, NULL, PARAMS(proto), PARAMS(args));
 +#define DEFINE_TRACE_FN(_name, _reg, _unreg, _proto, _args)           \
 +      static struct tracepoint_ext __tracepoint_ext_##_name = {       \
 +              .regfunc = _reg,                                        \
 +              .unregfunc = _unreg,                                    \
 +              .faultable = false,                                     \
 +      };                                                              \
 +      __DEFINE_TRACE_EXT(_name, &__tracepoint_ext_##_name, PARAMS(_proto), PARAMS(_args));
 +
 +#define DEFINE_TRACE_SYSCALL(_name, _reg, _unreg, _proto, _args)      \
 +      static struct tracepoint_ext __tracepoint_ext_##_name = {       \
 +              .regfunc = _reg,                                        \
 +              .unregfunc = _unreg,                                    \
 +              .faultable = true,                                      \
 +      };                                                              \
 +      __DEFINE_TRACE_EXT(_name, &__tracepoint_ext_##_name, PARAMS(_proto), PARAMS(_args));
 +
 +#define DEFINE_TRACE(_name, _proto, _args)                            \
 +      __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
  
  #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)                            \
        EXPORT_SYMBOL_GPL(__tracepoint_##name);                         \
Simple merge
index ca13659ded4c41908b7392565dcaf9314a9a0e29,b072c197ce9ed2bb4c59126c93795fb3e99ecbba..0e9fee0a4a277eb0fa91fe0eca71502b58563050
  #include <linux/blk-mq.h>
  #include <linux/blk_types.h>
  #include <linux/blkdev.h>
 +#include <linux/cred.h>
  #include <linux/errname.h>
  #include <linux/ethtool.h>
 +#include <linux/file.h>
  #include <linux/firmware.h>
 +#include <linux/fs.h>
  #include <linux/jiffies.h>
+ #include <linux/jump_label.h>
  #include <linux/mdio.h>
  #include <linux/phy.h>
 +#include <linux/pid_namespace.h>
 +#include <linux/poll.h>
  #include <linux/refcount.h>
  #include <linux/sched.h>
 +#include <linux/security.h>
  #include <linux/slab.h>
+ #include <linux/tracepoint.h>
  #include <linux/wait.h>
  #include <linux/workqueue.h>
+ #include <trace/events/rust_sample.h>
  
  /* `bindgen` gets confused at certain things. */
  const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
index 62022b18caf5ec17231fd0e7be1234592d1146e3,17e1b60d178fdf55fc0dd3240d9dc2250c47068b..463b970154de323b6d0910c8645079b9dbe80c96
  #include "bug.c"
  #include "build_assert.c"
  #include "build_bug.c"
 +#include "cred.c"
  #include "err.c"
 +#include "fs.c"
+ #include "jump_label.c"
  #include "kunit.c"
  #include "mutex.c"
  #include "page.c"
index 9843eedd42939617812dcb86ca0ac3e4829862b5,97286b99270e9537c2fee09905c5126393ac491c..29947bb8593b727fb11bbc8aaa5c62b34b0b8bb6
@@@ -35,9 -34,9 +35,10 @@@ pub mod device
  pub mod error;
  #[cfg(CONFIG_RUST_FW_LOADER_ABSTRACTIONS)]
  pub mod firmware;
 +pub mod fs;
  pub mod init;
  pub mod ioctl;
+ pub mod jump_label;
  #[cfg(CONFIG_KUNIT)]
  pub mod kunit;
  pub mod list;