From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECF26CF6495 for ; Sun, 29 Sep 2024 15:17:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 483DC6B0111; Sun, 29 Sep 2024 11:17:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 433E76B0130; Sun, 29 Sep 2024 11:17:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FC926B012D; Sun, 29 Sep 2024 11:17:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 109F86B024B for ; Sun, 29 Sep 2024 11:17:34 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 86A26140804 for ; Sun, 29 Sep 2024 15:17:33 +0000 (UTC) X-FDA: 82618129986.16.668927F Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf14.hostedemail.com (Postfix) with ESMTP id ECD2A10000A for ; Sun, 29 Sep 2024 15:17:31 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=itBWcsI5; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727623013; a=rsa-sha256; cv=none; b=sCvaKpLNGN/xTEGSeeLuv2khCFrsu+eVlStjHaQEs+6uDPKer5KDGVRy1j2J5a/hQVEBYG NrMxb4gR5scxlazcsQvryhLFnq01wjJ1v8WVV8qAfkxz9qxIZolLpk7TX/bvnxgwE22LZ2 IspkxMecaMv7wOWzBQOjnOQWrEE8j30= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=itBWcsI5; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727623013; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CE3rv4croqMYfG1sToAQm3lXh3fBP9EvO10IOvO1jtk=; b=gV4Fs1ZJP3Zi/skl1kX/dq365s9rxoUJs22YtXzIJrsM7zDJdugZzUrpXjFaa2yXlgAabf EsQpJmwP7eG9osv6Gk5XSTtSf2w75K0ONfxwk4bGyyMYDGFD4+zcFyjShg4LjgxXpY/sr1 cpVzb0sVZ8wptW1Qtei+oJFZZ3i2fzU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AFEABA40D52; Sun, 29 Sep 2024 15:17:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C03C4CEC5; Sun, 29 Sep 2024 15:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727623050; bh=eQylGUNRxchABfJswjanp/s+IOJknU6kiHFdLqGmXTI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=itBWcsI5uSxHOMUI+hnyql50fUWWO1cwMCySRGDRJW3pELQFcx2w0m51e83B+aYe3 x0e8Mnov2bCUzmpT7mdROBFZ3Z6j9hWUfj5IyBlI0Wln+W08YWPYW68OcsM3+LcpOg 8YuZAMwZz05dAIjJUtk85hqL5B/G7+Fj4lMzzRtfe8JyMI7LEdI3Pi+DTgzOpWOJbp 5+3gOPe5Wk7u5v7EHEuo0INXe2epKLS70bBPE4+1xRavjo79tnDRkglBDoJkzF6hVS lKOTbaEhfL0h6avtYuXOO7wgfUZ8ScSK5b2/Y7wNEL+UTW6SjBCUvP4qJdMfIf/8xp dZ0Pc71VP8XHA== Date: Sun, 29 Sep 2024 17:17:23 +0200 From: Danilo Krummrich To: Gary Guo Cc: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com, boqun.feng@gmail.com, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@samsung.com, aliceryhl@google.com, akpm@linux-foundation.org, daniel.almeida@collabora.com, faith.ekstrand@collabora.com, boris.brezillon@collabora.com, lina@asahilina.net, mcanal@igalia.com, zhiw@nvidia.com, cjia@nvidia.com, jhubbard@nvidia.com, airlied@redhat.com, ajanulgu@redhat.com, lyude@redhat.com, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v7 25/26] kbuild: rust: remove the `alloc` crate and `GlobalAlloc` Message-ID: References: <20240911225449.152928-1-dakr@kernel.org> <20240911225449.152928-26-dakr@kernel.org> <20240928204357.3a28dada.gary@garyguo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240928204357.3a28dada.gary@garyguo.net> X-Rspam-User: X-Rspamd-Queue-Id: ECD2A10000A X-Rspamd-Server: rspam01 X-Stat-Signature: gf47mg4xqzkh15byhrh7hnoffft5zbhj X-HE-Tag: 1727623051-657342 X-HE-Meta: U2FsdGVkX1/JoBGH9BQU2yf0hWUHo79nR9CX/YOxF53MLsGrmbMbkDiJTY8psKHFylbh6xdGQZhTPRCzrXKrdKaRf03xfetsWLDwZj5hdnDgiCdjgIlHTjUauUi6xdqUcidM8w8+ZFwVqd6K0x5n7wP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JAjKFWouV4kUq7Y84tZGO19lvw8ON8MqeJqkvORu55UlTHfODK6yvMCuBB1elYbKVF2pEY5JdiR5A6Jor6cZok1zL/H8ffvnNQTAuEN8Ut+R X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, Sep 28, 2024 at 08:43:57PM +0100, Gary Guo wrote: > On Thu, 12 Sep 2024 00:53:01 +0200 > Danilo Krummrich wrote: > > > Now that we have our own `Allocator`, `Box` and `Vec` types we can remove > > Rust's `alloc` crate and the `new_uninit` unstable feature. > > > > Also remove `Kmalloc`'s `GlobalAlloc` implementation -- we can't remove > > this in a separate patch, since the `alloc` crate requires a > > `#[global_allocator]` to set, that implements `GlobalAlloc`. > > > > Signed-off-by: Danilo Krummrich > > --- > > rust/Makefile | 43 +++++---------------- > > rust/exports.c | 1 - > > rust/kernel/alloc/allocator.rs | 63 +------------------------------ > > scripts/Makefile.build | 7 +--- > > scripts/generate_rust_analyzer.py | 11 +----- > > 5 files changed, 15 insertions(+), 110 deletions(-) > > > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > > index 72b1232b1f7d..529ec5972e55 100644 > > --- a/scripts/Makefile.build > > +++ b/scripts/Makefile.build > > @@ -262,18 +262,13 @@ $(obj)/%.lst: $(obj)/%.c FORCE > > > > # Compile Rust sources (.rs) > > # --------------------------------------------------------------------------- > > - > > -rust_allowed_features := new_uninit > > - > > Would it make sense to throw in a soon-to-be-stable (or > already-stable-but-beyond-min-rust-version) feature here to not have to > remove the build system support for unstable feature directly? It's only about those two lines, right? I can only remove the `new_uninit` and leave `rust_allowed_features :=` and leave... > > For example, I know that const_refs_to_static might be added here > soon-ish. > > > # `--out-dir` is required to avoid temporaries being created by `rustc` in the > > # current working directory, which may be not accessible in the out-of-tree > > # modules case. > > rust_common_cmd = \ > > RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \ > > - -Zallow-features=$(rust_allowed_features) \ ...this line, I guess? > > I think this actually allow all features instead of allowing none. > > > -Zcrate-attr=no_std \ > > - -Zcrate-attr='feature($(rust_allowed_features))' \ > > - -Zunstable-options --extern force:alloc --extern kernel \ > > + -Zunstable-options --extern kernel \ > > --crate-type rlib -L $(objtree)/rust/ \ > > --crate-name $(basename $(notdir $@)) \ > > --sysroot=/dev/null \ > > diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py > > index d2bc63cde8c6..09e1d166d8d2 100755 > > --- a/scripts/generate_rust_analyzer.py > > +++ b/scripts/generate_rust_analyzer.py > > @@ -64,13 +64,6 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): > > [], > > ) > > > > - append_crate( > > - "alloc", > > - sysroot_src / "alloc" / "src" / "lib.rs", > > - ["core", "compiler_builtins"], > > - cfg=crates_cfgs.get("alloc", []), > > - ) > > - > > append_crate( > > "macros", > > srctree / "rust" / "macros" / "lib.rs", > > @@ -96,7 +89,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): > > append_crate( > > "kernel", > > srctree / "rust" / "kernel" / "lib.rs", > > - ["core", "alloc", "macros", "build_error", "bindings"], > > + ["core", "macros", "build_error", "bindings"], > > cfg=cfg, > > ) > > crates[-1]["source"] = { > > @@ -133,7 +126,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): > > append_crate( > > name, > > path, > > - ["core", "alloc", "kernel"], > > + ["core", "kernel"], > > cfg=cfg, > > ) > > >