Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2826039pxb; Mon, 19 Apr 2021 15:15:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye/wCoMHaIg7JdriM23gLXmx7TgKmEHXylXAj4MuEsuKXwc5uhWBgRNdqDQ3vwYiwClVAO X-Received: by 2002:a63:5f88:: with SMTP id t130mr11855799pgb.403.1618870518637; Mon, 19 Apr 2021 15:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618870518; cv=none; d=google.com; s=arc-20160816; b=EO5SveZpEdH5JZXNp7d6GnokP0+PjmvNrJxTqOzhqt+SARVZaamEa03GstKCHwYI0M Lhxg+GtXu6XJMbe48KFmc2xaDz2XKP6hmSZYK0XA8r23TQEExddHHP6lzKqxscITOXAG ZQ72nn3CsF4GU6SZ9EwigPRqw/s1LmYJ1LRN00k1Q74gTmR+YErOBxbYSbaMFUY3tKTp edbIHZstpvWkIJrmuCedki287CBGFYijFY3mEpjEyQB4r1KRGDVk1aPH4EhxaYSNLug+ rymMYgb5awZzheMPB19hMCoGBibhar5OtTJjEETiv+kKI/abEJVAGWOGI7ThfLEMyqQu Rt2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=PmMpoqajN3kYFits3mKGuMX/Gpaj/8aNNG+P1JlM6wc=; b=d5y9Hq4yZFSvat8fMsox0Gdue2S6riWLREEGirsmrY4ZM/1rDvPqsQO+sw3J/vcXdr XXIlawlXrSA+wlCpSFojz+w2DgvILlp9o6j5Z+kzHKc7kdIY7wWJ1hBTFPq+r3IsW5E+ eZmWEMW5kBqKIInjGARoauno9NNil0Equlj2ptajxAvVYLtKdSjtMN4qe4RJmxh6NSXo phd3cdWxq/a0S56IlsjqbW999B05a2+B/vxIubDu3nKhAodPJ2n4hyYutiVEP0azEsRZ 1ZrbmKzr+Nz6nrTDybZMNUQ9ozGw8rZFkxPvDJHk9SJ8sSaPqBj+l2QUm3wYEFkQd/kV r5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eyCBe+4O; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si18260721pgo.339.2021.04.19.15.15.06; Mon, 19 Apr 2021 15:15:18 -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=@redhat.com header.s=mimecast20190719 header.b=eyCBe+4O; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbhDSSjL (ORCPT + 99 others); Mon, 19 Apr 2021 14:39:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36180 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233942AbhDSSjL (ORCPT ); Mon, 19 Apr 2021 14:39:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618857520; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PmMpoqajN3kYFits3mKGuMX/Gpaj/8aNNG+P1JlM6wc=; b=eyCBe+4OeOGBIAbrcA34EBvprX+XnJgQ2E909+gcehr/XoLoji2gT4iPQg/hW2rBRXAS1a Vv9mZgeqMRNhMe5avczMMsQrPz7pRyQOr53BNOKhvP8swLl7oeo2+BRHYUJ6Zf7PLmPsb6 DMIZ421/zb+zkm7dQp9/XNKLBKEzQ0g= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-4sS_jVRnPXqj5M4aufbMsQ-1; Mon, 19 Apr 2021 14:38:39 -0400 X-MC-Unique: 4sS_jVRnPXqj5M4aufbMsQ-1 Received: by mail-ej1-f70.google.com with SMTP id z6-20020a17090665c6b02903700252d1ccso3964745ejn.10 for ; Mon, 19 Apr 2021 11:38:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PmMpoqajN3kYFits3mKGuMX/Gpaj/8aNNG+P1JlM6wc=; b=e1ia8ThyZld+qSDW9eGnBQAfZio/3StgrTR0jx6y4gf8IL++DFWmvxjcBrxT/Pma40 KjkWZpYzbeFytNRjTRR42wxlI82o+4XFEjfWuDWV3ZXNv1vSVUnZlaptjjo8BjHB/Qc4 xC7xeg9oqCZx56YvEJMD1OEVrCEWv4A2ie11gqf53a6PMPHStDF/LVu9Y8A2IUQ//ifx vAPwiy1q/a2//k2mJ5cjQP4tJVrW9PKhVC+StwxEpA4DjbuRm+DzXze1g/a568rftZOP 4Y4TEVC8s7NiJEyIVau0sBRIoD8RwzPmglI6ao0NGs7hFWIF8fX+wsrRpeQAx13+vQ3x u3nQ== X-Gm-Message-State: AOAM532OElkkwsY+9a2t1ITe+9S/x0daCuYI4zgX4SjvuSLP2khekCXN h4YqdMNKnoFfvR4hgkF0SRjbAnk1Qd5lrgIlYOrRcE2iFePjlbjzuDj10GdAnY4jg7eBueSsdbD Lr/J8POY1jnKQE2YuS3zsI7vh X-Received: by 2002:aa7:db87:: with SMTP id u7mr26555993edt.16.1618857517782; Mon, 19 Apr 2021 11:38:37 -0700 (PDT) X-Received: by 2002:aa7:db87:: with SMTP id u7mr26555985edt.16.1618857517581; Mon, 19 Apr 2021 11:38:37 -0700 (PDT) Received: from [192.168.10.118] ([93.56.169.140]) by smtp.gmail.com with ESMTPSA id kx3sm10981044ejc.44.2021.04.19.11.38.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 11:38:36 -0700 (PDT) To: Linus Torvalds , Peter Zijlstra Cc: Wedson Almeida Filho , ojeda@kernel.org, Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, Linux Kbuild mailing list , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Will Deacon References: <20210414184604.23473-1-ojeda@kernel.org> <7287eac3-f492-bab1-9ea8-b89ceceed560@redhat.com> <3a874b15-5c21-9ed9-e5c3-995f915cba79@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH 00/13] [RFC] Rust support Message-ID: Date: Mon, 19 Apr 2021 20:38:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/04/21 19:14, Linus Torvalds wrote: > On Mon, Apr 19, 2021 at 2:36 AM Peter Zijlstra wrote: >> >> I also don't see how this is better than seq_cst. >> >> But yes, not broken, but also very much not optimal. > > I continue to feel like kernel people should just entirely ignore the > C++ memory ordering standard. > > It's inferior to what we already have, and simply not helpful. It > doesn't actually solve any problems as far as the kernel is concerned, > and it generates its own set of issues (ie assuming that the compiler > supports it, and assuming the compiler gets it right). > > The really subtle cases that it could have been helpful for (eg RCU, > or the load-store control dependencies) were _too_ subtle for the > standard. > > And I do not believe Rust changes _any_ of that. It changes it for the worse, in that access to fields that are shared across threads *must* either use atomic types (which boil down to the same compiler intrinsics as the C/C++ memory model) or synchronization primitives. LKMM operates in the grey area between the C standard and what gcc/clang actually implement, but there's no such grey area in Rust unless somebody wants to rewrite arch/*/asm atomic access primitives and memory barriers in Rust. Of course it's possible to say Rust code just uses the C/C++/Rust model and C code follows the LKMM, but that really only delays the inevitable until a driver is written part in C part in Rust, and needs to perform accesses outside synchronization primitives. Paolo > Any kernel Rust code will simply have to follow the LKMM rules, and > use the kernel model for the interfaces. Things like the C++ memory > model is simply not _relevant_ to the kernel.