Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2293121pxb; Mon, 19 Apr 2021 02:04:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz36jBfvSF37Id+eLuugp6Z1H2ZEG/a/euK4hwlLbbVy0OIERpSxTLRksbgG+gaVrqjyRAF X-Received: by 2002:a05:6402:2810:: with SMTP id h16mr9636693ede.107.1618823082473; Mon, 19 Apr 2021 02:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618823082; cv=none; d=google.com; s=arc-20160816; b=SHm89AvuPx80wX6qidJWEuG1PCu9q5ThBd6tRgajOWPYk0cboeqF+rY/gVruaJVa5C hyZY7Gh0Nv7f4PFtrfBNgqMNTr7dYtL4mgM1bEi4xbcD1PoOEnR8E4X0gARwBAMlJ97M PcPLhY7lWaOiUduPiOkr5crKHrCMnZ7UwP/fClrWwy0WRXAwxU8LcbIT/IUEqICpKe7R GFMAyPpLc/I6FEyjrkLzrc+asF/JFINnc+C8xmbKWSYaHdEp8fBVFbNGA3/ZHHrejmKU kG4kbwQLkN2JzrjW2cFhYq8vvk8YpA/CU6uFpYp91HwqqzUUC+crxpYGvC09yrDHiaCg uYXQ== 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:from:references :cc:to:subject:dkim-signature; bh=x2ufc3mqMrnhfTRRARV/wYF3P8xOeNxsUa5+ZAlFuFg=; b=IJoDG8hOnpCZiYubTIgxzJiq7eehYGpYgc/Ub7Vel1SZG5MiUXdIliIiJfESILl6tc sz2+KuYZkcpNh2EoUxgKy4VDbfwM7UDNTnnr3au/CWXSFZNoph2WiudsNYiO4jWjZ1EZ GzuxGFoG6JzXx4kVNIkJ7Dc83J0ugFkMT946iYUt4mKzK/f8J0RqOY2AoufXOhS+Q8Oa bfdchOCUBphn3yUh3K2DYZOFIBniXmIWJh7JH4HirTzWUIszv2ZXoes16SVMFLgQcaW5 UOAUxEHZgVZxjZNJbWpWOzEEgS4FLAXBS8cFLfkeQDUfheimLt0hIUUYdMsCeMY3tjX+ hCfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z79mL9Pu; 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 n21si11000896ejg.609.2021.04.19.02.04.19; Mon, 19 Apr 2021 02:04:42 -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=Z79mL9Pu; 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 S238023AbhDSHxn (ORCPT + 99 others); Mon, 19 Apr 2021 03:53:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47647 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238028AbhDSHxk (ORCPT ); Mon, 19 Apr 2021 03:53:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618818791; 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=x2ufc3mqMrnhfTRRARV/wYF3P8xOeNxsUa5+ZAlFuFg=; b=Z79mL9Pu6P4jGZupmIiqupHoKSZpRsh9hw2hCIkCh/OYwyqyt5mLBg7EiqVTrLz9etFXrf C+dpCpNpe8wCDoQn7Y4TwfS8vzHQO01btMEw6YxR5LuAQn0mk5vQ1gMS0hSQQrLKf/2xaw CmOmU2e0a95fO2i8bhW/4BPPKs8cRXk= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-l-cPIdbsOI2R4lNmGzhAkg-1; Mon, 19 Apr 2021 03:53:09 -0400 X-MC-Unique: l-cPIdbsOI2R4lNmGzhAkg-1 Received: by mail-ed1-f72.google.com with SMTP id i18-20020aa7c7120000b02903853032ef71so1792057edq.22 for ; Mon, 19 Apr 2021 00:53:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=x2ufc3mqMrnhfTRRARV/wYF3P8xOeNxsUa5+ZAlFuFg=; b=WoUCdiPTdGqLW7FwxaF77fbBp9KhEPWIAJLv7fOgOzYRniUdVgbTrAwPECAH+bRYBJ aeyFzsoqMBuF+d16l50lLYWLhfnvES9gJS6Qly9TgZ+GScYG6YKaxGbxCYSGclvueMAp AW6FqtftrTajvw7pUWGqrKyhAXAIKDBD3/0q/RyAUnC297iNzwl4nb/Sro3+zpPiddjB 6hUXu7DeIuXknYic06DjLpePblQ+z5fTOO5A5Sj0Hp4WW+Pu4X9dWZkzv58ubM04JdMH x4MucRpkibJhl3peFKarmQzw/ttVob3877p566Xoj6ouNeVHWyU0Ed7GiJiGLmvZ6tdX jc8w== X-Gm-Message-State: AOAM532ZsbWKV3wzUFc8a6hiVU4Y4IdGx4bJj1QvhxlEsoX+TMQlr4da i/ncLZtoUDE93o5xAHWaIHPrPbWu0CUs78GOtF9GWWD/qkUN1+ONHHQmR1czgsVspT5xb9EYgaC /BzEn03IPMT6iFfEfmh33mgtZ/S/a8v+1KmdmgV29hvElvvHv/sL53c6PiMVL5jtgZhqeATcVuk y0 X-Received: by 2002:a17:906:a286:: with SMTP id i6mr20596340ejz.135.1618818788237; Mon, 19 Apr 2021 00:53:08 -0700 (PDT) X-Received: by 2002:a17:906:a286:: with SMTP id i6mr20596322ejz.135.1618818788003; Mon, 19 Apr 2021 00:53:08 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id mj7sm9712114ejb.39.2021.04.19.00.53.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 00:53:07 -0700 (PDT) Subject: Re: [PATCH 00/13] [RFC] Rust support To: Peter Zijlstra Cc: Wedson Almeida Filho , ojeda@kernel.org, Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210414184604.23473-1-ojeda@kernel.org> From: Paolo Bonzini Message-ID: <7287eac3-f492-bab1-9ea8-b89ceceed560@redhat.com> Date: Mon, 19 Apr 2021 09:53:06 +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: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/04/21 09:32, Peter Zijlstra wrote: > On Sat, Apr 17, 2021 at 04:51:58PM +0200, Paolo Bonzini wrote: >> On 16/04/21 09:09, Peter Zijlstra wrote: >>> Well, the obvious example would be seqlocks. C11 can't do them >> >> Sure it can. C11 requires annotating with (the equivalent of) READ_ONCE all >> reads of seqlock-protected fields, but the memory model supports seqlocks >> just fine. > > How does that help? > > IIRC there's two problems, one on each side the lock. On the write side > we have: > > seq++; > smp_wmb(); > X = r; > Y = r; > smp_wmb(); > seq++; > > Which C11 simply cannot do right because it does't have wmb. It has atomic_thread_fence(memory_order_release), and atomic_thread_fence(memory_order_acquire) on the read side. > You end up > having to use seq_cst for the first wmb or make both X and Y (on top of > the last seq) a store-release, both options are sub-optimal. seq_cst (except for the fence which is just smp_mb) is a pile of manure, no doubt about that. :) Paolo