Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp925251lqb; Wed, 29 May 2024 15:09:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLSrBsB7v2aI+pqC41+K5re2PuUoijh8vRyv5beeUf4M7eUhVhmB83akwrrhSb4FV3oCd9n7AexXAGNc07JUuSHuNFl2TOt76RFlynOw== X-Google-Smtp-Source: AGHT+IFYJoEEmd16lSYa+O6QqHBv0At/rWYftVLC0oJ3phvX1DvUkAkLY+acONpzEoXxrqKh+mcQ X-Received: by 2002:a05:6870:b027:b0:24c:a415:fd4b with SMTP id 586e51a60fabf-25060c06867mr562891fac.35.1717020564014; Wed, 29 May 2024 15:09:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717020563; cv=pass; d=google.com; s=arc-20160816; b=evuFE5VTzindy7zlGfz+AUetSaX4AAzoDFezR8ePyMiUXGbuTXxT1Cw4h9zTelZGzC wpfnIM0wlF+wgUjkp78gAw+wWlloWew9F2Be6qX48HvuXCzerlmwHTOdBiDERUEnMgIp phS+T7jK7alWMDSsFVQDP0rnVP0p6IbkXBf4oWV+702kpwXlXEKaXCsSrOXb7/iNw7Rp DEXsyEKnWQ4rpl8dppqgbU+Pr40DdPEb8M5FjMKvAPtekDfUPKM+qs2SCOJuFNQjV1oP jbXR+Kz9nc0z2vQn8H0WFp6hfGvAhbjpJ/rio5oqDF2D539zKRbO4vUcjqiZnSflvI6j C3dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=f8xK6+TmwDgGxXLLWJG3FKZzw/YthlZIL7eRbfgq+zU=; fh=PGtJEGTW6wgu5TsZ5JEhF7yKeVILA5g87FFxDz+8/I4=; b=itui711eKmLGBWId26AXUMZ+1x0Rb3OK56eyUZKgv3HTeqThguxVkWJFLjXgNVszZX UJFElHC2TQdbPWmqty8OpUH6lwNJ4ck+emMrofrZksu0d0VPqMVzU2yPFA0/gdLfP5p4 mddC+sl6pdG/BpXUHYbwcKm8bFgOVn/f5PWLw+lX/jwPRRz6Dnzn5Wr2uHUrHkmsS8+8 FHkhY8BGooooQz9Hy0UQvbJrf/JQtyzLYCQwm/0TO7e2E1MOGgzNavnls7dEvTx6RFka CzzByel9sUTfNE/CVPm7SVvTZqac6ncOw4o2Tbn6dURPcu+bxJn0vYqOucReHOng0CNC JzHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BiqBUDn1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194730-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18c7421si132269141cf.624.2024.05.29.15.09.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194730-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=@kernel.org header.s=k20201202 header.b=BiqBUDn1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194730-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A9E141C21485 for ; Wed, 29 May 2024 22:09:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 056461CB30A; Wed, 29 May 2024 22:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BiqBUDn1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F3B111CB302; Wed, 29 May 2024 22:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717020542; cv=none; b=BkENQ/pdHIEwlchMpL7c3jkShFXBKA8kA3RgFGAu7Ry+8sG83ukT4OUWbPR+lYIQZroplJmC7lU+f3EyzbjbXlZlGBxcAZEws/wg1BOHjOMsjnZp0DYJyp+v3v5J93dQZXsSPi6zGjRYRdamRsrgTug2rkMdLd2Ff1yHo3yiBX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717020542; c=relaxed/simple; bh=5hJscbHLPraseeS6H0nSdgSUUmKcqeXC1lMt7BU2w4Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j2QDP3RL0CjdVA15p4s/5rp6grhtidq4KQjlSkq70MFjt4pRzX5w89zdtNaPxSoiQ2djuJTDiPyKH04fTplb2JNrHlJVGC1C0hW+RySLovv6WzspiQ6Ddl0dObCFHDmpRP8NHmkB+y7uDtP0hlzj+ofztTIvPy6scQ4IcH9YqTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BiqBUDn1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70119C32782; Wed, 29 May 2024 22:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717020541; bh=5hJscbHLPraseeS6H0nSdgSUUmKcqeXC1lMt7BU2w4Y=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=BiqBUDn1idmpEYrYCPGkumQs2VOdUF8LjxdpfFUOymSP9Q/k3Rluw1idu6cc67gSi EGdGQBmOUF8GLMe/TPK5Uo0aX0LAdLhR3WSt3qu9dGC7NIi7ht5yFIphAl0hdypbeX 7eB4K3Jor2Lk6aZZ9UImVaIHquTMB9ohiXAqv1x6rUt8l8lzW142ZRMnd/9VMZU9Po gmCK93Gq0N89asm7F/4fY177cn7M4dUW41bQG1LjJBMVVmiHiM5pNswcXAh2z+HXrP PlP4qPyi3s+A01I5+OO5rWP0eLjpCIRpJac/Rn0z1kHaLH8LY7Y7uBqcJTv++wdJei ghZHX8VNqGXcQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 05204CE0EE0; Wed, 29 May 2024 15:09:00 -0700 (PDT) Date: Wed, 29 May 2024 15:09:00 -0700 From: "Paul E. McKenney" To: "Maciej W. Rozycki" 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 Message-ID: <5567ab2e-80af-4c5f-bebb-d979e8a34f49@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240503081125.67990-1-arnd@kernel.org> <272a909522f2790a30b9a8be73ab7145bf06d486.camel@physik.fu-berlin.de> 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: On Wed, May 29, 2024 at 07:50:28PM +0100, Maciej W. Rozycki wrote: > 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. Glad that it helped. > 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. There shouldn't be any memory barriers required, and don't EV56+ have single-byte loads and stores? > 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). See the uses of the fields of the current->rcu_read_unlock_special.b anonymous structure for the example that led us here. And who knows how many other pieces of the Linux kernel that assume that it is possible to atomically store a single byte. Many of which use a normal C-language store, in which case there are no accessors. This can be a problem even in the case where there are no data races to either byte, because the need for the read-modify-write sequence on older Alpha systems results in implicit data races at the machine-word level. > 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. Yes, support has been dropped for some of the older x86 CPUs as well, for example, Linux-kernel support for multiprocessor 80386 systems was dropped a great many years ago, in part because those CPUs do not have a cmpxchg instruction. So it is not like we are picking on Alpha. > 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. I don't know of any remaining issues with the newer Alpha systems that do support single-byte and double-byte load and store instructions, and so I am not aware of any reason for dropping Linux-kernel support for them. Thanx, Paul