From: Andreas Hindborg <nmi@metaspace.dk>
To: Asahi Lina <lina@asahilina.net>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Nicolas Schier" <nicolas@fjasle.eu>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org, asahi@lists.linux.dev
Subject: Re: [PATCH] rust: Enable the new_uninit feature for kernel and driver crates
Date: Mon, 27 Feb 2023 15:34:38 +0100 [thread overview]
Message-ID: <875ybn9nsx.fsf@metaspace.dk> (raw)
In-Reply-To: <96cb824e-8251-a329-11e5-3618a4e59bc8@asahilina.net>
Asahi Lina <lina@asahilina.net> writes:
> On 27/02/2023 22.09, Andreas Hindborg wrote:
>>
>> Asahi Lina <lina@asahilina.net> writes:
>>
>>> The unstable new_uninit feature enables various library APIs to create
>>> uninitialized containers, such as `Box::assume_init()`. This is
>>> necessary to build abstractions that directly initialize memory at the
>>> target location, instead of doing copies through the stack.
>>>
>>> Will be used by the DRM scheduler abstraction in the kernel crate, and
>>> by field-wise initialization (e.g. using `place!()` or a future
>>> replacement macro which may itself live in `kernel`) in driver crates.
>>>
>>> See [1] [2] [3] for background information.
>>>
>>> [1] https://github.com/Rust-for-Linux/linux/issues/879
>>> [2] https://github.com/Rust-for-Linux/linux/issues/2
>>> [3] https://github.com/rust-lang/rust/issues/63291
>>>
>>> Signed-off-by: Asahi Lina <lina@asahilina.net>
>>> ---
>>> rust/kernel/lib.rs | 1 +
>>> scripts/Makefile.build | 2 +-
>>> 2 files changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
>>> index 223564f9f0cc..1118cd3e0b5f 100644
>>> --- a/rust/kernel/lib.rs
>>> +++ b/rust/kernel/lib.rs
>>> @@ -17,6 +17,7 @@
>>> #![feature(core_ffi_c)]
>>> #![feature(dispatch_from_dyn)]
>>> #![feature(generic_associated_types)]
>>> +#![feature(new_uninit)]
>>> #![feature(receiver_trait)]
>>> #![feature(unsize)]
>>>
>>> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
>>> index a0d5c6cca76d..0f637e1ca8dc 100644
>>> --- a/scripts/Makefile.build
>>> +++ b/scripts/Makefile.build
>>> @@ -277,7 +277,7 @@ $(obj)/%.lst: $(src)/%.c FORCE
>>> # Compile Rust sources (.rs)
>>> # ---------------------------------------------------------------------------
>>>
>>> -rust_allowed_features := core_ffi_c
>>> +rust_allowed_features := core_ffi_c,new_uninit
>>
>> What is the purpose of adding the feature here? The kernel crate seems
>> to compile fine without this.
>
> It's for the upcoming DRM abstractions, as I mentioned in the commit
> message. There's so many dependencies that I'm trying to get as much as
> I can early to avoid having to review very big patchsets down the line ^^
I got confused on the different makefile rules used to build kernel
crate vs module crates. Looks good 👍
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
next prev parent reply other threads:[~2023-02-27 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 8:09 [PATCH] rust: Enable the new_uninit feature for kernel and driver crates Asahi Lina
2023-02-24 14:01 ` Martin Rodriguez Reboredo
2023-02-25 0:45 ` Gary Guo
2023-02-27 13:09 ` Andreas Hindborg
2023-02-27 13:47 ` Asahi Lina
2023-02-27 14:34 ` Andreas Hindborg [this message]
2023-02-27 13:48 ` Miguel Ojeda
2023-03-01 17:24 ` Vincenzo Palazzo
2023-04-10 2:54 ` Miguel Ojeda
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=875ybn9nsx.fsf@metaspace.dk \
--to=nmi@metaspace.dk \
--cc=alex.gaynor@gmail.com \
--cc=asahi@lists.linux.dev \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=lina@asahilina.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/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