Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp995477lqb; Wed, 29 May 2024 18:09:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRL3rO8XnV0f/B7GybprhnXryeCOGa7EXfMtPPgmmAjfkS8iyHXbsmL3x7Jza6LSzuBRc/WBoJdX/LBFsO3iOF4ta4MkxvmaG7BMgIhA== X-Google-Smtp-Source: AGHT+IHyanMuD9RvsvXup9D4tQdtX7sc2EHS7zg2sRJ3AYQD+b1m6LHzc6y4NVawl+dICt62QMcB X-Received: by 2002:a05:6871:740b:b0:24f:cfbb:2c29 with SMTP id 586e51a60fabf-25060c017a1mr1086187fac.29.1717031359971; Wed, 29 May 2024 18:09:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717031359; cv=pass; d=google.com; s=arc-20160816; b=iS36oqH87Iq0Bc1HUHkeAgRqHEi5M9nMr2NS4i+RLWtTr4YnYo3YZw1C1tLeBI5J1P 6GEfzvotJTMxlhkPERo9He0CezKaehXao1tlwj9qQrptZgCfSFxNiFHpOSJJSftXmLOv Vu5oUBUgXKqNJaUpkETb5irp8sx46d5XoKmx8Q2I976YxBVCw9tKl3V06TN8JTkqB1ek e5mMMQnSAuidmB5zFtq6l2JQ2x1pCDyS0QENtDk/gfFOd0WTHOWh6y2KwS4vdVdtr7uF Nr5312SiR/OConc3M5PtuscNOxkwqYyQyNhLnq5cmdpPaFG8b4lngMxxAS/jtNqgUOMW 8Msw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=Pc8AzCw2itqlchY2iNLylrW0HG92I3q/DnK9Zsb7BQY=; fh=XDwdpYfavRZd5Ymh1h1fN3xPwPqpYOe1dpYwvulVJlM=; b=F+cKzXpNSGiFPCKDVIG48/i99ocLvU/qItCsrtDTzzKm4yA/Ujl9ioCAGbQrifWOkf 6HC1HOUqiQHcbUMXzSM30i3146ykgUwZK6oDA0KShBL8Ef5YheUu75riyy8Etnk8DnwF y3G58LYIQm78vKfg9Pb5X2jHTJku2lT/bQeiXwicZMMrQjUS5+HR+7XCkVm3oM11MMj6 q68DAmbos+dGrxzsiKPTmLGGfHQqDN7TmvFkbPxWRoJj0JnBvUUGHygBxPGIs8WBHKkd Q/hOlNHkqzGd5ImciUggzb+EIKbEDvCNhShK67eMJ0GTnYf7DrWHteMn5FOJ38uT06dN kPsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DIUV9itN; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-194837-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194837-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 41be03b00d2f7-6bfead2e0b2si325959a12.321.2024.05.29.18.09.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 18:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194837-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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DIUV9itN; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-194837-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194837-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 100FA2859A1 for ; Thu, 30 May 2024 01:09:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04B4FFC19; Thu, 30 May 2024 01:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="DIUV9itN" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 2AD2EE57E for ; Thu, 30 May 2024 01:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717031352; cv=none; b=pjfpaux9XMRFjiZnwekp4ceeyuL6nDL9k353RW7Ex647RCUN8HAz3ZDv+KW863slMMishbD2huZOTiqkcvlo7QrekQBqPWoCm/Nkx9phxfp+g95hv6KlQBwUzCkgInNMWSCYUTRBWcMKS5/5NNpithilh8AKWVrNcmOKP5S4tVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717031352; c=relaxed/simple; bh=r1WLIYqwEcFl1zxpSruq17uincpEIe2QAM/Tkg8t+yY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GKo3J3Gk/quwAw96RZmw24w00QBBKtAAI89ojsFjf6nv5NA0/5oTJALjacKK20IR56tKckql9kd6TZa38FflUQBv093naenvL+oWJoaF6Yc1Q9QSVebM56QKYpXppkZFcBxvYROtRA4CuDbX+YP18G/bvBb/tOASbWHWylpmYVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=DIUV9itN; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a59a352bbd9so47058666b.1 for ; Wed, 29 May 2024 18:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1717031348; x=1717636148; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Pc8AzCw2itqlchY2iNLylrW0HG92I3q/DnK9Zsb7BQY=; b=DIUV9itNhbg8EfKLtpnHuKH1pEUDR/trubtVF2Pcu4Z2lDAl5gF9rVTS+Ts6Kk8+Eq 0PnNYawFbqcd7oo1KeIFL9Mq7uc98o7+69ELep2M+FKQDxUE7PHC0gPRNrOdoflb4CyU dJkWdqUo/ovPZPD+gjAyrYMac6zoBKYhanCvY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717031348; x=1717636148; h=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=Pc8AzCw2itqlchY2iNLylrW0HG92I3q/DnK9Zsb7BQY=; b=KrFGxtPnqAhgDSqQGzF1XPpkNIG8cejKCWDiZ/muRQg08CAqFxdBMYkIbp7dl8urqT NI3RHNbCJnZzqIrbE7d+IMC2BlodFUfJSzi338C+AQG/iPqqn46pkypWm7gJrWuy1rDy SrAfLcy8gvep8Tx11zK3TT3RhVgZbjmx8s4Upz/4e5k9aM3OsRP6RmGBn1RFSXZMNrPV Li4Q1j0ODLM+gRYqCimfEdAhSAcAjcjmt9RYW58DOwdUKWvRQ7CJGY9erXin9Dxy8FtA YLOO8KajP7v2bKrFD8g+YygOWNU6sGM2rIqDMED32Ay9QFJxEmcZLB+prp8q5mIqPD5h Y57A== X-Forwarded-Encrypted: i=1; AJvYcCUfV9d2bwe8178Ek9eJPQQbOrrLlRibBjf0gAtD3EE5I2GlQGMfTUbQ9ZNt6mX9xETVcsxSTZMKRpgiV5+NAoytxyDKtj0SofGUZYt4 X-Gm-Message-State: AOJu0YwL27HUT2AS16Kh8r1ID/RlePIzQ6Icl2JKIIWcaE7NrPr/4WX7 onBMQuMDJwEtO0O/F0eG3uIQmKdf49RaZ3Y843HAWuKSYZhQSx0LFzkBzuhBHp8rFQbdhtssoOR 0cFh8yg== X-Received: by 2002:a17:907:384:b0:a59:ccc3:544 with SMTP id a640c23a62f3a-a65f091103emr30767166b.2.1717031348393; Wed, 29 May 2024 18:09:08 -0700 (PDT) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com. [209.85.208.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8d606sm778026666b.176.2024.05.29.18.09.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 May 2024 18:09:07 -0700 (PDT) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5789733769dso926838a12.1 for ; Wed, 29 May 2024 18:09:07 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVogebV2cjGLs7Ya1tqhtACTnOTsjJHbGhevtEgpM8/P3+hW0B/dHQSUvepvJXolMxHQfV/8pw3H7OeIwO4jp5bmVxAUq8SJEeTQPZ6 X-Received: by 2002:a17:906:cb90:b0:a5c:dce0:9f4e with SMTP id a640c23a62f3a-a65f0bd7b2bmr31381166b.28.1717031346663; Wed, 29 May 2024 18:09:06 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240503081125.67990-1-arnd@kernel.org> <272a909522f2790a30b9a8be73ab7145bf06d486.camel@physik.fu-berlin.de> In-Reply-To: From: Linus Torvalds Date: Wed, 29 May 2024 18:08:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/14] alpha: cleanups for 6.10 To: "Maciej W. Rozycki" Cc: "Paul E. McKenney" , John Paul Adrian Glaubitz , Arnd Bergmann , linux-alpha@vger.kernel.org, Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Alexander Viro , Marc Zyngier , linux-kernel@vger.kernel.org, Michael Cree , Frank Scheiner Content-Type: text/plain; charset="UTF-8" On Wed, 29 May 2024 at 11:50, Maciej W. Rozycki wrote: > > 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 have some bad news for you: the old alpha CPU's not only screwed up the byte/word design, they _also_ screwed up the load-locked/store-conditional. You'd think that LL/SC would be done at a cacheline level, like any sane person would do. But no. The 21064 actually did atomicity with an external pin on the bus, the same way people used to do before caches even existed. Yes, it has an internal L1 D$, but it is a write-through cache, and clearly things like cache coherency weren't designed for. In fact, LL/SC is even documented to not work in the external L2 cache ("Bcache" - don't ask me why the odd naming). So LL/SC on the 21064 literally works on external memory. Quoting the reference manual: "A.6 Load Locked and Store Conditional The 21064 provides the ability to perform locked memory accesses through the LDxL (Load_Locked) and STxC (Store_Conditional) cycle command pair. The LDxL command forces the 21064 to bypass the Bcache and request data directly from the external memory interface. The memory interface logic must set a special interlock flag as it returns the data, and may optionally keep the locked address" End result: a LL/SC pair is very very slow. It was incredibly slow even for the time. I had benchmarks, I can't recall them, but I'd like to say "hundreds of cycles". Maybe thousands. So actual reliable byte operations are not realistically possible on the early alpha CPU's. You can do them with LL/SC, sure, but performance would be so horrendously bad that it would be just sad. The 21064A had some "fast lock" mode which allows the data from the LDQ_L to come from the Bcache. So it still isn't exactly fast, and it still didn't work at CPU core speeds, but at least it worked with the external cache. Compilers will generate the sequence that DEC specified, which isn't thread-safe. In fact, it's worse than "not thread safe". It's not even safe on UP with interrupts, or even signals in user space. It's one of those "technically valid POSIX", since there's "sig_atomic_t" and if you do any concurrent signal stuff you're supposed to only use that type. But it's another of those "Yeah, you'd better make sure your structure members are either 'int' or bigger, or never accessed from signals or interrupts, or they might clobber nearby values". Linus