From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 EEF55206045 for ; Tue, 29 Oct 2024 14:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730211472; cv=none; b=IMzmGaNbAr9mrrSibVCiZLE9DlADXtMXxaI6VIusfDr5ee91WwN6HXXB5iSrbRV9eJVAWmWo+D/3X+/+6Kz01uUwQqeQzwy3I7d8ypAMcagzXT5W7IrzmCbxWWTIPXqL4lmAwfErVLM4l+Z+7bqqzeQh4HPKLsYL9Xx0HTdHmgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730211472; c=relaxed/simple; bh=L6njmtDV2cbOykXHmeJ6c8LVfIwB8LafghBRfLJvvy8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=X6R1nKLL0daiL2loy24W5iLH4gC8qfrL7J0bccRAfHangFBs3QOM1UScEhm062Izb599alws7+TRXFQm3nNuX8zeC80eU5MlWspTJ7BX22aYv5NxJzf/co2NVZIy9xQZt0Kxt56FxQDiRQFc4HNj0jOh6lEA/8fqjVY2HFt5uO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TwFCwFZX; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TwFCwFZX" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4319399a411so41807175e9.2 for ; Tue, 29 Oct 2024 07:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730211468; x=1730816268; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=L6njmtDV2cbOykXHmeJ6c8LVfIwB8LafghBRfLJvvy8=; b=TwFCwFZXPn+V3TXef0Gr+Fq/AB6ok554ZcAKIpCXw/oXL9C4Nh498UcHG3LexRKDIl wC9Kj3gGgtm7Y175kX4gC4YFeanHtk1/OoKdAqU4nkuFKP23fVir4AvjQzLFcErQj3pM RmwvJAHZPyEXwMKM0qZtm8tsswmawWksau2brE5RNo3XLOh6wIjN+QfETgziIlxY3pLX c0DPvTCG7TC8tBFgapK69xqdn44+bFK4V7MHNh5ieJPqKcLU2VGBrHFqWO7MoIarlUBs 7KXPoENevovQ9HQlYFS7IgNJ3RnpmUYKbvGNOkVWl2C2aeIPvHu5BskyPji/8mnYeHSF F1uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730211468; x=1730816268; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L6njmtDV2cbOykXHmeJ6c8LVfIwB8LafghBRfLJvvy8=; b=lYaEeC7u3oIObjTUaB+DMFvWMOdNkjhlEC29kkqH7uvZ/etorNc31YDXtkkJAgYHlU eo6CYk3ZnjPxsozshqQkONQmbQm+cvrC+/7lmrOipuR7TCjoPCiIGRMGhYIeKPRsQ2By 40ZamCIYLU3yQi+dLd1Iu+OlLRuGp1/iPYWWU1/X/Hg7RvPF7Qrfnw1EvpgK4fu3Xytu Vk/x+JtHc1gMZQ0pbPBpMtGG1RMYEe3hamVwVsDt89kWSYhL/okoNOIFSaolTBWvbCbf n9uoGVg1mNnP80YRNzN5FUGUakPW2rt5icsdisM695Q+2SNPab8XmfMDix8r7cIP5WOw Sosg== X-Forwarded-Encrypted: i=1; AJvYcCV5lYfuVtqFSuZFW5WJtD7NMF7WmFLtDki24MNg/CrFCxJDe6qvYePenmOxXJ++QO9ThMyFPHmJRcyjR+BABg==@vger.kernel.org X-Gm-Message-State: AOJu0YyPI5dOh2DKC+xJjbOxontxOHG87xZ/vp60WW7WBG5yeeqrdKQC w60HeeBzvIp6i3DHpZWhRnzva/aFH8bnR04VFRd2Nl9FScGwbyfNHJDQlGchgyGwQOzOEEiV+Cn Wrktnvl/DXdyAkU5RFcex8tIX9q1g5Qq9GYl9 X-Google-Smtp-Source: AGHT+IHhbBKGiK7BgU4W978cOb33NcTjzUbMbdW09EsxTh1luCi/3DLowadG0MtS+fdBvmIOkjTTesI9JgwmFdik64o= X-Received: by 2002:a05:600c:4f03:b0:42c:ba83:3f0e with SMTP id 5b1f17b1804b1-4319ac7078dmr109957335e9.7.1730211468245; Tue, 29 Oct 2024 07:17:48 -0700 (PDT) Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20241023-static-mutex-v6-1-d7efdadcc84f@google.com> In-Reply-To: From: Alice Ryhl Date: Tue, 29 Oct 2024 15:17:36 +0100 Message-ID: Subject: Re: [PATCH v6] rust: add global lock support To: Boqun Feng Cc: Miguel Ojeda , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Hindborg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Oct 28, 2024 at 6:49=E2=80=AFPM Boqun Feng w= rote: > > On Wed, Oct 23, 2024 at 01:23:18PM +0000, Alice Ryhl wrote: > > Add support for creating global variables that are wrapped in a mutex o= r > > spinlock. > > > > The implementation here is intended to replace the global mutex > > workaround found in the Rust Binder RFC [1]. In both cases, the global > > lock must be initialized before first use. The macro is unsafe to use > > for the same reason. > > > > The separate initialization step is required because it is tricky to > > access the value of __ARCH_SPIN_LOCK_UNLOCKED from Rust. Doing so will > > require changes to the C side. That change will happen as a follow-up t= o > > this patch. > > > > Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-2-= 08ba9197f637@google.com/#Z31drivers:android:context.rs [1] > > Signed-off-by: Alice Ryhl > > Reviewed-by: Boqun Feng Thanks! Alice