Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1157195lqs; Fri, 14 Jun 2024 18:25:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSEEw/0HtpMa9uxKp05yA6PB7B6AFG7jg4X22KltXd0c6oNsf7A16fIKXdkS0CvMe2HuqUuBG8SfjSwOsZ545cpU4+y9n680DvJtV9vQ== X-Google-Smtp-Source: AGHT+IFV0NGn2lnZNheb0e1nCsddXattGFwA9GZU+Xzenz9YjnKnurHQtEYI9748gId53nmYp57D X-Received: by 2002:a25:aa68:0:b0:dfe:3b35:e856 with SMTP id 3f1490d57ef6-dff153db8dfmr4128137276.35.1718414717085; Fri, 14 Jun 2024 18:25:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718414717; cv=pass; d=google.com; s=arc-20160816; b=s8uM2DSIyLIFNi2rVmaFKqbmqQjcL4eK0ngt+zQaLpthtRgha7GTOLoTO69k+75erD MlZYwed6ollM+p6KT2woUOWulf81BZIuTpxKfsiKtfSuEo0qqyHSup9qfpD3RzjgEqKl HLF4rKqrj8JeZAp/SYVuuvm0pSHKUtk6R6Jyysmh3dt+bw0syz7lBGHujdI+J+D3vkfE EWmph/DB5NCLDvXrL5isyx8n8A9NPOLty/461DzBygmaa1H5JB7KsOs7kSW2U9NQrqMU vArwyw+vymuNIigJwRWVcbk9xAjtwMGCWoO8VFeEzK4BB0r3jYqm5HaQtFiOxAAXPaEt IKiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=JfOBXszW5OZSQ0w6pPZYZxRPhMPO4vnS5op55SUhlr4=; fh=H2pOjoHMR4jbqHJDOwh98ix8voSDXTi4ZCpbE2EyFg4=; b=mz5EyWliwxSwOoiUtnrDKQ0rVeunvHk1ajbL8xW7NiQP1L+IGMvspUI9gPgp1IUbwv SQsWbRIYc84hUTD2d8xon8abfeNUXRqPE2FVzekNf6rMJMDvaHXmL0OZ1fGlx6n0jBZX Q686XGwsFh2WOrjVzrokN7PRmpQvzw/Ij3geQHpdjJCWAgUzghTBqK6i+uzygOOLcylE xrwT3uGp+1FsgxNf/rlGplLd0u7eYaKOao6vogukYS4fkJs/kvzAg0RtoH8V42rpkyaF DNps2/1/cNTpIErXb54GZN45ERkvMaGdhRjZkfh2QIT12A3UOhN4RUGfvswC+6zEdci+ KZEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LDK0OPaG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-215630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ea8d42si48584611cf.365.2024.06.14.18.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 18:25:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215630-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=@gmail.com header.s=20230601 header.b=LDK0OPaG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-215630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 BAD941C2164B for ; Sat, 15 Jun 2024 01:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AE41749A; Sat, 15 Jun 2024 01:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LDK0OPaG" Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E63841C2E; Sat, 15 Jun 2024 01:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718414700; cv=none; b=L/xLGN9K0cb18L7LSWTEYOg0AhvWeW77Y4s0hSAXcaoBKgTfWH9kc+EwvPMgc1VuvfM2NMZM8nzJ4roxln0PnFrjfgh6jb+PEg4m7IrDdXvfweQHO5rZjiTnjOQPHpt3H2UAFegsLmpnoXKUIT0wM0eKfERmWrL1ru/3m9zd9x4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718414700; c=relaxed/simple; bh=vgpdZy8Zm21I5i7rHfIpJ5Zyoj30Uxr0py2T20VG2tY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q1HfEuapGDjXdHEc9+T5wLv9IFdggOjybq9cJ/nlQGA+DXEK28oTj8rFYGxiEzEBDqWiwjAkdmDCPmOpDwfjXo8V/c/ovR/xfR2B2k322DotHF9Pl0po2/90GwL9VpB+Zogp+lAXad9EdbukqN3WzvvfU3SoptNAFEqrXOEkreg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LDK0OPaG; arc=none smtp.client-ip=209.85.222.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7955dfce860so178524685a.2; Fri, 14 Jun 2024 18:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718414698; x=1719019498; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=JfOBXszW5OZSQ0w6pPZYZxRPhMPO4vnS5op55SUhlr4=; b=LDK0OPaG8SJ9fxkiltIMCQcLQ5ulLMM5gxJ96pocFRDK5Ww30vcIo/Vs4i5kdXDfR/ KvJt2+/Gkaaf+PilmTQkpunUFSPCDrUOHVmo8ZPu6IX2PDnffeXuJOr6kCEeykgmcMqZ Mw+C2BEXHL5vD0EC+xnrQE8mzWafd4tVKh+0vm/5Ekdydbd+u3Ok2Yh8Qy3DtSEkyNdB O0e2OIeFnR6PQklAyyC34Znv8mFclZ7XmbwzrbuQa9rI8IH6e2OKWme25y0naddL2pO6 +fPKKVqUaomH1KASOWTTZ/ckU0LZu1LJ0hy3seGjksQxHhcg6izplmT/cpql9U5825YV BzfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718414698; x=1719019498; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JfOBXszW5OZSQ0w6pPZYZxRPhMPO4vnS5op55SUhlr4=; b=OAi3fhIdd1voQ4ZttKpgmCUAGUs8uS+RPhm85CidVGTRKXaNvPCN/neAmiVKYqjyEt g1IShLu7vtDDFnrVda4t0yX9hYk/DoqfYW2EaIJuFEnGXmTVPGOVckTLr13Swsta+JqW 3Ptm9IxIdHEq+JoU+hAqAT/rSCgz92a5shtHcplb/OEdAMnwr+7jv/eWh4vUlcz+3gTV bm/DLd6rmK2HjDkwavwBXovX7J56IZFVeMn2cQ5unf1pNh4ERthnIU0fGk4uWlGSpmfR 9TAvmVIZmkALaNI4QUO6vsqrsokGItGjCHQ30bQeWVkBk0699fqUv2Wch5PCctehd+Dw V37w== X-Forwarded-Encrypted: i=1; AJvYcCXtKxgLEAsYU7o/0keRHjW7CuH6oAo+Up/JglJopzqhijVwbcIUn/AN+vpzYRYtFwb9EC2axXw3JtpasPJeJS3gTooqOSwW5SYNASC7STCA6c04GNJEWlX8CQwzMd4+pikeiChyuru72TPHDehLOsabADB6M0LoWezBBPmFmHMwdmFZRtFyzjHzXrNy3qcb339SL2llhH1N1TkI28oTV3uPTOMJKBnnIQ== X-Gm-Message-State: AOJu0YwEhYjVHjFfnrKaN5esOnKrnm9EKHj937fp0nSAgL4BOQuJZBVB vmR8s2NFRAgsYUkrHNU7YaMqqCB66xoyijcjnNTRFA+W43JJbkcc X-Received: by 2002:a05:620a:3955:b0:795:758d:fba4 with SMTP id af79cd13be357-798d243b042mr491526185a.46.1718414697754; Fri, 14 Jun 2024 18:24:57 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798aaedc360sm198773685a.33.2024.06.14.18.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 18:24:57 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfauth.nyi.internal (Postfix) with ESMTP id 03B3C120006A; Fri, 14 Jun 2024 21:24:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 14 Jun 2024 21:24:56 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvtddggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhepvefghfeuveekudetgfevudeuudejfeeltdfhgfehgeekkeeigfdukefh gfegleefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Jun 2024 21:24:54 -0400 (EDT) Date: Fri, 14 Jun 2024 18:24:53 -0700 From: Boqun Feng To: John Hubbard Cc: Miguel Ojeda , Gary Guo , 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 , =?iso-8859-1?Q?Bj=F6rn?= 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, Trevor Gross , dakr@redhat.com Subject: Re: [RFC 2/2] rust: sync: Add atomic support Message-ID: References: <20240612223025.1158537-1-boqun.feng@gmail.com> <20240612223025.1158537-3-boqun.feng@gmail.com> <20240613144432.77711a3a@eugeo> <79239550-dd6e-4738-acea-e7df50176487@nvidia.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <79239550-dd6e-4738-acea-e7df50176487@nvidia.com> On Fri, Jun 14, 2024 at 06:03:37PM -0700, John Hubbard wrote: > On 6/14/24 2:59 AM, Miguel Ojeda wrote: > > On Thu, Jun 13, 2024 at 9:05 PM Boqun Feng wrote: > > > > > > Does this make sense? > > > > Implementation-wise, if you think it is simpler or more clear/elegant > > to have the extra lower level layer, then that sounds fine. > > > > However, I was mainly talking about what we would eventually expose to > > users, i.e. do we want to provide `Atomic` to begin with? If yes, > > then we could make the lower layer private already. > > > > We can defer that extra layer/work if needed even if we go for > > `Atomic`, but it would be nice to understand if we have consensus > > for an eventual user-facing API, or if someone has any other opinion > > or concerns on one vs. the other. > > Well, here's one: > > The reason that we have things like atomic64_read() in the C code is > because C doesn't have generics. > > In Rust, we should simply move directly to Atomic, as there are, > after all, associated benefits. And it's very easy to see the connection What are the associated benefits you are referring to? Rust std doesn't use Atomic, that somewhat proves that we don't need it. Regards, Boqun > between the C types and the Atomic types. > > > thanks, > -- > John Hubbard > NVIDIA >