Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1151107lqs; Fri, 14 Jun 2024 18:04:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgZrGI7ZnDifTzssc3JewFy/zIaBqmfQCqTgAw3a2K1aVSMNlwUyBeUiPCrVM6fbC3+WkWqoXi1CXEteHn0Fe0I4FgaAO4hMOb3qC9Lw== X-Google-Smtp-Source: AGHT+IG4JSSy1smU9N9Fo9uwKCwi6JU6uRdXtfK7z2PUkEaN0/yIhBDzBqftgZPAZShozHM5qQG1 X-Received: by 2002:a05:6358:fd06:b0:1a1:21bf:271 with SMTP id e5c5f4694b2df-1a121bf03b7mr322592955d.4.1718413463697; Fri, 14 Jun 2024 18:04:23 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fedd5e8b55si4950839a12.181.2024.06.14.18.04.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 18:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Rgiqf7Tj; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-215624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 001AEB22808 for ; Sat, 15 Jun 2024 01:04:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDB6B6AA7; Sat, 15 Jun 2024 01:04:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Rgiqf7Tj" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2087.outbound.protection.outlook.com [40.107.96.87]) (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 B4C47173; Sat, 15 Jun 2024 01:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.87 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718413441; cv=fail; b=d/41BEFkT97LXA615s0ZXs3NtV3VzzflZ0JvECTSIji/KIl3sGzwm7fYaTo1SSjVACMTRMXEgUczYqPO+acOpHN3GGsfrvUHOHtavLMc86VPznHPiMcLJlk0VeO7efzoXqlDs2m3OqAGWwd3UbMJFL6uYV/509wXB6ppvxiIRO8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718413441; c=relaxed/simple; bh=Md4OuCGfV1aAK7iAEbju5/Y6nujHjyTJuuDiPquQz5g=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=kw2Q9OfjPcxVqjoHgnzEzatsXyS+bibXfmtlXFLvLDymFKD+Ztx+lwszEDpyJM9y1JGC8Y95mqJKbB8Cs0biceZCVwWmPNJ+ca6oQdhsfSKcEO0VvezkA1IpgRoX3SZmc5FZoPteRIP2+Mfbekq8on4xiwd5pXl4X4oBzfUJlH0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Rgiqf7Tj; arc=fail smtp.client-ip=40.107.96.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kO+WWhY9ZeazbDTejLCWaem8zcbBQPb/X8COL6yuGxQ/uFIBd7+fNEbx3WdaQMKT3P3EWknZb4zUlChYkn1t5/eJrj/IJ7Mq+Bdu73a3I0QayPbSDyKK2r9FhCUrAevBGNNGVGn4DElM58G8TU0P4afnzPwWDhElcBexiXc8YnjtRTfZxaQTYZITN+/iY02ym60MgAlO5jeDzm6YCbm37VTLKDqtHvAZiGOq3v+e6OeCv7up3VFos8F7vy1YBlH+P0/So1cY5eJUb0meCBS99SXGEq3sZQN35QAIsTPS92UiEma5sQWZta2xS7Mne61yWplWcL+X/fJpxh2BATqe4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+wQnPu6jsJn/7S2p4Y+wzsRPXeOmTVW9JBsX0vFSDIs=; b=P3090PZs5Q/O0HgBr1+fPchyUwo4FQG5alLuvPogfllXJ1dPZU+x3OZFmebaI1PBdo4keFGycG9WQ+UbS3m7C7/bMARILClrTscaUlo8PIBOH+2oI56k62TCXc3ff//DBHbfrCtAqW1n8dgHq/gnGS+UsG/zyHKGPmQULFgUQqselPtKQJf81AVeyX/OsHGcNYh/ifmT8+V1H/VXWQkkmAx62CI+F6Io7dH40S5PnNvgEYh/ST1Q311vagfdq//WkbfWP+VdyjIAymy0Dvoqj1CeX/9Ic1qDIXL8UUIu8QdHB+LPAyu18OiAtcn64M5u5WS3m3CdGAdWyzbLWDmmBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+wQnPu6jsJn/7S2p4Y+wzsRPXeOmTVW9JBsX0vFSDIs=; b=Rgiqf7TjZc4Lpac1yQc7gaPfTDJAO5xNx6WA80R/1cY529vyIYAEYrdLOM3FcYQAdIFsg+1pxDVUzbTjKJ9LCKWt293tydlq22Unpc8yD7L3CkMSNzUW7GdH1hM3a+EIohfDxfmG8z/C7BXNERYbP22iHTIBNWfUZj1Pksg5OgZcDOmgxW1GJc1X9ju708jdjwsQn67vMvH1SlBmsp4BncI92GWevRYiSHvb5qzS8YPkeoda8pVH7BJPToYvUEk4yCSIjz2hGQR28g9/+oK5yxGx/mKGKPNYFeeOWnjwuOSNNo2Uf0hSIvzNcGbEBNauCSx3LXvVJL+9GWaIHNHzOQ== Received: from CH0PR03CA0292.namprd03.prod.outlook.com (2603:10b6:610:e6::27) by MN0PR12MB6003.namprd12.prod.outlook.com (2603:10b6:208:37f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24; Sat, 15 Jun 2024 01:03:56 +0000 Received: from CH2PEPF00000147.namprd02.prod.outlook.com (2603:10b6:610:e6:cafe::4d) by CH0PR03CA0292.outlook.office365.com (2603:10b6:610:e6::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.26 via Frontend Transport; Sat, 15 Jun 2024 01:03:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH2PEPF00000147.mail.protection.outlook.com (10.167.244.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Sat, 15 Jun 2024 01:03:56 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 14 Jun 2024 18:03:40 -0700 Received: from [10.110.48.28] (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 14 Jun 2024 18:03:39 -0700 Message-ID: <79239550-dd6e-4738-acea-e7df50176487@nvidia.com> Date: Fri, 14 Jun 2024 18:03:37 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 2/2] rust: sync: Add atomic support To: Miguel Ojeda , Boqun Feng CC: Gary Guo , , , , , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , =?UTF-8?Q?Bj=C3=B6rn_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 , , "Greg Kroah-Hartman" , , Mark Rutland , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Catalin Marinas , , , , Trevor Gross , References: <20240612223025.1158537-1-boqun.feng@gmail.com> <20240612223025.1158537-3-boqun.feng@gmail.com> <20240613144432.77711a3a@eugeo> Content-Language: en-US From: John Hubbard In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000147:EE_|MN0PR12MB6003:EE_ X-MS-Office365-Filtering-Correlation-Id: aa803fb8-5abd-441f-faa1-08dc8cd7082e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|7416011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MFhsZnkvRlJLT3ZxR2d2OVcwQXFpbGpiTmEydDQ3Mks4TTR6ZHNYQUhuZHdB?= =?utf-8?B?clhhUW53RzZjSmlUNURsZXdsRHN3ZXhRZC9UM09ld0xHWFBNQU4zUzJIeHpn?= =?utf-8?B?VlVKQjlwRGphcy9uV1o5b0tXN1QwTW14ZTNkUnUzd2ZkNm9IbkdQb3o0cnFm?= =?utf-8?B?a1kxbmV4T24xbHZ1RWZGR1ppVGRWZ01ZYkE1UWRsemFsNzlmLzdNSFJ0OCt0?= =?utf-8?B?ZHViT04yMFE5RWgyVm11WklEdGtzQis2SmVaTlJtVlFFWUdZS0FMYTk1LzZL?= =?utf-8?B?aHdMMnNUcjN1ODAyY2kyd2k5cnVYZ1I5aUpCWmQ1ajVMRnhBYVY1RStjQW40?= =?utf-8?B?cmJPbk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a0tHMXQz?= =?utf-8?B?ZkRGYkltbVhhcHpDRjBHZTR4dXd2alVybnRtYXY5MXEyZStpZkVwMEpFUGZU?= =?utf-8?B?alZkOFFRcFJNRStTaE1ud0JvcjQxeUFjNXVYZU54OWdwWlhmbG1yZ2REQS9O?= =?utf-8?B?WVVScDVsa0lHREFwc05CUnR2Tk1vbGhEOU5zRGI0NmlNdFQ2c2ViYVJFSmJm?= =?utf-8?B?cXlrbWlNYTBkbkFFaGREb3ZZSkorZEFSdVRKSUlldzZrMnBRT0lsL01FM3lk?= =?utf-8?B?UWQ3WXhQMlh0Vm1jdS94amMrNnFNb0VnbmVoeXNjY3ZkNzczZER0S3NjSVNO?= =?utf-8?B?UTZYTmpZMWVRYkoyeTNtaDk0SURCc2FwTEZpTnA0RDNLa01odlQzYUxENGp0?= =?utf-8?B?RG9ibUdOQmF1Tjg2dVhLZnlhYzZVL2VuQlRJcmZqTmVzVWlKRDc0MURESlF1?= =?utf-8?B?UUgwRC9lTzR0dUtOVWl5Ry93N2FNUk9rYVhBZXIyVkViN1ZWWVFqMFgvTDNn?= =?utf-8?B?c0lzYXpCRTI1azhCZm1pOS96bk9GZDVBL2xkNnlVR3lNelNrd2RvUUNTR1J5?= =?utf-8?B?aXhmMzRVaUlIL2xSRnZGN0tUMThNeWZ0L1NjZTlTS1F6RE5pTHpZVUx6Yzdh?= =?utf-8?B?dnBOQzdubFFmSnc0WHVKbTRqeTNLSTVvSEVEMFVIRk4rRGc9PQ==?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(7416011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2024 01:03:56.1515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa803fb8-5abd-441f-faa1-08dc8cd7082e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000147.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6003 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 between the C types and the Atomic types. thanks, -- John Hubbard NVIDIA