Greg Kroah-Hartman
dfed1574cd
Merge 1ef4cf5f98 ("rust: alloc: update module comment of alloc.rs") into android16-6.12
...
Steps on the way to 6.12.18
Resolves merge conflicts in:
rust/kernel/types.rs
scripts/Makefile.build
Change-Id: I1a0d7a30074e2532f53b9c9d4cf0e8346d57ffef
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com >
[Re-resolved rust/kernel/types.rs <mmaurer@google.com >]
Signed-off-by: Matthew Maurer <mmaurer@google.com >
2025-04-07 05:41:55 -07:00
Miguel Ojeda
9a21fc9a4f
UPSTREAM: samples: rust: fix rust_print build making it a combined module
...
The `rust_print` module, when built as a module, fails to build with:
ERROR: modpost: missing MODULE_LICENSE() in samples/rust/rust_print_events.o
ERROR: modpost: "__tracepoint_rust_sample_loaded" [samples/rust/rust_print.ko] undefined!
ERROR: modpost: "rust_do_trace_rust_sample_loaded" [samples/rust/rust_print.ko] undefined!
Fix it by building it as a combined one.
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Alex Gaynor <alex.gaynor@gmail.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Gary Guo <gary@garyguo.net >
Cc: Björn Roy Baron <bjorn3_gh@protonmail.com >
Cc: Benno Lossin <benno.lossin@proton.me >
Cc: Andreas Hindborg <a.hindborg@kernel.org >
Cc: Alice Ryhl <aliceryhl@google.com >
Cc: Trevor Gross <tmgross@umich.edu >
Cc: "Linux Next Mailing List" <linux-next@vger.kernel.org >
Link: https://lore.kernel.org/20241111220805.708889-1-ojeda@kernel.org
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au >
Closes: https://lore.kernel.org/all/20241108152149.28459a72@canb.auug.org.au/
Fixes: 91d39024e1b0 ("rust: samples: add tracepoint to Rust sample")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
Bug: 389867843
Change-Id: Iafb019dd26de619763198f02425163eafd2b9888
(cherry picked from commit 22193c586b43ee88d66954395885742a6e4a49a9)
Signed-off-by: Alice Ryhl <aliceryhl@google.com >
2025-01-23 23:42:02 -08:00
Alice Ryhl
6a9226bda2
UPSTREAM: rust: samples: add tracepoint to Rust sample
...
This updates the Rust printing sample to invoke a tracepoint. This
ensures that we have a user in-tree from the get-go even though the
patch is being merged before its real user.
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Josh Poimboeuf <jpoimboe@kernel.org >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Ard Biesheuvel <ardb@kernel.org >
Cc: Miguel Ojeda <ojeda@kernel.org >
Cc: Alex Gaynor <alex.gaynor@gmail.com >
Cc: Wedson Almeida Filho <wedsonaf@gmail.com >
Cc: Gary Guo <gary@garyguo.net >
Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com >
Cc: Benno Lossin <benno.lossin@proton.me >
Cc: Andreas Hindborg <a.hindborg@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: Sean Christopherson <seanjc@google.com >
Cc: Uros Bizjak <ubizjak@gmail.com >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Will Deacon <will@kernel.org >
Cc: Marc Zyngier <maz@kernel.org >
Cc: Oliver Upton <oliver.upton@linux.dev >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Ryan Roberts <ryan.roberts@arm.com >
Cc: Fuad Tabba <tabba@google.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Anup Patel <apatel@ventanamicro.com >
Cc: Andrew Jones <ajones@ventanamicro.com >
Cc: Alexandre Ghiti <alexghiti@rivosinc.com >
Cc: Conor Dooley <conor.dooley@microchip.com >
Cc: Samuel Holland <samuel.holland@sifive.com >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: WANG Xuerui <kernel@xen0n.name >
Cc: Bibo Mao <maobibo@loongson.cn >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Tianrui Zhao <zhaotianrui@loongson.cn >
Link: https://lore.kernel.org/20241030-tracepoint-v12-3-eec7f0f8ad22@google.com
Reviewed-by: Boqun Feng <boqun.feng@gmail.com >
Signed-off-by: Alice Ryhl <aliceryhl@google.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
Bug: 389867843
Change-Id: I4067a85c8688c91db0a8ba96319e7d957a4a42c7
(cherry picked from commit 91d39024e1b02914cc5e2dbc137908e29b269ce4)
Signed-off-by: Alice Ryhl <aliceryhl@google.com >
2025-01-23 23:42:02 -08:00
Wedson Almeida Filho
cc41670e06
rust: sync: update Arc and UniqueArc to take allocation flags
...
We also remove the `try_` prefix to align with how `Box` and `Vec` are
providing methods now.
`init` is temporarily updated with uses of GFP_KERNEL. These will be
updated in a subsequent patch to take flags as well.
Reviewed-by: Benno Lossin <benno.lossin@proton.me >
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com >
Link: https://lore.kernel.org/r/20240328013603.206764-9-wedsonaf@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2024-04-16 22:50:04 +02:00
Wedson Almeida Filho
5ab560ce12
rust: alloc: update VecExt to take allocation flags
...
We also rename the methods by removing the `try_` prefix since the names
are available due to our usage of the `no_global_oom_handling` config
when building the `alloc` crate.
Reviewed-by: Boqun Feng <boqun.feng@gmail.com >
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com >
Reviewed-by: Benno Lossin <benno.lossin@proton.me >
Link: https://lore.kernel.org/r/20240328013603.206764-8-wedsonaf@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2024-04-16 22:50:04 +02:00
Boqun Feng
f431c5c581
samples: rust: print: Add sample code for Arc printing
...
This both demonstrates the usage of different print format in Rust and
serves as a selftest for the `Display` and `Debug` implementation of
`Arc` and its friends.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com >
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com >
Reviewed-by: Finn Behrens <fin@nyantec.com >
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com >
Reviewed-by: Gary Guo <gary@garyguo.net >
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com >
Link: https://lore.kernel.org/r/20230207185216.1314638-3-boqun.feng@gmail.com
[ Applied suggestions and reworded for fixing title typos. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2023-04-10 05:05:43 +02:00
Gary Guo
b13c9880f9
rust: macros: take string literals in module!
...
Instead of taking binary string literals, take string ones instead,
making it easier for users to define a module, i.e. instead of
calling `module!` like:
module! {
...
name: b"rust_minimal",
...
}
now it is called as:
module! {
...
name: "rust_minimal",
...
}
Module names, aliases and license strings are restricted to
ASCII only. However, the author and the description allows UTF-8.
For simplicity (avoid parsing), escape sequences and raw string
literals are not yet handled.
Link: https://github.com/Rust-for-Linux/linux/issues/252
Link: https://lore.kernel.org/lkml/YukvvPOOu8uZl7+n@yadro.com/
Signed-off-by: Gary Guo <gary@garyguo.net >
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2022-12-04 01:59:15 +01:00
Miguel Ojeda
c3630df66f
rust: samples: add rust_print example
...
Add example to exercise the printing macros (`pr_*!`) introduced
in the previous patches.
Reviewed-by: Finn Behrens <me@kloenk.dev >
Reviewed-by: Wei Liu <wei.liu@kernel.org >
Tested-by: Sergio González Collado <sergio.collado@gmail.com >
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2022-12-01 20:13:11 +01:00
Miguel Ojeda
e4fc6580b0
samples: add first Rust examples
...
The beginning of a set of Rust modules that showcase how Rust
modules look like and how to use the abstracted kernel features.
It also includes an example of a Rust host program with
several modules.
These samples also double as tests in the CI.
Reviewed-by: Kees Cook <keescook@chromium.org >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com >
Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com >
Co-developed-by: Finn Behrens <me@kloenk.de >
Signed-off-by: Finn Behrens <me@kloenk.de >
Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com >
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com >
Co-developed-by: Milan Landaverde <milan@mdaverde.com >
Signed-off-by: Milan Landaverde <milan@mdaverde.com >
Signed-off-by: Miguel Ojeda <ojeda@kernel.org >
2022-09-28 09:03:08 +02:00