Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1930100lqe; Tue, 9 Apr 2024 05:07:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxb5/OLnMBgDaDV5uAPQx4/oAI+yzMdeCwca1C4G+PlfqlHVLtr+x1IS2W+yeonl7zVIlVb8/c7jqTCZGLcbqClrsxKbWPevgYp+N0iQ== X-Google-Smtp-Source: AGHT+IF6BYfOCwkzTJYeyYWg+udtLukcJ+f9gGS2PntAlieZXjNZ0islvYBU8RCs3ntWnSZuSnJa X-Received: by 2002:a05:620a:4951:b0:78d:66fe:b4fd with SMTP id vz17-20020a05620a495100b0078d66feb4fdmr4529937qkn.75.1712664448700; Tue, 09 Apr 2024 05:07:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712664448; cv=pass; d=google.com; s=arc-20160816; b=mjUefe1C5NvmoiBf4XshXQLcWsEzRcagA2b2CmGMWJxYw7sTJJf1hsfCc58YFhp6/0 uukW59+bwCMWgl5rwuGRR+MG7zYC6xHypsTZWZagGpc07JaNVzI3+zZJgry0mVDTopp0 s6HPP9M3+NBxa4gRh+x6Zq13Xylt+2NXAdj6m0IDx5sqS+jOEMgha6yN0u9BMgNn5yMC TlfIXw5GyZOAe1fmaeAxbV6w1bmEG80HOeMU0L84PSpa65mtEJQTrtN0ICbPhIoRgIam FbgWjj5ZujGE7fhjODZBCw1yMJY5id3K9pPoc81kd0CvLjMokFsJXNzs+KqmjXDVYWUB TVuQ== 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:date:dkim-signature; bh=fdPl3WFCWHLRN70qmtNx/X3LaV4RnMmwDJdJ+T0QErQ=; fh=rX3YyZXfBXvUJJTkQCRiDYgb4HBXbj5HFRFHyvZ+VRQ=; b=DIy3WUa14OeBzeiO7NMhJYom7qho3rG4vq6JZD2wb/+qI9s+Q4WhD+NYtddTxjLVsD aH5rowu+pWWXxTDbQYkC6KoMytYHZAbvoxjNFHrwHpdFj20mtYYD4fP8HGE2+0AUpUOy Q1BkzM5J9f8TkwIwve8bTQ22xGgk1A1aqmYffgFdll1GyzEvAuZnhYVmevzq/sXhvThg s74zocvfUs8zZpbQDdL95K0lT5KWLPvMgKly4ofzxrkmrAVk0DhVXBgw3mowFs6seUhM M+Uh5wltEOJXYKiHHvSH6glBlA4838CW4b7A8IqVl48Wuv8nG7vA/Xazts32Wfj6aGU5 Aoew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=A6+c2l4N; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-136704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136704-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bj15-20020a05620a190f00b0078a4fe9e84asi10881447qkb.758.2024.04.09.05.07.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 05:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=A6+c2l4N; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-136704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136704-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A35921C22C9F for ; Tue, 9 Apr 2024 10:50:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ABFC8562E; Tue, 9 Apr 2024 10:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="A6+c2l4N" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 2690C823AE; Tue, 9 Apr 2024 10:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712659841; cv=none; b=h/yZy94C2zJgbCJrFFSHSJnfGvAmsGCggBYIzQzLzN0a++6ytLRmPsQs5n30WBAG4ifeQtfcCFobaTaEn+nbJEWKDdj881kKpT1I0aBhMNvmIi8JImbTN+ZJoj/yGDH0VsHtXun2zxIwCKPZiqQFd1NbUrpzZjyxykJHl33Z9ok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712659841; c=relaxed/simple; bh=7d49H/3MDKc37vAmRfm+8BB1JMNOPrM2MZ5puWV2Yvo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dy3UBQLITymu/Ecm0KDnRnu+dbOr+UcUKio5dY9Y7L0OkSD0+3Ugsd7Px5UUmJ25QKzM1YxJXjpDzxz9FdJjMQH7rZBDIqch7rYM4HcqgIfuuBXwn075pwBqSDga3RxLBIcmChy2/pjsUFKy6s/iG/LKhh5qkJ/BaZZDra1s/OE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=A6+c2l4N; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fdPl3WFCWHLRN70qmtNx/X3LaV4RnMmwDJdJ+T0QErQ=; b=A6+c2l4NtzCr3n9/z3r782zwiM t8LFZ2Y+6asvkVk0ieqbUPKWxtF67/X0IAKbJiidA9qgUMCQu80Bd3Ys70P+z1te0VntRDE6sSgSY od9Q4gM6yCXEsrnDuoAvwP49i2cA1aJ4AV5t5dJJJ9TI4oHZ6vjCMcMcrqZTcf8Xm5TXOwyzEkmJD aeVg+rKtRVKRuL2YMkIfLqGYTnjFPe+NQBKSioszfByY63QFkGFeO0C4uaypuWZ4L2Qd1pDGR4ooc xgsclxyA2Ldrsb2q7geUJ5Qs31a4NVyzYmJc97Jplwk1LT2VPVVjQylOoLtgQk5zMsBgGEgMjtG9B zNw4txXA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru93Q-00000007Z81-2AVo; Tue, 09 Apr 2024 10:50:17 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 0C0F630040C; Tue, 9 Apr 2024 12:50:16 +0200 (CEST) Date: Tue, 9 Apr 2024 12:50:15 +0200 From: Peter Zijlstra To: Boqun Feng Cc: Mark Rutland , 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 , "Bj\"orn Roy Baron" , Benno Lossin , Andreas Hindborg , Alice Ryhl , Alan Stern , Andrea Parri , Will Deacon , 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, 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: <20240409105015.GC21779@noisy.programming.kicks-ass.net> 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: On Mon, Mar 25, 2024 at 01:59:55PM -0700, Boqun Feng wrote: > On Mon, Mar 25, 2024 at 10:44:45AM +0000, Mark Rutland wrote: > [...] > > > > > > * I choose to re-implement atomics in Rust `asm` because we are still > > > figuring out how we can make it easy and maintainable for Rust to call > > > a C function _inlinely_ (Gary makes some progress [2]). Otherwise, > > > atomic primitives would be function calls, and that can be performance > > > bottleneck in a few cases. > > > > I don't think we want to maintain two copies of each architecture's atomics. > > This gets painful very quickly (e.g. as arm64's atomics get patched between > > LL/SC and LSE forms). > > > > No argument here ;-) Didn't we talk about bindgen being able to convert inline C functions into equivalent inline Rust functions? ISTR that getting stuck on Rust not having a useful inline asm. But fixing all that in a hurry seems like the much saner path forward.