Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1506654lqp; Fri, 22 Mar 2024 18:43:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvz94IbsxLQYtFykgfM2Iv7Az/aTkAE8ePa/XzQ6BnqCech1iepDCwpOd/KQWwqGbRUid8w25Dv/6DzhhB2y62SqslyEZ+9Frj0qQrrQ== X-Google-Smtp-Source: AGHT+IEhdoQudr5oMh/wCQmuNb16FepJnsMXnqAJtvaSrfL1ViDtMJYK7Oey5vsaYW8e3Tyg9Py1 X-Received: by 2002:a05:6a20:43a6:b0:1a3:a85c:44a5 with SMTP id i38-20020a056a2043a600b001a3a85c44a5mr726454pzl.31.1711158193659; Fri, 22 Mar 2024 18:43:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711158193; cv=pass; d=google.com; s=arc-20160816; b=deiSDVSMLZxqWCDkKddm7RirAtaCotQkQWGXoMBaq5Nwr4RSxQfhtpZQp8e8S+WlWZ I3E6vmNtkLrjtxGe8/mHQUxsm/kRnWaIOpIuRyVIPs75o2fg1ZB/RhsRmlA6YEztZcGf VFb1kscDujmm8FtrObOBBLCMdj+HGhICQFGRbN4tr2KeZBwIM/3bemdVm97yjmbu+DHN VwEy4SOeFl9h3vqwCi20ElDcY15R3VBPYnLK82PKTh0/WN3qray7HzfbWiafm1yxfcyY vEJeikqYakSedmVa/mnRic7tpKk4HrtUPSv6XXKeFlBUZjrhXnF0ZrYR88YCOUlGvdgc UrZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=dD6EJF/cqoVE6rTGymbaDjtYb5EyuzQQZLjYH+mQ0aY=; fh=SgekPetps+JCBgfNx6uf7s2OjSbXWTTmsPA2TjM/D0k=; b=uulwAX4RvoYwwI/L5ItiFW4PuzvKc7/11ATTRTTtFNfxKe88lfBHfyNsdnAayN2Cnf YONQcRV+Bp5jQLB8hiyFHy/jf9IoIPr0ZcesJIajWEEIqfkOgsP75Lg6uuTWteJUQLXd kJarEP0VNF3ddUMSk1j4UNr7Vhsm230lD8nq04X1d7hrELRZy9PUQ61CrDwBd5ksPeyL d8grm9//gkA4IUXhisfqxO8/0zlcjdqwypYVrlwafJCRiG9T6XfT8F7WG8320h/xYojg Q5V9GuHt4s+ePiFHDou2EtXrKL1dEfd2wGW+qVKwxtUyfVyHCeXBXpIGOcSxWWa9h24L 3DyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Y1WS4lKA; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-112163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fi32-20020a056a0039a000b006e546bd270dsi721931pfb.364.2024.03.22.18.43.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 18:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Y1WS4lKA; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-112163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A9B5281CB6 for ; Sat, 23 Mar 2024 01:43:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC1F610E; Sat, 23 Mar 2024 01:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Y1WS4lKA" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E3551388 for ; Sat, 23 Mar 2024 01:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711158171; cv=none; b=izCPAn2M37hM+aS3qgVKfkAkaCtgrK8dhaGf/NiyHaFcHD8T4FboTTSPYlFHYCDnt8toxV3ZICSe+d1xNR93oIJO3rc9mqBG8tWxGrrKDRxvaVO/d4sRmMWagonDLpgh15OfloX9DRKAa+tzVGWdp+EeglviW6cZ1UzvzkZZUn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711158171; c=relaxed/simple; bh=xRw80OmHUOdZy/5LOsJImKztlKT0glsQe04+QOE7Zio=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f4nigKPgXg5Ctrd3/1hDzRUxE5pppBZITH5gCdjMeOibUML9Xam8q7OYv+gbCK4+WXDPEgv/T3GMlsydECw6MEwOj68Jmv4YscIlAy9fBBg/d0vJQN6Fzh2rH+kWgLWmLs/3TcJ91UmSTmZKCU4p+THH+yJGrKEicsgPbWGGq0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Y1WS4lKA; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Fri, 22 Mar 2024 21:42:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1711158166; 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: in-reply-to:in-reply-to:references:references; bh=dD6EJF/cqoVE6rTGymbaDjtYb5EyuzQQZLjYH+mQ0aY=; b=Y1WS4lKAH/M0gvaaIqhUPMVVjGnJ5D5J1mlllLUuf/wJdRmZwE+RQpK/uRkdis8VSBdPd5 FAAGjk7O1X1lQgNzof95s65T8ZalrTYODKiuB9EtY3XrtQgVaU/B768Y9zuBEBbpZnvlQE cxNTro92OBkv0mUt9uy6fX1d73IBfVs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Boqun Feng Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Nathan Chancellor , Nick Desaulniers , kent.overstreet@gmail.com, Greg Kroah-Hartman , elver@google.com, Mark Rutland , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , torvalds@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [WIP 0/3] Memory model and atomic API in Rust Message-ID: References: <20240322233838.868874-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri, Mar 22, 2024 at 05:49:23PM -0700, Boqun Feng wrote: > On Fri, Mar 22, 2024 at 05:15:08PM -0700, Boqun Feng wrote: > [...] > > > > > > I wonder about that. The disadvantage of only supporting LKMM atomics is > > > that we'll be incompatible with third party code, and we don't want to > > > be rolling all of our own data structures forever. > > > > > > > A possible solution to that is a set of C++ memory model atomics > > implemented by LKMM atomics. That should be possible. > > > > Another possible "solution" works in the opposite direction, since the > folder rust/kernel/sync/atomic is quite stand-alone, we can export that > as a Rust crate (library), and third party code can support using LKMM > atomics instead of Rust own atomics ;-) Of course if the project is > supposed to work with Linux kernel. Not just from the Rust side, the C side would be useful as well. I've got a quicky, dirty, hacky version of that in bcachefs-tools, and I would switch immediately if someone took that over and made it a real project, and I'm quite sure other projects would as well.