Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp5061681pxy; Tue, 27 Apr 2021 20:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxT/ZERe2Y68pmiLvdBtNt/bTpvaKbtl06phW3q7ehs6mKF5YsPHp4I0l9MZXadK9YOtTxm X-Received: by 2002:a63:e712:: with SMTP id b18mr25407858pgi.2.1619579540769; Tue, 27 Apr 2021 20:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619579540; cv=none; d=google.com; s=arc-20160816; b=0lBT6qoauLH7GigpweJgo5ZunnDtHp1EGo5L+Ff0LNLmL0sVg2uFENd2lNYhwxtEct 7n/FBtPQ4cJD9DqwQJGbHKI4xdG93jqVii2TcM3ZW2lkszEDVAKTOysgXc/ZuRfOGFe7 hfUkUjNQzoFErsc5TzKFs2mBytpXIES0Ygn3ZCofVyqSi8lXDluQs4TpHu5socsoMuOp w/rSPGT6IUv+1pHfdiQ7pDGnuCvhtBt5nJh0UeBRqL7S7k9TMidGNG4aFPWvMZnHxUbl TAH70/ezzvsI5qBt3WaeLK1MwtbXb94n5WpLvPZUjkyyScqPtcvCQOmDW5tqbaBSYml8 zVdQ== 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=rRuk3LXxZffE/YX5087tARIXQX+VPzj1e3QOp6q3WkI=; b=Oaca3p/PXCdaFOE2N1R9bINhl/o65YMZQeuOC/3KYEHyrDtkIOU0OPsTfagQdcicto JrjcPchJbnCt/+bDAAz2fTYuhTN/v8MBoNfjV1hQe1LAA13SI9Uw4qNrGocB8VtzUfFA 7WuUkzeULu5Mst2bZfSXOpk0sslBv0lU7OSqtZaw9yljXAtEX6jTNcNfAXWF7qU9EcbC qrOGp3s5oRHAB3ffyWgbyrHxMCcUTqnnlNCjR1ab+qVCzT43d5niQC2anBJH1ASdujke 3oAGpwBZExvKn/RqmybOQPnOGfQpRzu4WMzxX/UcMtnp1AljhQCYkD4btZr2/1PM8yK3 9BPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YrTxrQyl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si2195752plg.218.2021.04.27.20.12.08; Tue, 27 Apr 2021 20:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YrTxrQyl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235516AbhD1DLG (ORCPT + 99 others); Tue, 27 Apr 2021 23:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbhD1DLF (ORCPT ); Tue, 27 Apr 2021 23:11:05 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70ABFC061574; Tue, 27 Apr 2021 20:10:21 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id q192so18352709ybg.4; Tue, 27 Apr 2021 20:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rRuk3LXxZffE/YX5087tARIXQX+VPzj1e3QOp6q3WkI=; b=YrTxrQyl/0O8RuK469UHGDQmdPy30gkpj/QVi1D87zFB2s4PNcs4aIwYgy3myjrgAS CWcmXoQaTuYcWfVixySmMkPl+9j/ENrB9qwfELtYVxC4yHHvd4iHqrnx02+ZXIYkA4YX 1tMcz5dnS4nRk06FjdEGU5Me1fdZ4S3xG8o7RXiE9N6uMIJtnxMLDXAE4LnbE5+t5uyg PLqUgZHw3EERuwzRx+9p641e7ZHXtQZEZB/VLbUUgT0NPhpVjZvjAG00eUoz2gwsWAtZ PL+yWMeAVHoELF14fqTbwRoSlIqCFJessFZb6bUWAcTcnBDncH5ijG0KEC24wtdSOWG6 1Cig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rRuk3LXxZffE/YX5087tARIXQX+VPzj1e3QOp6q3WkI=; b=cU0Tp+B4znBKQxtnnOJIZkoSlWI6COKXMPN+3AlnvzB8NHKvOzl3XGvGMzZjCV498v 4A8XfwTCtJTPW482+ZXoksUZQelKMeeJ4DEuHBcKHc/GXxjqwCixJuBIKkumBE6/yhOI w4YUavQQsSxFwlYWebn51bydVtX9lQiJtoOribFWTcVvyX/GPj+YGPM6HrZzjsYhTHRQ QAOUTGvv9CDNVX+23BedkIF9sHrkW6AhEviROJIlkNP6L2tzWSPWfNVnxISibzXCyfrT rGC/8HKUSQFiQ0trNcaXTdxy2Zo5RpI7E8BMSRFrprTIWJJYaLMXbPRRvavIBDTLgcVZ iQWA== X-Gm-Message-State: AOAM531HFs1GPH8mJrr3BUeXCWGwT7WQmQ44Cw1Zm/mlPaL9O2UAY6SA /BOPD9zxxg40f25MGongZNu/WkKX+a+YRAIn4CI= X-Received: by 2002:a25:bc8b:: with SMTP id e11mr38000740ybk.115.1619579420788; Tue, 27 Apr 2021 20:10:20 -0700 (PDT) MIME-Version: 1.0 References: <20210414184604.23473-1-ojeda@kernel.org> In-Reply-To: From: Miguel Ojeda Date: Wed, 28 Apr 2021 05:10:09 +0200 Message-ID: Subject: Re: [PATCH 00/13] [RFC] Rust support To: Linus Walleij Cc: Wedson Almeida Filho , Peter Zijlstra , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux , linux-kbuild , Linux Doc Mailing List , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 1:13 PM Linus Walleij wrote: > > Actually my reply to Wedson brought up a new issue, which is the > quality of learning resources and the lack of an equivalent to > The C Programming Language book. I recall having a similar feeling when initially jumping into individual chapters of The Rust Programming Language book. I think it is intended to be read from cover to cover instead. There are other resources, see [1]. For instance, there is The Embedded Rust Book [2]. Some of those are a WIP, but perhaps others can recommend better finished/published books. In any case, Rust has more features than C, some of them quite unique, and they are routinely used, so it does take some time to learn. [1] https://www.rust-lang.org/learn [2] https://docs.rust-embedded.org/book/ > I think a good starting point would be to either fix Rust support in > GCC or implement some more important ISAs in LLVM, > whichever is easiest. I don't mind having just *one* compiler but > I mind having *a* compiler for every arch we support. > > [...] > > Portability to old systems and ISAs is a virtue in itself > because of the effect it has on code quality, not necessarily > for the support itself. I agree that there are benefits of keeping compiler technology flexible, but one cannot force or expect any project (including the Linux kernel) to maintain all code forever. In the end, we need to balance that adaptability against the benefits of adding Rust. In particular because nowadays LLVM is able to cover the majority of devices that want to run the very latest Linux kernels. Thus those benefits apply to most users. If LLVM only supported, say, x86_64, I would agree that it would not be enough. By contrast, compiler flexibility only matters indirectly to users, and at some point there are diminishing returns to keeping all architectures around. In any case, adding Rust (in particular for "leaf" modules) does not imply that we will lose those architectures any time soon. That would take at least several years, and would require quite a few things to happen at the same time: - That Rust got so widely used in the kernel (because the benefits turned out to be important) that maintainers went as far as wanting to drop C drivers from mainline for Rust equivalents. - That GCC did not get any way to compile Rust (no Rust frontend for GCC, no GCC backend for `rustc`, etc.) and, moreover, that the plans for that had been dropped. - That LLVM did not add support for the missing architectures. The first point is unlikely any time soon. The second point is unlikely, too, given there is funding for that now (and I assume those projects will receive more support if Rust lands in the kernel). The third point is likely, though. Cheers, Miguel