Fix CI and sync with Linux 6.12#23
Conversation
a8ed63c to
8dafd4c
Compare
new_uninit is stable as of 1.82.0, there is no need to require it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Some of the error messages have changed in nightly Rust, since the .stderr files were last checked. Update everything. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8dafd4c to
b74dc46
Compare
|
Successful CI run at bonzini#1 |
b74dc46 to
3cc7086
Compare
|
thanks for the PR! I am currently very busy, so I might take some time before getting this in |
|
Thanks, could you at least approval the workflow so that I can fix any issues? |
|
there is one issue with a ui test that the main branch is also failing at the moment, so I expect it to also fail here. I'll fix that (hopefully) soon |
|
I think it's one of those that I fixed. :) |
|
Ping - is there anything I can do to help? I have changed the purpose of this pull request to sync pinned_init with upstream Linux, for example the |
3cc7086 to
3c5272d
Compare
ba238fa to
d3aab51
Compare
BennoLossin
left a comment
There was a problem hiding this comment.
Sorry for keeping you waiting.
Thanks a lot for this, it's very helpful that you properly cherry picked the commits and added your signed-off-by! Very much appreciated!
Just two comments with regards to your changes. Other than that it looks good!
Use the same implementation for both examples/error.rs and examples/pthread_mutex.rs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reuse examples/error.rs so that the error returned by EvenU64::new2() is not core::alloc::AllocError. This will allow running the test without the allocator_api feature. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The big_struct_in_place example only uses init!, which has no dependency on the allocator API (which provides the functionality of fallible initialization). Do not enable allocator_api. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
A new complexity lint, `manual_inspect` [1], has been introduced in
the upcoming Rust 1.81 (currently in nightly), which checks for uses of
`map*` which return the original item:
error:
--> rust/kernel/init.rs:846:23
|
846 | (self.1)(val).map_err(|e| {
| ^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
= note: `-D clippy::manual-inspect` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_inspect)]`
help: try
|
846 ~ (self.1)(val).inspect_err(|e| {
847 | // SAFETY: `slot` was initialized above.
848 ~ unsafe { core::ptr::drop_in_place(slot) };
|
Thus clean them up.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#/manual_inspect [1]
Tested-by: Benno Lossin <benno.lossin@proton.me>
Tested-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20240709160615.998336-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit dee1396a486cf2b6e7840322f6d104680649f2ff)
The initializers created by the `[try_][pin_]init!` macros utilize the
guard pattern to drop already initialized fields, when initialization
fails mid-way. These guards are generated to have the same name as the
field that they handle. To prevent namespacing issues [1] when the
field name is the same as e.g. a constant name, add `__` as a prefix
and `_guard` as the suffix.
[ Gary says:
"Here's the simplified example:
```
macro_rules! f {
() => {
let a = 1;
let _: u32 = a;
}
}
const a: u64 = 1;
fn main() {
f!();
}
```
The `a` in `f` have a different hygiene so normally it is scoped to the
macro expansion and wouldn't escape. Interestingly a constant is still
preferred despite the hygiene so constants escaped into the macro,
leading to the error."
- Miguel ]
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/rust-for-linux/1e8a2a1f-abbf-44ba-8344-705a9cbb1627@proton.me/ [1]
Link: https://lore.kernel.org/r/20240403194321.88716-1-benno.lossin@proton.me
[ Added Benno's link and Gary's simplified example. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 9218cf826f1dbacbb857e6eabfae164d8ba05dea)
Fix spelling mistakes in code comments. Signed-off-by: Michael Vetter <jubalh@iodoru.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20240819205731.2163-1-jubalh@iodoru.org [ Reworded slightly. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 0ff8f3f0979559b0d7494d580f2597beab3f159b)
Sometimes it is necessary to split allocation and initialization into two steps. One such situation is when reusing existing allocations obtained via `Box::drop_contents`. See [1] for an example. In order to support this use case add `write_[pin_]init` functions to the pin-init API. These functions operate on already allocated smart pointers that wrap `MaybeUninit<T>`. Link: https://lore.kernel.org/rust-for-linux/f026532f-8594-4f18-9aa5-57ad3f5bc592@proton.me/ [1] Signed-off-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20240819112415.99810-2-benno.lossin@proton.me Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 6d1c22d0ace31d096b0dab5318c6a0d3219d6456)
Add a macro to statically check if a field of a struct is marked with `#[pin]` ie that it is structurally pinned. This can be used when `unsafe` code needs to rely on fields being structurally pinned. The macro has a special "inline" mode for the case where the type depends on generic parameters from the surrounding scope. Signed-off-by: Benno Lossin <benno.lossin@proton.me> Co-developed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240814-linked-list-v5-1-f5f5e8075da0@google.com [ Replaced `compile_fail` with `ignore` and a TODO note. Removed `pub` from example to clean `unreachable_pub` lint. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 0528ca0a4f858da3369d405af8c76b8248dfeb7b)
d3aab51 to
aba4422
Compare
|
thanks a lot! this was really helpful! |
I've decided to retarget this PR to just syncing with Linux 6.12 before making further changes. In particular this brings in the
InPlaceWritetrait.Old text
It is actually not that hard to makepinned_initusable with stable Rust. In particular:new_uninithas been stabilized (and anyway in the end it was just a glorifiedBox::<MaybeUninit<T>>::new())allocator_apiis needed to have fallible allocation, but not if you just replacecore::alloc::AllocErrorwithcore::convert::Infallibleget_mut_uncheckedis needed if you needArc, but otherwise is not necessary.This pull request fixes CI and isolates a little bit more the pieces of code that refer toArcorfeature(allocator_api). The idea is that these are mostly uncontroversial changes that should not hamper readability and maintainability, and therefore can be committed separately.Please let me know if I should submit separately the small changes tosrc/lib.rs, for example via the rust-for-linux mailing list.