Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp328776lqp; Sat, 8 Jun 2024 20:12:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGYNNuiz2vAVb3NUgpy+tVygIQjdsetYDH17sOhqjOgEcezlrEUIRfVekCyIBXKtIY8GH9mAqqk84OyOaGSHzpona+WjTwUmyiyX71Iw== X-Google-Smtp-Source: AGHT+IHjhHokD7RXJB8WOfiMRf51eM3cT4Al3VQQNmzyM7R6XwxoG7QBE4sMf0K99VxOnaNnBFz2 X-Received: by 2002:a05:6359:4590:b0:19f:3a23:8a1 with SMTP id e5c5f4694b2df-19f3a230c12mr416097155d.20.1717902729556; Sat, 08 Jun 2024 20:12:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717902729; cv=pass; d=google.com; s=arc-20160816; b=O/T/exeMGaArRnjxm7hQOAqlyIUPGT6UvYH3hW2DIo2fU4xSPwneAu085AKXgg277e TzaSNnFYLAc35nQTdVgGa906hdaCJzFBt9gGEVIIJGpWY04Cqh0MJSTfXGBCO9KJBuj5 qxNpd2jMBPQUz9FB5J9Y5P+VTA3kxMGpGcattqXt5FNt3LXBaIdBg32jiyBk15snR0r3 +VRp4U+bE3GSrU7wm25BOK4WNVwAAkezLpGEa5L8VPcC5AaZxJALk9rWK9rC8oyKyp/Y YoPOuBCBwcVRxaFmqJ9uDRu19Ql561WS9r7PUCJwd7ZbyneE/GZ+H6pSZDfBN9ELtymC 3ppg== 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=A7dUoCR65nMgbX7LmvgfZWZMvg21MHj7Khg3DNyY50c=; fh=vJGOYGd8DOMGKLNdyWvDGzKVJcq+H1WB8+TXzO9QZ18=; b=Xq0xRvyFtKJQffChzBiw16VvqyFjY8TJR6X4S+sFMp2FNLK5ijXo0GuWRL6rI8FCR5 14hiMbAFate+WjN4MRDjLjfdjN7dmCMOPdfPw98W1dgal4SKkjb4qRDCpjYLS8MNjFk+ BrLZBIsdm9ZoWRo+WcUF936xqfokTGTeQJOPjMhL7SunwkvYqFZbWLNBtezfXPPulFUD NQOL0pHb15tyY72tguxd84o4idld7qbdW++HAVeCRRPZvYrALKR+S4j7Ltx1Pfkswwfd QuArBNOKCNBLafNn6cRQ+l0MzeRwmND284C1SUe2dvOMSRbO30+JNniYUZLsUGJx+qYF 68qg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SIHebmCA; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-207243-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207243-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f70926fc98si3254155ad.458.2024.06.08.20.12.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 20:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207243-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SIHebmCA; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-207243-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207243-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8380EB213B9 for ; Sun, 9 Jun 2024 03:12:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCAA0C138; Sun, 9 Jun 2024 03:11:56 +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="SIHebmCA" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 69FC36139 for ; Sun, 9 Jun 2024 03:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717902715; cv=none; b=bzB8eWd7he31e9TplK9hFCph+5yjgmtdxgteALq06b7uRrgPBYeMR3qv6EVHuzEXLoOsWEBnRdpgbBq06KTZVs3E0wCpQvNqL6MN7ilJlBBQEyvoDIqkgXvac1URAvYSLtYQZ/RjovhRGd4h4T5NhbRRCfnh8Ii/kJ6J1YPgpJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717902715; c=relaxed/simple; bh=Ro+ub4ifFKSZnb+ejWJ/xsVvSkhd//wMcVYHKFO+dzM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SEvt3V+Mbw8MyKS1bPQOtr8EobOMWWExSjNPTlaCdtDqo3bz0FfCqdCENO5OeaOReQ+EdEjXUTj3X1N0xyFzjPTla9Y0k+uNFGwscHb085OyZLQ+KKafhut+Jm/l7Ktfk3ZZ3sEYyIuWKBVXuKnQOyO4dfLCuNZsSG+LCqI+Bhk= 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=SIHebmCA; arc=none smtp.client-ip=209.85.167.46 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-lf1-f46.google.com with SMTP id 2adb3069b0e04-52962423ed8so3945428e87.2 for ; Sat, 08 Jun 2024 20:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1717902711; x=1718507511; 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=A7dUoCR65nMgbX7LmvgfZWZMvg21MHj7Khg3DNyY50c=; b=SIHebmCAAjHeKOmVHFnO0nUH0PHiJuJyZbym03QbwX5JYwryUZEVAuxrmfaD2w6SUH wDi3ocoR0RGcVCFiLPeSwC/7CjS2fdnEEpDwVffhACpIEYL2/EiRAdgrtKeSYwDwWUHo NPSUtvvt7rNzOXCkKNrQQsP1gZFqinTiKVQk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717902711; x=1718507511; 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=A7dUoCR65nMgbX7LmvgfZWZMvg21MHj7Khg3DNyY50c=; b=ukldvfQrrZ7dbbZ4JWtY7D1V4ZI7br0Nn3ZPG5b2zW2RFDv60IYtHyUg1FYiXchaTM xHxc0E0k5kwJU2qaeydnHhRUa7pZvz1pm/+42uGWpwPjQDtXR3jCxqmc6d6EUrLmIQ9g 608pXKCFEA4CR7tEUJ2Xe/CFMj+L1tghX1Li/T2U+wwkl6v2TzOLfIfZB2oYbQggk5iq hGxdqyP940WQAW5B+Pgp72zT6rF5f3tQrJbPxr2IaZmHxmbhefrWwIldoXy04N6HoWiu o9vQODSFb9bt0SPfNxKByaGt5nGntbFN9b61o77f/83mNHRzgjxLqC49LBStT2KMZZ4Y QnNw== X-Gm-Message-State: AOJu0Yzx2BndqPk4jMbKSzY71mbOX7uHwo6zaA0JbcTydFjdIq6LyF0W 4NGPE0dLUs0V8EUnSSsGLZqhS4RoEBNSAdkJSn9Fm6n2W5+cC8UpaMUOMGKpk7SsJ4Wrk+aE7Rj 3ER0= X-Received: by 2002:a05:6512:130b:b0:52b:bf8f:5690 with SMTP id 2adb3069b0e04-52bbf8f5813mr4266921e87.52.1717902711308; Sat, 08 Jun 2024 20:11:51 -0700 (PDT) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com. [209.85.208.50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f102c4494sm105029266b.112.2024.06.08.20.11.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Jun 2024 20:11:50 -0700 (PDT) Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-57c76497cefso267023a12.1 for ; Sat, 08 Jun 2024 20:11:50 -0700 (PDT) X-Received: by 2002:a17:906:f858:b0:a6e:f869:dfcd with SMTP id a640c23a62f3a-a6ef869e146mr209955566b.6.1717902709744; Sat, 08 Jun 2024 20:11:49 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240608193504.429644-2-torvalds@linux-foundation.org> In-Reply-To: From: Linus Torvalds Date: Sat, 8 Jun 2024 20:11:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86: add 'runtime constant' infrastructure To: Catalin Marinas , Will Deacon Cc: Linux Kernel Mailing List , linux-arch , Linux ARM Content-Type: multipart/mixed; boundary="000000000000c61ba5061a6c64c4" --000000000000c61ba5061a6c64c4 Content-Type: text/plain; charset="UTF-8" On Sat, 8 Jun 2024 at 13:55, Linus Torvalds wrote: > > Think of this patch mostly as a "look, adding another architecture > isn't *that* hard - even if the constant value is spread out in the > instructions". .. and here's a version that actually works. It wasn't that bad. Or rather, it wouldn't have been that bad had I not spent *ages* debugging a stupid cut-and-paste error where I instead of writing words 0..3 of the 64-bit large constant generation, wrote words 0..2 and then overwrote word 2 (again) with the data that should have gone into word 3. Causing the top 32 bits to be all wonky. Oops. Literally. That stupid typo caused like two hours of wasted time. But anyway, this patch actually works for me. It still doesn't do any I$/D$ flushing, because it's not needed in practice, but it *should* probably do that. Linus --000000000000c61ba5061a6c64c4 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-arm64-add-runtime-const-support.patch" Content-Disposition: attachment; filename="0001-arm64-add-runtime-const-support.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lx6yvkv70 RnJvbSA4ODc4MjFlMWNmMzJjNTA1ZDJiYzlmYjlkY2VlNDVjZjFlMmY2NWU1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFNhdCwgOCBKdW4gMjAyNCAxMzoyMjozMSAtMDcwMApTdWJqZWN0OiBb UEFUQ0hdIGFybTY0OiBhZGQgJ3J1bnRpbWUgY29uc3QnIHN1cHBvcnQKClNpZ25lZC1vZmYtYnk6 IExpbnVzIFRvcnZhbGRzIDx0b3J2YWxkc0BsaW51eC1mb3VuZGF0aW9uLm9yZz4KLS0tCiBhcmNo L2FybTY0L2luY2x1ZGUvYXNtL3J1bnRpbWUtY29uc3QuaCB8IDc1ICsrKysrKysrKysrKysrKysr KysrKysrKysrCiBhcmNoL2FybTY0L2tlcm5lbC92bWxpbnV4Lmxkcy5TICAgICAgICB8ICAz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