Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2446559rdb; Fri, 8 Dec 2023 08:19:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4cw3DKsDQ/n41E88WihZcb555phOpajZkYZ9OREIk0pAGFDhGYRYEszPM9TxBnEtzY3wa X-Received: by 2002:a05:6a21:33a2:b0:18f:9c4:d332 with SMTP id yy34-20020a056a2133a200b0018f09c4d332mr1617914pzb.34.1702052373019; Fri, 08 Dec 2023 08:19:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702052373; cv=none; d=google.com; s=arc-20160816; b=GMFAdhbUw+RaiZTGkUnc1e5Jye0z91eXVs8YjZ135Tp0exd8yd5HUWM8kgRu4ilJd0 bu0FsV7Ifo1Agbumc1p+E/KmkEf72VBaMjVBX2ld7EgUwd78APLos9ZM8MjHVOyi/4pE Nl+9DYSQUZMwlINCvYhN3AZ+c0IanLCmCggvlu+Ob6gnsmoaMgUhnzOLAe0bmxmYtlOl ChFr1I/8oM7CsRDBSDXds0QKL/82rpcEZg/UtLvMIWPNdu9fSXWYPuGw+idtZvGnGZXe CLVYdbJdF65UpTZwe3hpuY7U9bzbHjeAR5XrrUb1Ea51esijyksYCACOih4S6JpI/h9h tqwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=z+lYtPFLdYgqfi+bVCE0w/Goq5cyv5fzrYGDfQjvUqs=; fh=NATlyvOP3sGI81tdpgstYG6kfA+bFH2HY/QOYKuEneE=; b=bFEA5BLiYFf4l9/NlHwX8VNPg/XFKPfCMs3oX7kZexFGs/xxKbYamqcLl4++Dq9dh+ aqN/sONmPvokokc7ey2JQ7eKlkr+O4PiB2djWv26pC4VEz33OqXJv7fyvJVsuRwSw+Qu 0DDTnq5XboDTZvrMf5JKmTnCHvW/vzc+yxqEiS3Z/nWN1opLVCXNT9o6b6HBiCA/PavJ IJjFmwaBzY4REV//UOxELq96COhX9wD9ETmT+Z4HeYYXFSVWeZBrknJI8JlXaFxFR2Og /xzBj/ckT4BEMQ8JgqTqNQ4NByjBPNipTNOhQKCE5PsAb77q9/lwoyYQXM7FtseIKd+2 CwTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="AuxOW/96"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bw9-20020a056a02048900b005b8eacb29c1si1757333pgb.437.2023.12.08.08.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:19:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="AuxOW/96"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 8399F8084071; Fri, 8 Dec 2023 08:19:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233525AbjLHQTS (ORCPT + 99 others); Fri, 8 Dec 2023 11:19:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232481AbjLHQTQ (ORCPT ); Fri, 8 Dec 2023 11:19:16 -0500 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35135173F; Fri, 8 Dec 2023 08:19:23 -0800 (PST) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-5cdc0b3526eso17038997b3.1; Fri, 08 Dec 2023 08:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702052362; x=1702657162; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=z+lYtPFLdYgqfi+bVCE0w/Goq5cyv5fzrYGDfQjvUqs=; b=AuxOW/96MA3WP6Bu3NBSqnlAPEcnkMvz4FjQyAu7uaKUWgahIwjk8Ea20c2za8PVon 5IaxL8Cq1uMIkZKZq+Y0Caax1OHV9rw7/KCWq70KK0yN1ZqPORa6IQ6r13aQ48FM7r5o /G02aG/P531k5ef9HkJiEa+Y7sq3XmCl0IxS7eki9PUU8wiTaXFMTX+Ol2Lnk4zxUXnb KPQ0UA5T6QeVPsnooSYFsl0gud0LiFw3TmrnnKIU/gB5fyFOGmPqevptG5c5GF3mOyAk iUricYT5sUJ6/KCOsSvP5evwT9W4dtLDxpwDZEBOs8UaNJPSFAcxzrSoYlSZCQbsGFUf Hhlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702052362; x=1702657162; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z+lYtPFLdYgqfi+bVCE0w/Goq5cyv5fzrYGDfQjvUqs=; b=m3TsnYYMVKyM4cFjCOTY9ETIhSMlRQYWoZSqM5rzHHF7Hhvu7paQUbkzsv+ji6aKs5 zCuUy7ZSC3vJTLjTLibyh+XwYkJrRbfLWVgVKVhMsPdTbvSCQFaUZGt7UNqWiGUfkGyh /rg+nk+vEeaG8aju0pJ+Y20Ug3TntXeuS2rRr+UqnFd7uWAgEi7yM9fmRJIqx44ifs/S HZdsocJoMjJ4ntsSRbZVLEHcGWXdJKGgvSmPOfuMyOvp2U20cUV3Oqvg5PPO6ZC4m4XI AZkgyj1djSVCDyqkigvYBOaVBayfljri7Oost7cHWkzC9CKZj3ZkQVwxbc3w5S5emL/P 99TQ== X-Gm-Message-State: AOJu0YwGZ9Lgg/+SABWfKITAkPvX1bKeDJxco4k9rlBilIFc0epdvOro ahRPbIAKsDVeKoGUYZxOyqkWQ4GjYVerwUCJRRc= X-Received: by 2002:a81:9284:0:b0:5d9:3d8e:59e7 with SMTP id j126-20020a819284000000b005d93d8e59e7mr677539ywg.45.1702052362294; Fri, 08 Dec 2023 08:19:22 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Miguel Ojeda Date: Fri, 8 Dec 2023 17:19:10 +0100 Message-ID: Subject: Re: [PATCH 5/7] rust: file: add `Kuid` wrapper To: comex Cc: Christian Brauner , Peter Zijlstra , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alexander Viro , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , 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, Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 08 Dec 2023 08:19:30 -0800 (PST) On Fri, Dec 8, 2023 at 6:28=E2=80=AFAM comex wrote: > > Regarding the issue of wrappers not being inlined, it's possible to get L= LVM 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=3Dx86_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 b= e redundant in cases where kernel-wide LTO is enabled. > > Using this approach might slow down compilation a bit due to needing to p= ass the LLVM bitcode between multiple commands, but probably not very much. > > Just chiming in as someone not involved in Rust for Linux but familiar wi= th these tools. Perhaps this has been considered before and rejected for s= ome reason; I wouldn=E2=80=99t 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=C3=B6rn perhaps). If LLVM folks think LLVM-wise nothing will break, then we are happy to 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