Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1522946lqe; Mon, 8 Apr 2024 11:15:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUrBdXo/LRoPgtaXRHmPEgvz5aSg6rfmu1+6tmI/UZZSGyTVGERSkWkUJvmhwx/pOiiHxT6xJo2MysEGDVz++ZiYdvLe2gArvJnSoKaNg== X-Google-Smtp-Source: AGHT+IEt4Dhv0VpOX2DIHW+I40l/Upo9IPLEUXGa9f15cIAYFtiQNWW8qQL0qGv5EB1UQCmR9W+Y X-Received: by 2002:a05:622a:46:b0:434:85da:4022 with SMTP id y6-20020a05622a004600b0043485da4022mr5316593qtw.65.1712600113945; Mon, 08 Apr 2024 11:15:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712600113; cv=pass; d=google.com; s=arc-20160816; b=FtpEByQ64uiYeb9Xphqn83nVu8SgVfhPm7DowF5gFSjvrOLhlIVl5ByvpaiSYm4U5b qAw7vkGYWIrGaD0CAwtHUY1IPOOAeX106/oQAD0uTnRlMey29PrwORqFk2fKu544ECnW /8xaj2WbZdmAPeusaCUajOdBTt6QknUr/E/pNLjnKV0zUfLDcLgB58jiDHnGzCF6RBVP B/UPUhCk8dbhICe+lFXBVa4ozjBuXjUoXv+cYPj3RD31OEVrX1kZ8Ao0/t2GBvpIAgcu nKzMpjLb9KQM84tu/S4CZLwbo0CCXiWh+sr1fhrEEGdcUIErFzVx1PkwIfMlVMl28P4k vJDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=lABSIXPCn9p8sq353W0yAZhqYSCgGyOF0S6qhldHPVs=; fh=lcVN/JAXD7cQfFQjBa5xKSj0oBu66yZpMtNLSq1kUH8=; b=h6dchLi9rX3Dg4JMRFEp1K3QB8RpN5A87kijeSn/nuUROH7ZhrFixOh0S5WQPnjgnq U8v7c1b0KsPxZbXcBugYS3mp9iAcfih8ZMMwjCTkoZkNI1R+YY53TWkUPQdDB5pd1vXG RPYHg5ctSVFLrVMooLO/BoCsjs+1GfEHNgJwmarpAFETKNHzDQ3yM6bNmYFyPiJsjkyg IoaDbDPdFCsTAp7HEW4r3Oz4rFCeiJQUpryxW7HKeDO2sHddf5Md8kraX7tjOZq4F7Yj TVnTXFrUvPCJp9wMzMC3k2kxANIv1IksdmkKDW8r/8BBSg9iKYBPzx/TslSSHqJph2B0 6uIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="rD/DuaXG"; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-135802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n14-20020a05622a040e00b0043183cf56b4si8526831qtx.490.2024.04.08.11.15.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 11:15:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="rD/DuaXG"; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-135802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 99AE11C23DA6 for ; Mon, 8 Apr 2024 18:15:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 119CA1448E8; Mon, 8 Apr 2024 18:15:04 +0000 (UTC) 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" 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 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.