From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 3906B1E532; Mon, 8 Apr 2024 18:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712600103; cv=none; b=qHei4SoMm5ukA5X4eBA25jHVdmmhiFexFFA29YQ8TT9w7iLYXP7DkPhcg0kt+bHYiGW6wKaxqfAm4Pe2Vh3mI3pP4PL5MHIwWv+0qG+eL+6PIB1auKHobYF4pIlHcUr+3GsgI5jmOE1xaMct54eKe7xeglxdJ7Vg57d8Xp38HaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712600103; c=relaxed/simple; bh=DRLQBzi4n7i2Dg4ZtyUnMCFLjm5PQPflcAJMjZDoMg8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QXLwom81nuTjJ+uJbk8Or74jR4RwT5FvGZNVbPUZFB6JMRXp8OazOnol8RuwKXJCgPQGOuW/N8sX1NL0efr1jV6an9w2QnVjqumW3P0Zi7PSgKW0TT2ylcK+BQSfTdN4ey43Ka/qhWJ3bVWvO6TugzofLHmsin49ynfHm4x5BKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=rD/DuaXG; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="rD/DuaXG" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lABSIXPCn9p8sq353W0yAZhqYSCgGyOF0S6qhldHPVs=; b=rD/DuaXGJUwscfQo6NGAG8g65s tCzL7+mWcBjrNTrmZag077vReK7YhF9gncf0MwHcNkynQKZrrryCqMno6LpBRbsLVkbJMYcqMTk8p j5iM0qqotUpxDQkZc8YMeNhn2cmm3ZYMqLbv1IJXwIUjXasU7KmeUFqQvZMU5UYpUgad729+PY6uv 3I1xKRatGGvS5iW2NGLFI18yKnjFt+vrFUqwT+7nvKoM/L+0XYV31HiBHJxan0g8SvYgmUIdZUgj/ 5zB/CAY0RdNSRipc6fkXry6fwS74eDECzfGai5oX7VzRgvQJxFnC3suRfxdoHCWpGXqr3xatvzgfQ 99plpD5Q==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rttVt-008cm8-04; Mon, 08 Apr 2024 18:14:37 +0000 Date: Mon, 8 Apr 2024 19:14:36 +0100 From: Al Viro To: Linus Torvalds Cc: Matthew Wilcox , Philipp Stanner , Kent Overstreet , Boqun Feng , 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 , Gary Guo , =?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 , linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [WIP 0/3] Memory model and atomic API in Rust Message-ID: <20240408181436.GO538574@ZenIV> References: <20240322233838.868874-1-boqun.feng@gmail.com> 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=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro On Mon, Apr 08, 2024 at 10:01:32AM -0700, Linus Torvalds wrote: > For our own historical reasons, while we have a few generic atomic > operations: bit operations, cmpxchg, etc, most of our arithmetic and > logical ops all rely on a special "atomic_t" type (later extended with > "atomic_long_t"). > > The reason? The garbage that is legacy Sparc atomics. > > Sparc historically basically didn't have any atomics outside of the > 'test and set byte' one, so if you wanted an atomic counter thing, and > you cared about sparc, you had to play games with "some bits of the > counter are the atomic byte lock". > > And we do not care about that Sparc horror any *more*, but we used to. FWIW, PA-RISC is no better - the same "fetch and replace with constant" kind of primitive as for sparc32, only the constant is (u32)0 instead of (u8)~0. And unlike sparc64, 64bit variant didn't get better.