Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2497361rdb; Fri, 8 Dec 2023 09:44:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYP2EaaOcevQ5H3JEjUUj0FleLtROUF7ax1aevHdGrFIhkxHxB6Qt2qAvM/vNXzqmjyGa+ X-Received: by 2002:a17:90a:6582:b0:286:fb49:eb6 with SMTP id k2-20020a17090a658200b00286fb490eb6mr383815pjj.51.1702057472662; Fri, 08 Dec 2023 09:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702057472; cv=none; d=google.com; s=arc-20160816; b=uk52E4L93Mcnm/ge55qdtdHJHa9LLKvR/Gpb5W4Bx2SaA8bxfGaMs8dBDBnQvddAqd m1prO1MGB2GHuRxwJy8yDfqxJM29s50+nlI7WOfKjcVvtk3XW+rxOWmRzkTZvCFzAHtE YCj6wieqYyKodHcAC7RyFWaB36HKHRZNCCZupFhFnN5mqlGEqh3hsAk61ELhqc4o5Lcg R8M/CdMuggtRu07bWeQ2s+VM4p0vOHl2kvY7zDp0f91Vz0Z6ojULAvlFEmtwzihKgbsn IN6N5Z4+MSAxioeaYkC5ff3wrSuCrSAAxO1pGVayx496SrmYIw8pEF7o5mkLY73jCEIr OLIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=STnIY6jHnonlNBGjhvoP/XKEjxCdoqekmjCFEwWOqqs=; fh=I/rCNoHN5kVhtz2DABBvmpaKPc3NR0/fhpo3Ks6+7YU=; b=UCpGXurhnzWVFCKGUpyPIknJ23qwXhsWsWdPnkT2NHbvgz54BrRyVPJivF8qZDgRHT 5OwsFzRvz3GIukL5atB3rKYSLT9YF0dbOz0PXg+ZuVt6/KAThDgZKI5zZjI1HnEfBxvY uTPKWUFdWM1XYXOkDRdNqsPVXrUKYU1dCOyhWM5cRJHRgKnclNLOF59VEhooxRUOYs0Y tnd1NmTVKP8xybbWkXhgdvIFxOc411/MldnnFnNVHg3yFzD+i9NoY6V9uZCmNMbwBTBO a2TrWJ/y+v5so3caFCmwybFqJZWg+thSvUqQ/dbeVujqXqROktMg+DuVnEfHOOjJvES5 GJRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="R/9D5yry"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id r7-20020a170902be0700b001d0c205708fsi1839072pls.186.2023.12.08.09.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:44:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="R/9D5yry"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DE63582E6C09; Fri, 8 Dec 2023 09:44:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjLHRoL (ORCPT + 99 others); Fri, 8 Dec 2023 12:44:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbjLHRoJ (ORCPT ); Fri, 8 Dec 2023 12:44:09 -0500 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74B47123; Fri, 8 Dec 2023 09:44:15 -0800 (PST) Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b83fc26e4cso1495220b6e.2; Fri, 08 Dec 2023 09:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702057455; x=1702662255; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=STnIY6jHnonlNBGjhvoP/XKEjxCdoqekmjCFEwWOqqs=; b=R/9D5yryzeBwlns2fWxYB9mVg6xgKF9etEDsO7YvVAKJrjzKPlLhqfPy/a+EXnBWG4 DraJxuTGQVZkvqutvStNe/cLZb5DQEIk5WpzOc98YT6YfECY/bP/SCEtaXNtEPG4+J+Q xh+yHFisuh9L9so5hIG5XrnlqlWLQfQ2oyFo464RtOwR+sKtsqwxutCfBiBRYPdNRXxo ULJh3KpeQfk/LAGA/enkHiv0tSzvFn98/w3ihK2gWJER/l9bKJ7aQxcOZiLa8AmQfE7d P8vitSAP8SeUxzkxy4neTTpYxrRTcjsEoBDbygvKeEnXZHXLmA3ge0H0pWB+q++g7uww kNZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702057455; x=1702662255; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=STnIY6jHnonlNBGjhvoP/XKEjxCdoqekmjCFEwWOqqs=; b=FBfII8UqbC7lWG9sDPzR0WYPgf1Va3lNbkEINr14U0zDkQoJJkHIL2NX5qPOPNx54B VRLbTPqB4MAs605J1pwhSNhLyvD5lWDbsoHDTAdC4CPDVxcdaTFDHSZTFWtJWnCl4YZK X2osy5Hs98szjJwulmcHksaNgQXhrf3lr6Y9uMcLNOZCuohnIN42zmVNCyGNnNKbQGA9 BQSC+xD7c0I9SYa6h/MKExAC7Ben6GN4nzqDVvViNiV/f/UuxEzIXzHM3irbDvdZJPRe rMsvih7EJ83cqTKoNyGpXxJWqzkpw6ZXmCRtBJQSCODSaFLK4f+8tGTs7v0rEqgrHiRp 9IJg== X-Gm-Message-State: AOJu0YxnDPs2jZZueA2httz5Eec6uZ/zF9a51cKtCs3AaDqJitIU/XXk RhXFFwMtXjwSKf+0Rph12+k= X-Received: by 2002:a05:6808:124a:b0:3b8:b063:8261 with SMTP id o10-20020a056808124a00b003b8b0638261mr354407oiv.99.1702057454735; Fri, 08 Dec 2023 09:44:14 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id ud11-20020a05620a6a8b00b0077d90497738sm841756qkn.102.2023.12.08.09.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:44:14 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id A51C027C0054; Fri, 8 Dec 2023 12:44:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 08 Dec 2023 12:44:13 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudekiedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtugfgjgesthekredttddtjeenucfhrhhomhepueho qhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtf frrghtthgvrhhnpeevgffhueevkedutefgveduuedujeefledthffgheegkeekiefgudek hffggeelfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeeh tdeigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmse hfihigmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Dec 2023 12:44:11 -0500 (EST) Date: Fri, 8 Dec 2023 09:43:00 -0800 From: Boqun Feng To: Nick Desaulniers Cc: Miguel Ojeda , comex , Christian Brauner , Peter Zijlstra , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alexander Viro , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Kees Cook , Matthew Wilcox , Thomas Gleixner , Daniel Xu , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 5/7] rust: file: add `Kuid` wrapper Message-ID: References: <20231129-alice-file-v1-0-f81afe8c7261@google.com> <20231129-alice-file-v1-5-f81afe8c7261@google.com> <20231129-etappen-knapp-08e2e3af539f@brauner> <20231129164815.GI23596@noisy.programming.kicks-ass.net> <20231130-wohle-einfuhr-1708e9c3e596@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:44:29 -0800 (PST) On Fri, Dec 08, 2023 at 09:08:47AM -0800, Nick Desaulniers wrote: > On Fri, Dec 8, 2023 at 8:19 AM Miguel Ojeda > wrote: > > > > On Fri, Dec 8, 2023 at 6:28 AM comex wrote: > > > > > > Regarding the issue of wrappers not being inlined, it's possible to get LLVM to optimize C and Rust code together into an object file, with the help of a compatible Clang and LLD: > > > > > > @ rustc -O --emit llvm-bc a.rs > > > @ clang --target=x86_64-unknown-linux-gnu -O2 -c -emit-llvm -o b.bc b.c > > > @ ld.lld -r -o c.o a.bc b.bc > > > > > > Basically LTO but within the scope of a single object file. This would be redundant in cases where kernel-wide LTO is enabled. > > > > > > Using this approach might slow down compilation a bit due to needing to pass the LLVM bitcode between multiple commands, but probably not very much. > > > > > > Just chiming in as someone not involved in Rust for Linux but familiar with these tools. Perhaps this has been considered before and rejected for some reason; I wouldn’t know. > > > > Thanks comex for chiming in, much appreciated. > > > > Yeah, this is what we have been calling the "local-LTO hack" and it > > was one of the possibilities we were considering for non-LTO kernel > > builds for performance reasons originally. I don't recall who > > originally suggested it in one of our meetings (Gary or Björn > > perhaps). > > > > If LLVM folks think LLVM-wise nothing will break, then we are happy to > > On paper, nothing comes to mind. No promises though. > > From a build system perspective, I'd rather just point users towards > LTO if they have this concern. We support full and thin lto. This > proposal would add a third variant for just rust drivers. Each > variation on LTO has a maintenance cost and each have had their own > distinct fun bugs in the past. Not sure an additional variant is > worth the maintenance cost, even if it's technically feasible. > Actually, the "LTO" in "local-LTO" may be misleading ;-) The problem we want to resolve here is letting Rust code call small C functions (or macros) without exporting the symbols. To me, it's really just "static linking" a library (right now it's rust/helpers.o) contains small C functions and macros used by Rust into a Rust driver kmodule, the "LTO" part can be optional: let the linker make the call. Regards, Boqun > > go ahead with that (since it also solves the performance side), but it > > would be nice to know if it will always be OK to build like that, i.e. > > I think Andreas actually tried it and it seemed to work and boot, but > > the worry is whether there is something subtle that could have bad > > codegen in the future. > > > > (We will also need to worry about GCC.) > > > > Cheers, > > Miguel > > > > -- > Thanks, > ~Nick Desaulniers