From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DC9CC27C53 for ; Sun, 16 Jun 2024 14:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i9qsPYBwH3Sp7/6c6yDAa2y8gJfd287HNf312thuud8=; b=SB34dG98QJI7gtD4ifQTZnHtAU GaO0J0I3J17vZEkYBcFrcs+C7duqFzPZcnbMW5vSkVT1tHK1FaPVl3OZa0RzBezVKK1RxniaPO0AI IKYBaY2xnR49PpnBzCHG1oMLBDeH1wHWs1ebEHZwYi3W9mSX5z9QMJasUxaCGd83uGrNutIdPkhJ4 D5Xw1cpVq1GUbgw5JdiKg6nNWGPEOrcGOGns4/BANp0UpSEpvKZRdzSgQtHToEJ4LPPmPKRtUExmA ylGfRzUAufsw/cnf7x8AgNpqKalsXfbGGWYcslFt3KOiW13fub+/GwI0HWVcqdiJ9oZu5AgTBEHQ+ H/h/wg1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIqzH-00000007hp9-3zbT; Sun, 16 Jun 2024 14:36:07 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIqzE-00000007hny-0SLA for linux-arm-kernel@lists.infradead.org; Sun, 16 Jun 2024 14:36:05 +0000 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-796df041d73so261201485a.3 for ; 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=lists.infradead.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=HMZ//SGSCEeMM0Lw6TZ1yw7YXwc8+Q7XmSUCBCgIhpLzrdVL0aCGxm3W8q+N9JLVy6 WtvLc6tKuuMdWdZp9gUmXdeTtT/LZ5jef3LxhrX7kz3tPwrK3QSJKbUUqrbldnkOsz1V 1tgj+8Q1RhvLsODURT0QJz6VkET+9FtNz1x/MRJIQ7UxMk1mr1CXta6Cu8gcew4NMt6t h7sn/nuniARlcvOdKR31i1amSlLBsDhawE4YZppSw9VzC7nYMMKdc2Eow6ccq1JJTbx+ m3zjvLvpqdgr/v2jygoHwyskxE6e+EOl6GhIUVmFvaaPU0OfK3vHMgnN2ukHbLMagKZc 1EuA== 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=c61VDyhBRA9JAJ3VXDW90XZgPem1vYIDM2mqYNCvWspycjqsYywpiGH9HEYzPwbIaY OZWznCrt21fkPh+HN/SIZakciQR9OFH9q40QqGmQny6sKmC6g2sTnWqTWlDxsGd5rpOG gdgAgZjDIje45eqrYU1Xse4RcCmeMkTtw5YwANNKOy+LsAlGOFiq0/t/aoXEQWqB0J8i gknkD2ftFmoBey0qu8QHVVmDWKnFa9hADjIWcf3CedjC79uWog6JKlvAjRLHcWhxVwWi SpvLd0aKrTiDB+7US+cE9sTAwqSnxSTBhLmGwHXOICt3SZwlSwFH6GcOU094niWDSB6g l7NQ== X-Forwarded-Encrypted: i=1; AJvYcCVY2mU+TtOr7kdomf3vI6SbRzVE6AcACbRLgaQ8NAE1IT70vXsoe49rNKptmzYni1Z7wg1C8ieGnbIlqth/sJVGU1XKPu4SPJ8I38DWXGOyXNvKUf8= X-Gm-Message-State: AOJu0YxEZT6DTsPtrpt3vktLvTT/0HwLqQkbC4t8TKBPQGAcLbXViqUf ca7NwlVTFT/TyOLIhJ26exUsjRuM2qv0ujc9UhxmsPW7WKhW/1Me 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240616_073604_167868_8703F154 X-CRM114-Status: GOOD ( 29.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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