From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 E2E2D1870 for ; Sat, 15 Jun 2024 01:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718414700; cv=none; b=UIoJa6hYP5pNZtV/nBX5GTKr6KBoErc3Eo7evO4NIEPrkMxSd37gTAJNdPyUkkAJGY8/iycNaNjrfDxYo1c8lDRaGhQQf1Hw5XnS/vbPrAcvKvmrYBFCr0SPF8SFh1xn5u4HKe7GmT49wf8ZLCdyz6j34+WmqFVvMtEabC66chU= 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=dX5XQ8ZS; arc=none smtp.client-ip=209.85.222.174 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dX5XQ8ZS" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7961fb2d1cfso207982185a.0 for ; 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=lists.linux.dev; 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=dX5XQ8ZSvulnEmCXYqvAVqGHTbf2Rytr5BdKgg2DW8x0rGZ10DpG7E9MKTDRyMFfwx JYQMYVa/VuYq9Wa/8XSGg9tMLjYd6wv+oDRQyyMGoLT8dWHUQxVRXEn8RLhNHFuYrDT8 hdsscTGGuzz4E8xWDxrtmkRJJn7HZUZIXCw4PHTVvYphsKenvX2/+Uu5QmQvsg2l8JbB Lieay1sU60DryFxPlEA6kljswu0rNutWOOmBvrjgu/zxXOUU13WOf5wyvj26Q5cqSZZk lMIQpl2uBMJ7AJ6P6jmsTBL+KwORchJSvymzRCgs3OreUy5X4VPBvEVjUh34Z8Ha49Gb Meqw== 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=LbS6fJnqKYaRWqmkTwLpnAjV07vlaY7Uwdossf7YsZMfkyRyVeDgZ59YQAGF7K/2vh rVpLWN9DI1DNIEatqj2Q1AVBlmCEsK8GQ1cljUQL1gv/Acymz2P5ZxcsrFjRZnCLwUwF YBVh7JOIHtmOPolgrHYbrE/xR/kEV/nDYTEyNpsbCIqKVck51s1bxoSn+pXV0fiNIqr0 1SdJ8lAO6Tdvr+lbciK/HxfkNv6YGUhC4RSDCpbZOrY4wC0vH2jr4oAtuiUVrSN7Iik1 HZYszgUknqQPoAOtcEb1PIs4FuEJWestGo3jIs0Wmg0dDCopfQ0gPeoerFb/MuuAhrw+ pmwg== X-Forwarded-Encrypted: i=1; AJvYcCWbcorh9QBFmkQq+yQlABKyedom4L8JrNznAm2dYEGZMTYYnDXE4EqO49Zm8N4HOGMBgv0ydTyTdQireED+PKSmEsv6mA== X-Gm-Message-State: AOJu0Yx8SLKpZ3i3+EL9/uX+wR8TS00iMsM8+UgJHR1qkfuCUzh63qRa PqRFYSZaVm7IOZiLZnrb2N2PjrgcL6+SHHhDC328wAYDpuh4Jyek X-Google-Smtp-Source: AGHT+IG6n7GPvstdqsh1yw1mNVwR7ev+2XQ3VHwq7FcLWe4FaNEqoQptCk/LJ0Zi1UEWs9hkSViM2A== 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: llvm@lists.linux.dev 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 >