Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp45646lqp; Mon, 10 Jun 2024 17:51:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWARBzyYp7BIHVCqOpqc1AwLd93EfIfkGDbtqd64+zs7HsL9hKTbNaxp92tusqYml4NWjPuBQru0/ifLzhLq4Ta0BCYbMRjwKLVaphOmw== X-Google-Smtp-Source: AGHT+IGTGAmg3hAqJrkGpixooyGniJE8z/PVieAgjn4uwYTE5nb8r5RxvraKLOSrh/0CG1LTR4Zn X-Received: by 2002:a05:6808:1786:b0:3d2:2b43:1808 with SMTP id 5614622812f47-3d22b431bc5mr3919223b6e.55.1718067069378; Mon, 10 Jun 2024 17:51:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718067069; cv=pass; d=google.com; s=arc-20160816; b=UT0jJUL41J29zv+nG9NmGOEsMZU9WIzqTBmyTgfey5zIK/0WpZhbTHYQItY/TOP2nN 2O1H/bLYYk03pdwaKIVoISfr1l1hLxP9TFyc3z8wXEDjDUjTIFHA7gBYxdJalSjRJC5o +fkkohBL28Zoe77QWjd6NfdmSK0pU6Hc7lYbcTYqc7IGsIqDOAfLZtnuDXHdyAfargqW SsLGogEZd1cpVEsahxHbSdCuGBlz1xTvTkvw1jl/jrRdEYIWTEE9wStxR9uihGdI2iUp rHFhfxVbMmlU7m1Bv7ClhbTsf/RgFGwDSEs+kpEDrKa5E3FxSj+BroyMJUE+QF6pH4uE 8Mzg== 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=WEyzkTSmfTg9rMLE5THHkOuiUGT58uE3ZSUkLeaSyYQ=; fh=rmIcZDyVAT+nlBijb9No+hRSD8CCK+R9yv3pBLO9wx0=; b=jrDnOHFtjrOb/tBRnmYzLV1XK5/R7oKLJ2xqKeFSCZxPvK2nWeB6T9udSxIwkF8IsY nWv14cdTmDFiOQhlVa0SdBZED3gG3FApKYGQrh2HvOuMFpaGGvvWyY+buC5n0TXqzY1Q zZMrwW5kYFGJ1NMe0XTaIOIeTZl0ari6458BL+QUZ2wJGkf+/EvlTkLrTXV9WkgYfIQp 6pt1G45+/VbEhnXIHL9Aj/qmZUFTia3VrkkyTs8mywtSUf6Ep6yJdZnQSQcKLe3QXaBL kTZTKZamLbl/X/5BRUJnJNmYJ/7gx6FVIiPnRwSplV3ABn1YeO7DPsl0HnmtC/BWA5EA Kkaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NB6h105A; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209136-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 41be03b00d2f7-6e338d5a9d4si5500456a12.206.2024.06.10.17.51.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 17:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209136-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=NB6h105A; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209136-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 B8E6EB22670 for ; Tue, 11 Jun 2024 00:51:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9FB3B66F; Tue, 11 Jun 2024 00:50: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="NB6h105A" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 F33EBAD2C for ; Tue, 11 Jun 2024 00:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718067055; cv=none; b=JuAlfjQMbjsmNRpJk9zRkGmoQ10q7EUI8fJ8s4ou2pIsrak88hIjC+HTteHdhzPfJzAkb7aHAQrF5GOaQrZFR3hgKILsYwR/J7nkt0v0FRA263SyRWrKxjE9PX3ftvceUhg/n++E+6KWCRPE4zInWRDaaENgObw5KwK599srDkE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718067055; c=relaxed/simple; bh=xW/JsFrvvdxfv6EVqr7rZU4s6vm7IMnNTV0x4eaBiKA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=DfnJvbau/SgCYLrq6gBIyNJb5XKRTYqmCPLE/rWHnMcM2wglN01F3Tcv8SY8wjbfnUqJNw/OEmQ0clDV5dfl+ztwds1Ax6Xr3vhNG5IwUXvQTrK0JyJpFwNauImVO/iY+InT7xTZnClO0XN/2jdhjqroVsaEXIY9oidIHhxSJos= 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=NB6h105A; arc=none smtp.client-ip=209.85.218.45 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-f45.google.com with SMTP id a640c23a62f3a-a6f1dc06298so56247066b.1 for ; Mon, 10 Jun 2024 17:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1718067052; x=1718671852; 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=WEyzkTSmfTg9rMLE5THHkOuiUGT58uE3ZSUkLeaSyYQ=; b=NB6h105A2N/KNIIlkJJVfOirnWOPxQQ+9PirqH3T+3/1esYzkyUnrMyS8fGQCahNP6 vHblRl+p+81xseSoD3Lf6gh1R5b6Rj0+p43C7BRuixY+L5dj1o5XibD1RrTqLs7UjhMH dV9wSUjGSJjhg4uhc/yNmLgc/u8FsOOQ38Zvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718067052; x=1718671852; 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=WEyzkTSmfTg9rMLE5THHkOuiUGT58uE3ZSUkLeaSyYQ=; b=CbEoxHKNPPuxQ+63+ANdQoatdLYucvW4onEDcf0/Tte1JXGkEb408hmrTkOk7zQXOa HfP93byK9BzmdZSaYwYs80fcM9UO7a8U5cubR35K3NUNsDvjDFEfuKf0bOuGyOXFDzMh 7ryf8nfraEzUHJpAGspdOYuAKbTtzwfaqfQh+pXE2y1UDJpfZ42EFePd7n6X2CwEq3YY dOuz6UQlUBPv1YaS1Z9T3KzIKjYVJdxJ3ZWitfoF4jRN3gYpkhPNy6mGw1d8Ygg3tC6o DtPV/oX3TtrctqV4UpMXkzqmz4u/GuzBFM1wrrm/L/LxIz6XYjv0Q3aAZg22L8cZhb3O zxpg== X-Forwarded-Encrypted: i=1; AJvYcCW4ZyfhUBCTNnVyxLN8J/3cYgwUwLwIdybzvKpeDYri68q/gLxTa+/odrmOea41FkaeIOnQPEZqYDo4hKu1FheYhb7+DPFUj1rYUO4+ X-Gm-Message-State: AOJu0YzL/4tkGs2lyZkM1+NE7P9HKGZLgBcqSUaaW68+5JevQhsW7U5h PNgdbcqdfwy+tC3O4Ecl4tlooYFJb9IFsqKUSEr6VGmopexEWWxPkOZZUi9dtGB0RsWHegsRGxS f+RY= X-Received: by 2002:a17:907:2d89:b0:a6f:d1d:75f4 with SMTP id a640c23a62f3a-a6f0d1d76b4mr478760366b.55.1718067052084; Mon, 10 Jun 2024 17:50:52 -0700 (PDT) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com. [209.85.218.42]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6effd5bfc8sm393809866b.2.2024.06.10.17.50.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 17:50:48 -0700 (PDT) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a6f0dc80ab9so56844966b.2 for ; Mon, 10 Jun 2024 17:50:48 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVaOxN9CQwGJ7PsYX9TjAqtK7gD/MWSqDyTPAJdaIj3XU9fFlsYHLye4EKRH1yM7OnbQoR7iPdGa46ABIrf0bFo/nZR+CgSkPAZx6u/ X-Received: by 2002:a17:906:17c3:b0:a6f:2b19:e82f with SMTP id a640c23a62f3a-a6f2b19e99dmr137168366b.28.1718067047933; Mon, 10 Jun 2024 17:50:47 -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> <20240610104352.GT8774@noisy.programming.kicks-ass.net> <20240610120201.GAZmbrOYmcA21kD8NB@fat_crate.local> <71FE7A14-62F6-45D3-9BC4-BE09E06F7863@zytor.com> In-Reply-To: <71FE7A14-62F6-45D3-9BC4-BE09E06F7863@zytor.com> From: Linus Torvalds Date: Mon, 10 Jun 2024 17:50:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86: add 'runtime constant' infrastructure To: "H. Peter Anvin" Cc: Borislav Petkov , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Rasmus Villemoes , Josh Poimboeuf , Linux Kernel Mailing List , "the arch/x86 maintainers" , linux-arch Content-Type: text/plain; charset="UTF-8" On Mon, 10 Jun 2024 at 16:35, H. Peter Anvin wrote: > > ... which can be compacted down to a single instruction: > > addq $bimm,%rax We'll burn that bridge when we get to it. I'm not actually seeing any obvious for 32-bit immediates, except as part of some actual operation sequence (ie you might have a similar hash lookup to the d_hash() one, except using a mask rather than a shift). When would you ever add a constant, except when that constant is an address? And those kinds of runtime constant addresses would always be the full 64-bit - I don't think 32-bit is interesting enough to spend any effort on. (Yes, you can get 32-bit rip-address constants if you start doing things like conditional link addresses, but that's what things like static_call() is for - not this runtime constant code) Linus