Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3216412rwb; Mon, 19 Sep 2022 17:22:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61VLJB140Ydl1A3h633qQ9n2x3URzPnMkUdksFXJ/6HmD626PXIE0d01qQ9yylz7tFxn51 X-Received: by 2002:a17:906:8457:b0:779:9f0a:fb with SMTP id e23-20020a170906845700b007799f0a00fbmr15070010ejy.665.1663633358444; Mon, 19 Sep 2022 17:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663633358; cv=none; d=google.com; s=arc-20160816; b=RkD+YlFJCGPFh0OigilHxQkhm21m9XYmBRUSV8yUrR7sYSQ5NpS8/ax0T4R3ShC4B9 Ee1HNZ4PcZvpRm8b1nuEQrTCUbfEN1XtIAmwtSLPeC+xv7bs2/akC+p2yuodfqEBTRTq ZG//7kdqLvllkkJkFGhVsgePoqj1wCoJHPAIcCl77vsdHzRGNqPufn7z7tx1RPpxfr82 +Ka8o6yvIZHSqtzBP4Ykjtjo8ez9w8WNlvlbwIRn3EGRiTGHbbuQv7eRqkweUeyRABg8 KR9DkHu40GkwWzkneC6YZYL5iQTy7lH3FFL9YViqlgwIhuvJ9NYyqCSZzP1K1XKWkXf5 KfkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BgWrStjazBL3noD9/vk03t6GhWMu6WHkO8oDZrwsiw4=; b=NLpenAYcYXuCQeVH0sI4IwENfGK4+J2KWKgEZGKMHZsL9VQvkfHNRqD0aUR0j6vLiQ g9LwsF/Yn+2Y6YHEObytkG00eDwlo/z4VJJ9ee+NrJntoALTlw3C/LTSwRJ/qpo2rwOF YJMS93sbthDh5jYW1xG4Qk9C9LwtGnFvoQiGO1A1iCjbrPHGC2dlAzb2oMem97wxgYNu oibbo4jnmsqbeiPe4M1+Av+lzde0zi/tfu9EDiBVjvtJurgxaifFtfIZ1uIJeWSVQSwN KPYlhy5ExWaMljia5YNxFz28zDs9H/7daussEjkKaqY5RqE7lpB+K4ZJN349iPHlItjw sWQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SJSO8IZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a0564021f8800b004538d5058a5si41040edc.510.2022.09.19.17.22.12; Mon, 19 Sep 2022 17:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SJSO8IZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbiITAPr (ORCPT + 99 others); Mon, 19 Sep 2022 20:15:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiITAPo (ORCPT ); Mon, 19 Sep 2022 20:15:44 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66102140C6 for ; Mon, 19 Sep 2022 17:15:43 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id sb3so2371316ejb.9 for ; Mon, 19 Sep 2022 17:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=BgWrStjazBL3noD9/vk03t6GhWMu6WHkO8oDZrwsiw4=; b=SJSO8IZCt0Y5kVGyIwQdueMBTnqTxxL958lu9VE+yxSsYNOU0eyCEEmnqg94jyfjNV KNmUMvZPN7glZM0GJC6KmElL09bXeF6IzD009CSYWLhp9dSWYCICBezT84oZ8V12JkEM /7eszFNQyjg/zQP3c6u5LG9DPaqw5laxsPfEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=BgWrStjazBL3noD9/vk03t6GhWMu6WHkO8oDZrwsiw4=; b=PePleT5jwQd8NI5ulvQedRZ9g1G1f/YMyEOdW8BiOjnmUtBXadwb39EcIOK82olqRP 7hnuboLldW1fAP6OcLYoEkqkWiOovE40Uq8wGyME8ZuBtCV2wEia6SsAs5srFrSXSDuH Syw2MLcDhHCaSfbLCb4tmj4zB3EuR40TkgCjQ7y29+J5MweQpg9fIheFpQVxZNYG4ns1 GLXfs1+j/8uvW/DNQjCBlN5JdKrdU/E0OVcmCVXJkAiD/0Cx0spivLGGTEa0NRonTG7u 2LAqKvLAeoQjYTTFcMJhJrgz+MnJpApwy1qldsnd+RSsqjX/YvWkjuZT5A65fhPoxHLi byaA== X-Gm-Message-State: ACrzQf3Aj+r918fzzIs+rT8YyEaKDceTzwJ2Ka56+FdaZvPKwVNXWdId PfT4npChVc+ky97kZpI/EG6EqbOsay5juC64ZG8= X-Received: by 2002:a17:907:6e2a:b0:780:6ace:7a93 with SMTP id sd42-20020a1709076e2a00b007806ace7a93mr15027700ejc.186.1663632941433; Mon, 19 Sep 2022 17:15:41 -0700 (PDT) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id fe5-20020a056402390500b0044e6802623dsm60447edb.18.2022.09.19.17.15.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Sep 2022 17:15:41 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id r7so1706056wrm.2 for ; Mon, 19 Sep 2022 17:15:41 -0700 (PDT) X-Received: by 2002:a19:4f45:0:b0:49a:63c9:190d with SMTP id a5-20020a194f45000000b0049a63c9190dmr6637732lfk.61.1663632930544; Mon, 19 Sep 2022 17:15:30 -0700 (PDT) MIME-Version: 1.0 References: <20220805154231.31257-13-ojeda@kernel.org> In-Reply-To: From: Linus Torvalds Date: Mon, 19 Sep 2022 17:15:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 12/27] rust: add `kernel` crate To: Alex Gaynor Cc: Wedson Almeida Filho , Matthew Wilcox , Kees Cook , Miguel Ojeda , Konstantin Shelekhin , ojeda@kernel.org, ark.email@gmail.com, bjorn3_gh@protonmail.com, bobo1239@web.de, bonifaido@gmail.com, boqun.feng@gmail.com, davidgow@google.com, dev@niklasmohrin.de, dsosnowski@dsosnowski.pl, foxhlchen@gmail.com, gary@garyguo.net, geofft@ldpreload.com, gregkh@linuxfoundation.org, jarkko@kernel.org, john.m.baublitz@gmail.com, leseulartichaut@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, me@kloenk.de, milan@mdaverde.com, mjmouse9999@gmail.com, patches@lists.linux.dev, rust-for-linux@vger.kernel.org, thesven73@gmail.com, viktor@v-gar.de, Andreas Hindborg Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 19, 2022 at 4:58 PM Linus Torvalds wrote: > > This is not some kind of "a few special things". > > This is things like absolutely _anything_ that allocates memory, or > takes a lock, or does a number of other things. Examples of "number of other things" ends up being things like "accessing user memory", which depending on what you are doing may be very common too. And btw, it's not only about the (multiple kinds of) atomic regions. We have other context rules in the kernel too, like "does floating point or vector unit calculations". Which you can actually do, but only in a kernel_fpu_begin/kernel_fpu_end region. Now, the floating point thing is rare enough that it's probably fine to just say "no floating point at all in Rust code". It tends to be very special code, so you'd write it in C or inline assembly, because you're doing special things like using the vector unit for crypto hashes using special CPU instructions. Linus