Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp699130rwl; Fri, 31 Mar 2023 00:44:36 -0700 (PDT) X-Google-Smtp-Source: AKy350bmzsbmVrQwuiTe5uUI/E5kSr53MJF69cdZ0pn/NlOSTfFhqotSRB6ziNaOrM+m2W5XDFsh X-Received: by 2002:a17:902:834a:b0:19d:1e21:7f59 with SMTP id z10-20020a170902834a00b0019d1e217f59mr22421126pln.0.1680248676279; Fri, 31 Mar 2023 00:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680248676; cv=none; d=google.com; s=arc-20160816; b=p4yoDSAszfFopoJelCKK5yWMaQ2EXKHEsPNsqTUEVWvQ3tRXVOr6PUf86jPF76GLgH wd0z4xcfzUuW25XNbP2dO1P8l4LsyMCXsprzNOWbmQstzuxVXldtYpWzOYPQRvwnCmlf hHtOSr/STNego4v7X/arMXqH48olZ5Fc92N0JHZwCid22NVUB3TqcoKbhN6yecjNj09+ E3AY0vCYJEwUMuGbjqOPHotfQSHYVdiafvzpWenPl5Hgg+nadrjjwcXbfzwS7RTf3kCH RdZLxyKBAKBlZDcqtKd3rJC61e3r6FXCuV1ZUhd6bLXezjx83SU3zZ+s7Xla4H/mrf4Q Qi5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=5MJfRpO+dCBuD2QslsP+SHMLwF08YAQPZ56IkAHTbT0=; b=m6REpiA0JFiJ69Ej8si0g2RT79msevQDSKuQBJDcUMBUBnCDeD4GZ4VwdqYpkpdB9q uxna0W0erAeTVoz3Y44P4Cwg6Tl1/SmIvJO0MnvMkJnhirEXndJE1DQktcU9tR1dZRYB o08mxDHxMCl+1Cm9x0fpCGJXJ23T4SCn4loUrCejtmGuUG0thM0Q79ECMYgCVhGWomkX wftoq0ORC+um5ZKkUZcRACJytwTCUcGHbeGMM3EDJD4tLxlmm4W97hDx+Po3X27zet6o PUC04Y/813nrllANtOq7oseKb2vhOzUChhVUM6GgDyd234fIteH/In56GDhyCSja1TKD FcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ryhl.io header.s=fm2 header.b=XLCxyHaf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=EJLBUuFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ryhl.io Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902aa4300b001a1d6a9c6besi1537887plr.386.2023.03.31.00.44.24; Fri, 31 Mar 2023 00:44:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ryhl.io header.s=fm2 header.b=XLCxyHaf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=EJLBUuFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ryhl.io Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbjCaH2X (ORCPT + 99 others); Fri, 31 Mar 2023 03:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjCaH2V (ORCPT ); Fri, 31 Mar 2023 03:28:21 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1621C768B; Fri, 31 Mar 2023 00:28:21 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 813DF5C019A; Fri, 31 Mar 2023 03:28:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 31 Mar 2023 03:28:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ryhl.io; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1680247700; x=1680334100; bh=5MJfRpO+dCBuD2QslsP+SHMLwF08YAQPZ56 IkAHTbT0=; b=XLCxyHafha+KRYaz/Xp/c2jIG4Q+V18mqz9L5W1fhQmGBqiNlVv 7j8vZ3S2AfG2SIClEEwMv7/XC/htYnuvcNqoyvGmXvn1kkEcxINFNicBjBRQVVLF iz5dqgp2RnxKOfKrMNsgjDDcU4qaZgFwWQKgHvC8HEzGQ/PApmuNRid0QliTgM8m VTAgWxBxi6Xg04e06wSVFrAaP0aiK+TrjiLvuXr05lPb7IFlie0a87o7c4nj6VeV rSPs4e3fzbP4KRQoZdWQV/XAx+sPwRdSV8/NBFhX1E1DCVZmmY9e5PK4dvWblkWw +dhK6oSscSztWdpueJsQ6qjmb0tJgRD4M1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1680247700; x=1680334100; bh=5MJfRpO+dCBuD2QslsP+SHMLwF08YAQPZ56 IkAHTbT0=; b=EJLBUuFHcas3fEMOIEwV1AgefTVcrxPr7G5wkugubuV37eS6RAa efX7mMYC8+3sqk8AA49pe82WX9VmcT3ne1QCMd6cQrfi0InVAnKBot02MZqqBqDe fVJVIOcSz1e/u2okUC3yMkzdH5sJmzx4WbVpaUWRcApRs9slc06IHn0ZHUPYWC1h H8XmEloTjTJOBixeKvYpKYZnVXsLCtLD9eZyq6lqd48NaYXwMjeXFIOCWlCvozMt 0UcRBMz5rryBbkjj2vwMAVn6FmaoDxFkxZ5Z2GkQNMTGs+4tt9H4OvREMjVTK66F WXffatQVyvoTXT2jxT6gHgUGXXs/m63o9FQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeitddguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheptehl ihgtvgcutfihhhhluceorghlihgtvgesrhihhhhlrdhioheqnecuggftrfgrthhtvghrnh epheduuddvteekvdektdduledugfffhfdugeejgeeuvdevtdetveejheehiefffeegnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihgtvg esrhihhhhlrdhioh X-ME-Proxy: Feedback-ID: i56684263:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 Mar 2023 03:28:16 -0400 (EDT) Message-ID: <1cd137de-6ca0-a079-429f-6cb964a0f811@ryhl.io> Date: Fri, 31 Mar 2023 09:28:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 01/13] rust: sync: introduce `LockClassKey` Content-Language: en-US To: Wedson Almeida Filho , rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=c3=b6rn_Roy_Baron?= , linux-kernel@vger.kernel.org, Wedson Almeida Filho , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long References: <20230330043954.562237-1-wedsonaf@gmail.com> From: Alice Ryhl In-Reply-To: <20230330043954.562237-1-wedsonaf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/30/23 06:39, Wedson Almeida Filho wrote: > From: Wedson Almeida Filho > > It is a wrapper around C's `lock_class_key`, which is used by the > synchronisation primitives that are checked with lockdep. This is in > preparation for introducing Rust abstractions for these primitives. > > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Will Deacon > Cc: Waiman Long > Co-developed-by: Boqun Feng > Signed-off-by: Boqun Feng > Signed-off-by: Wedson Almeida Filho > --- > +// SAFETY: `bindings::lock_class_key` is designed to be used concurrently from multiple threads and > +// provides its own synchronization. > +unsafe impl Sync for LockClassKey {} No Send? > + > +impl LockClassKey { > + /// Creates a new lock class key. > + pub const fn new() -> Self { > + Self(Opaque::uninit()) > + } > + > + #[allow(dead_code)] > + pub(crate) fn as_ptr(&self) -> *mut bindings::lock_class_key { > + self.0.get() > + } I would just make this pub and drop the `#[allow(dead_code)]`. I think it is often useful to have methods like this available publicly.