From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 9F61819D8B5; Sun, 16 Jun 2024 14:36:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718548563; cv=none; b=tK1vSU02ZgHv0dB44ASSiOfCwc4BHHtc24MF9GgIzrzJ0zFsI1Aebb3ONgv8VVFYIyDXLWMTCDLkEhMX5Ck3Bq3j0SKvsTa1IfnJGFAQDENaQOcVKgElp56XC+zymOPxXrgC2ZFP1qqFnj0v0s4GBZhB8zyTzu8u9gfbssbWbFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718548563; c=relaxed/simple; bh=7e9CZmd124XeWsjsaTuz81EPjeNmZoFf85hV+ZcTGZ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Sc7S54DLphzUFN5ZPxZMBvhiPn5TWo91qDrvMnm7MihR/ZjiJDw2mkmxAl1tIVrA7ys7yD5i+Mz+osmf6tdWI0i3QxiJpTBQ4tz/atszSwSqmZtncfaSaRisHnvBPWb7n2B4sPIqXbYgJkoJqHFFPs884BIyajdLWdTZHkPjl7k= 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=Sg2QUCXu; arc=none smtp.client-ip=209.85.222.182 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="Sg2QUCXu" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-797b24b8944so333255185a.0; Sun, 16 Jun 2024 07:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718548560; x=1719153360; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=i9qsPYBwH3Sp7/6c6yDAa2y8gJfd287HNf312thuud8=; b=Sg2QUCXuD40yZ8DV6ixtS64ElV0Ovv0NSv8oBu3I+95ivZxcemgZm+hm1yZw3p6dhw Su91sH4P4RexCAhCzrO808D7T9q0lsJode6vEur9aGwxZUIi0dNHGyKp7RGCmy51aCln AbkcAA9AfCGmEm1Uj1aBYAHh3w9tVPxr8qCPmr5nM9zHTvcdBfnzEXuJbQpDTrl5lEIU xLH6pVpKwKPc9JOH8qTCWEZgcMTOzRCxX1FaPgkD/gxzE+TLw0o7bXTrGagr6bLjwzQk UnmRXE74CpEsH8+Na14RpVnGMk+H5wtqK/3L5M3JT1r+VLRUolTlGvNG4er8y03xlID7 4+4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718548560; x=1719153360; h=in-reply-to: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=i9qsPYBwH3Sp7/6c6yDAa2y8gJfd287HNf312thuud8=; b=jikag+0I8HT2KH4exYSV3Pl96zf3mytIMMTkuAYQl5TqoTOdRFCZw8L9lewY1/4cCi 8JPKl3FvriIio8vkImIfIsf63K91jkuNAogHMB7KeaoNolxaTPSJikgeX7gACjRTRk3E 7SHlQW/t4cE5cKKYScK2kwcfyRyT7CVNNSDgGUuQIoQt12kgBV9yDuyZxgvPyPKU1xAy i3MF0N+Wmc6g43qYlwTnkdrD4vd/MsENc7+eY+zhvjdvnazu4ZtxfIhNlCkGFQEM5HUj SPjXY4VcuJfO2gln8s+/q6Pd/0KKZ+ekHykiKcK88Jp5aQ8j596fByebTtSD8PFmrBEc kmfQ== X-Forwarded-Encrypted: i=1; AJvYcCWWGD3xKqTZDEM9xgK/mL650AgIf4fBaJXMX7yqFo5kklf5w6TEdi3Df0MIPRePoj9Vwx9tXVuB69IjZ38MJHzGHzuj3Yv4ASUwnQ4Ja1lQPjmhtcRe+TuVyBObWfMmCjpakM+Y3edR7UN/0NkDagivVfU91gms4XIxWYXbHOk6ThHf5Qiki5bXpmjMxn3hJRqHK5uiESiRfB6fzP4Lxq6DAYOvu1Z/4Q== X-Gm-Message-State: AOJu0Yx+OQohqQexjqRRwC+SL+3ofGJgfeNqIyjFpyEPj5SEbGYHEsmd EwjWqdMxwIx+YofzPJNtMm/FkfwGMb6z/wlODzuPZCqhW9vv6h5a X-Google-Smtp-Source: AGHT+IE4znSN0CJN5q1n8JV3DeDpQHBV3vnA5qh9mxdOQC/KkdziwRzH+gkuO6qgwfyCqvW4Z/5i6A== X-Received: by 2002:a05:620a:4510:b0:792:c32f:caf0 with SMTP id af79cd13be357-798d26b521amr864146585a.70.1718548560454; Sun, 16 Jun 2024 07:36:00 -0700 (PDT) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-441f2ff9418sm37282091cf.86.2024.06.16.07.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 07:36:00 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfauth.nyi.internal (Postfix) with ESMTP id F0D271200043; Sun, 16 Jun 2024 10:35:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 16 Jun 2024 10:35:59 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvfedgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 16 Jun 2024 10:35:58 -0400 (EDT) Date: Sun, 16 Jun 2024 07:35:57 -0700 From: Boqun Feng To: Kent Overstreet Cc: Benno Lossin , 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 , 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: <5lwylk6fhlvqfgxmt7xdoxdrhtvmplo5kazpdbt3kxpnlltxit@v5xbpiv3dnqq> Precedence: bulk X-Mailing-List: linux-fsdevel@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 Sun, Jun 16, 2024 at 07:16:30AM -0700, Boqun Feng wrote: > On Sun, Jun 16, 2024 at 05:51:07AM -0400, Kent Overstreet wrote: > > On Sat, Jun 15, 2024 at 03:12:33PM -0700, Boqun Feng wrote: > > > What's the issue of having AtomicI32 and AtomicI64 first then? We don't > > > need to do 1 or 2 until the real users show up. > > > > > > And I'd like also to point out that there are a few more trait bound > > > designs needed for Atomic, for example, Atomic and Atomic > > > have different sets of API (no inc_unless_negative() for u32). > > > > > > Don't make me wrong, I have no doubt we can handle this in the type > > > system, but given the design work need, won't it make sense that we take > > > baby steps on this? We can first introduce AtomicI32 and AtomicI64 which > > > already have real users, and then if there are some values of generic > > > atomics, we introduce them and have proper discussion on design. > > > > > > To me, it's perfectly fine that Atomic{I32,I64} co-exist with Atomic. > > > What's the downside? A bit specific example would help me understand > > > the real concern here. > > > > Err, what? > > > > Of course we want generic atomics, and we need that for properly > > supporting cmpxchg. > > > > Nope. Note this series only introduces the atomic types (atomic_ C > APIs), but cmpxchg C APIs (no atomic_ prefix) are probably presented via > a different API, where we need to make it easier to interact with normal > types, and we may use generic there. > Or it could be a generic function instead of generic type like: pub unsafe fn cmpxchg(ptr: * mut T, old: T, new T) -> T the "unsafe" part is due to `ptr` may not be a valid pointer or this may make normal accesses data race. Regards, Boqun > > Bogun, you've got all the rust guys pushing for doing this with > > generics, I'm not sure why you're being stubborn here? > > Hmm? Have you seen the email I replied to John, a broader Rust community > seems doesn't appreciate the idea of generic atomics. > > Regards, > Boqun