Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp833480lqb; Wed, 29 May 2024 11:50:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuYK8qAJVUNcnwJHb/Iqc89sTO1ubIjrCFyjZiJvDZ35gmBCUtelihNzHgWjOXPhyvPuZ09undELPhks613X7N6+Z5tCS82s9aRSuFpQ== X-Google-Smtp-Source: AGHT+IHJAeTjqlpa2qfMZmgLVXp/HvdqotfPNKi+D7qfyFsvhjzSaQTRfMK8+nrMJvP9b7H+ufIX X-Received: by 2002:a17:902:c40f:b0:1f3:964:bb7c with SMTP id d9443c01a7336-1f4499017eamr177718745ad.57.1717008644537; Wed, 29 May 2024 11:50:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717008644; cv=pass; d=google.com; s=arc-20160816; b=ooFTU5BZe5nYeW0H/HJ/PsmitaFCQ3vvAz/RvtIi0ZDaxat9X/6X3Z8vToATfs66uT ICAHO2fIN4TpimBv8+A1bYeMw2PRMx2QF70Xr73rJvJyShU/81FiW4/06CtT1qIHWX4D 3u9AdKOiX7m/qpTanz8/sd/YoKVjXVhkZChAoLRUIBDB02AF32lHjIWSyIVNkoIe2ym+ aq9RFgtDmFjysg8pjUe9qMdL93923n61h4Pn+tRJBOGGVQUyZCEb8Nfu2Aj8CoOSIMxa bZOrjdE49b0j8K3VekXy/dbmqLVxEk5U40jYVlU9m34GnQU0R6CONrwvOdLf/9ZuiamI Q0ZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date; bh=QgjpyW9kSzmdzqnAoAZU2HfIsK+EklfkeMzqf3WPeX0=; fh=P2j1Jdod4hu66N1YxlUQSANCzTyVzmdtI81G2F/ZR6s=; b=tfkcwKhOWRl0LgtLvQmInr0uhjwO1wiO7yJwYyV7MmRAOMrujIn1+p8EGZWwmUNiV7 Njj7q8fvuo64ymnHOWjZPBgn7l0WLZIb8OsA21B5mDtyhtgJMZnQAQWcaYeMdKzA7+sB 8G+deUo9bEKbj//u8eQebtfZkBqJV+54rTIRHDxlN3/8unHkrgKt/GmjR2EMt8jBuL4W rGwhwu/19YT3rnu0WQ1jKQBw/v4QLzXwB2rC/mQMRadgQGRPxT482F0YM9AtDMz1UIR2 hw1dAHOW95PveEZYg76BKdsB4gSDSOlNm7Ve+3Xm1SrmeL5DgIN+Dm5dIxbbhc+GCpLA gZ6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-194582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194582-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f475e83a38si79498575ad.399.2024.05.29.11.50.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 11:50:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-194582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194582-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F6A9286425 for ; Wed, 29 May 2024 18:50:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 156FB1C230C; Wed, 29 May 2024 18:50:39 +0000 (UTC) Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA4CE1386A7; Wed, 29 May 2024 18:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.133.224.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717008638; cv=none; b=lx1Id/sQvwwvR/NbQcF1Yo8IEs8vN8moGb+xUpJmPlxf7ryWFWA2qg9n3GGzY4FYgWN7y4cc4AnM2NDr0H0eZPLwVrSh40489RHcygQM0UtFUN255ozYJAocpU5TeG0L0jmEiA0WZR9feuXmxdjY9ybIlxhzKKyHhjhoBdCUrIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717008638; c=relaxed/simple; bh=4zhxO8s80sghmwZ6xTs9Tn3DwRhHd0HONhAed0apv1A=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=eOe44F64YrF5JbvU6FQxi5IYyu1RfY4EK8kKeayOgO9wyRX5vMAivWLOpEzxhJ5lcbCYaYcS17JME1D4okR3PpkrdY559rR/6rY9N0SK1KNEIEGRr4Fy9zXInuL6Xie8VIQkm+Xy7Md861j4yCFYKcPk8pr1TbAMafVyN4fL9MM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk; spf=none smtp.mailfrom=orcam.me.uk; arc=none smtp.client-ip=78.133.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id 2B10892009C; Wed, 29 May 2024 20:50:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 23E9192009B; Wed, 29 May 2024 19:50:28 +0100 (BST) Date: Wed, 29 May 2024 19:50:28 +0100 (BST) From: "Maciej W. Rozycki" To: "Paul E. McKenney" cc: John Paul Adrian Glaubitz , Arnd Bergmann , linux-alpha@vger.kernel.org, Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Alexander Viro , Marc Zyngier , Linus Torvalds , linux-kernel@vger.kernel.org, Michael Cree , Frank Scheiner Subject: Re: [PATCH 00/14] alpha: cleanups for 6.10 In-Reply-To: Message-ID: References: <20240503081125.67990-1-arnd@kernel.org> <272a909522f2790a30b9a8be73ab7145bf06d486.camel@physik.fu-berlin.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 On Tue, 28 May 2024, Paul E. McKenney wrote: > > > > This topic came up again when Paul E. McKenney noticed that > > > > parts of the RCU code already rely on byte access and do not > > > > work on alpha EV5 reliably, so I refreshed my series now for > > > > inclusion into the next merge window. > > > > > > Hrrrm? That sounds like like Paul ran tests on EV5, did he? > > > > What exactly is required to make it work? > > Whatever changes are needed to prevent the data corruption that can > currently result in code generated by single-byte stores. For but one > example, consider a pair of tasks (or one task and an interrupt handler > in the CONFIG_SMP=n case) do a single-byte store to a pair of bytes > in the same machine word. As I understand it, in code generated for > older Alphas, both "stores" will load the word containing that byte, > update their own byte, and store the updated word. > > If two such single-byte stores run concurrently, one or the other of those > two stores will be lost, as in overwritten by the other. This is a bug, > even in kernels built for single-CPU systems. And a rare bug at that, one > that tends to disappear as you add debug code in an attempt to find it. Thank you for the detailed description of the problematic scenario. I hope someone will find it useful, however for the record I have been familiar with the intricacies of the Alpha architecture as well as their implications for software for decades now. The Alpha port of Linux was the first non-x86 Linux platform I have used and actually (and I've chased that as a matter of interest) my first ever contribution to Linux was for Alpha platform code: On Mon, 30 Mar 1998, Jay.Estabrook@digital.com wrote: > Hi, sorry about the delay in answering, but you'll be happy to know, I took > your patches and merged them into my latest SMP patches, and submitted them > to Linus just last night. He promises them to (mostly) be in 2.1.92, so we > can look forward to that... :-) so I find the scenario you have described more than obvious. Mind that the read-modify-write sequence that software does for sub-word write accesses with original Alpha hardware is precisely what hardware would have to do anyway and support for that was deliberately omitted by the architecture designers from the ISA to give it performance advantages quoted in the architecture manual. The only difference here is that with hardware read-modify-write operations atomicity for sub-word accesses is guaranteed by the ISA, however for software read-modify-write it has to be explictly coded using the usual load-locked/store-conditional sequence in a loop. I don't think it's a big deal really, it should be trivial to do in the relevant accessors, along with the memory barriers that are needed anyway for EV56+ and possibly other ports such as the MIPS one. What I have been after actually is: can you point me at a piece of code in our tree that will cause an issue with a non-BWX Alpha as described in your scenario, so that I have a starting point? Mind that I'm completely new to RCU as I didn't have a need to research it before (though from a skim over Documentation/RCU/rcu.rst I understand what its objective is). FWIW even if it was only me I think that depriving the already thin Alpha port developer base of any quantity of the remaining manpower, by dropping support for a subset of the hardware available, and then a subset that is not just as exotic as the original i386 became to the x86 platform at the time support for it was dropped, is only going to lead to further demise and eventual drop of the entire port. And I think it would be good if we kept the port, just as we keep other ports of historical significance only, for educational reasons if nothing else, such as to let people understand based on an actual example, once mainstream, the implications of weakly ordered memory systems. Maciej