Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1607148lqs; Sat, 15 Jun 2024 17:51:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSxFLDp54sOm6qf5rhLu0EYGpPV3036NR4MbUX406wBAbTqTvM36JnEIMZ/tLcyNgOjHeS6ciXSjs7XKU3Tw9j+9OLRnJpWGKQAyoiEg== X-Google-Smtp-Source: AGHT+IFaE8nOJTZAFPCevOpPadf74ZAmWgN0Tq869hoF03gZCaYLExSCBA8T76tLBX0rq4kvLvGH X-Received: by 2002:a05:6e02:1786:b0:375:8fa1:529a with SMTP id e9e14a558f8ab-375e0e2394emr75652955ab.10.1718499103759; Sat, 15 Jun 2024 17:51:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718499103; cv=pass; d=google.com; s=arc-20160816; b=G+AsLBW9OJTnC4hTHc5WBmAVxPu0U5FuHE6hmr9iN9zi/GDApJ+HDd+jn2H6Bcr2vv SFhCcuEOZeE11vwlbZpVNIK2lrp+6UDGzUYDOTuW6fb1FmkZ5IUZ20mEHgncC75Z8GRY Fi9eHfFnzmGxGJ8uvArEtwFI68FufeFC7ODfNVjGraHSZdHs6e2X8y/PeDcC85zBncH/ LtDvOAL/eXtRMjjzwSminwi9mlKI4C50xs8uzx+qcWXSbU7BxnfM/yqqoSDHOCd75Up4 e+rhAIalObw5ZSBS+LlGOUdOGdvdsEEqNmNZAG7uS04+r4WHjCJHwH/wPMbpiJHSY+87 saxg== 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:dkim-signature; bh=NNUTnA9Gyih8/K0vQFv3C8sKwIbjbeGAKUG47PfmPjI=; fh=nmKD5aAW8mtUan82IL1Bs2lUZ/6j0y3e90Lt5qg86XE=; b=ovDGdKLMdtezuO0zvccFOU7oxEsefKRhfbA7zH4JDwRJlrJl4O2fgmaZMnZwiNCswO BUlDHYkhdDzaTGAoZIJMIbOkUQrJYg8vWwKCw6/WfXAlg0KLbiYO6NmciNS4THN0QQdH bWwEDJhK8uyD1f8aHa7f4PZhqguJ/f6wDAT9fRQ6bTWEavkWL7G1wKQOZCLCeIm6roQL hAgLNs6j2UBDSBye6xWzAnfP/HBl2mrMmSJ3gHBdj556MVHd5YksyQI6J32F+9af3R+m e82LBiH9BgVWMD3yZwkrcta+4rUFEXYOQUqLq+78tj2LGmsrwQQH4syj5TXH2AWrWbEy WSDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=VtLVoOlx; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-216070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fef2feb913si6163553a12.437.2024.06.15.17.51.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 17:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=VtLVoOlx; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-216070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 26480282C73 for ; Sun, 16 Jun 2024 00:51:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B10A679DC; Sun, 16 Jun 2024 00:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="VtLVoOlx" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 8F017632; Sun, 16 Jun 2024 00:51:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718499091; cv=none; b=S0tSP1t7+J600jLxewA9kIaZN5hfN0v8m+3awxJha6i/Bk3aAyIp6hLEAbSx7Ciq5QoTP0yOaMZbx8Z45iBKz9xn42fqc3PvoLNBqSNCqmobUCFgANh2kfZY9WpvCCuvr9muvTXyMAWY9VAdRx3Qrr08WXwT2KMkfiHSxKXI28E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718499091; c=relaxed/simple; bh=N+v/YLdQLp1vQdvfmytEeoQSouaucGro69aA2tJTLyM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UNIpy/DO0hTobz9IjEpFvzI7092qQreKNIyQdF+tdjPCu+KyKdlcue+aw10R2wryNs/T4oacVGpkVmbNTpv04AvPWBt1aYLSapKxUSYE5gva7jnShpsvafpN9iXN3NeynY3nHvp698D39hhg65A08yywwFdN4FZ8YyZIUbtN2q0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=VtLVoOlx; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=NNUTnA9Gyih8/K0vQFv3C8sKwIbjbeGAKUG47PfmPjI=; b=Vt LVoOlxKt/jIxDpOju0bj1BGfg4y9i/+40GOhfVCmfBbgWiMvAFoShBZIZsTewHSyMLPrOAN+e02dK ZYq9ut3t8OBzITmFMRWBOCUi69JV2txvHNVUwDIuTcVq29brvdLHnLLpVqIrs4Kt5eJFqtfGHJjiN r21Zx+G2JvCQdT4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1sIe72-0009mY-2p; Sun, 16 Jun 2024 02:51:16 +0200 Date: Sun, 16 Jun 2024 02:51:16 +0200 From: Andrew Lunn To: Miguel Ojeda Cc: Boqun Feng , 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: <82b88a19-fd8b-4486-b1a5-7d7a03c12d62@lunn.ch> References: <20240612223025.1158537-1-boqun.feng@gmail.com> <20240612223025.1158537-3-boqun.feng@gmail.com> <20240613144432.77711a3a@eugeo> 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: On Fri, Jun 14, 2024 at 11:59:58AM +0200, 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. Since this is fully compatible to LKMM atomic operations, is there a use case for C and Rust operating on the same atomic value? And then you will need to specify the size, or odd things are likely to happen if they disagree on size. With Atomic can we easily say what type the underlying implementation uses? Andrew