Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp365523lqp; Mon, 10 Jun 2024 06:39:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtFr/ptKQMhUAqt8nJvU7S2ddQUzmtUsJLuzfVt8IjbYZXomP0qlUeYuzdp3k8AE4qE9IE+Pyxvn24CE86rYudh03AVjpSwLN81Zu19A== X-Google-Smtp-Source: AGHT+IEFmHbLbrqjfre3BkMnSzK0yYJHh6pQHKZoU7QTiyr0Epmma+9zD05mIF8sDGv5LHwlEaab X-Received: by 2002:a17:907:1c05:b0:a68:f28f:34fb with SMTP id a640c23a62f3a-a6cd789193emr739929066b.39.1718026747564; Mon, 10 Jun 2024 06:39:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718026747; cv=pass; d=google.com; s=arc-20160816; b=tAwBCo8A0LxfxEg53sy9r0EtDreH/kfaMu4blzJd/oQ+nonqh+90VyUOyET0a31nJe UKQhadZqcFK9NkD94ZMHOvLVCOore6G4K2itQ++oic+PqL+TmYVSvd/ualpT05Ivp4I8 7HtWgYzwJvU+l6bydqW2hw9oHPQwATlG7yxZETUq85QPJT3wpNCyQs31BjRne3IqPmDT jXMGY/mdFTrNTs4bufe/LBJM/kRtkd+VcWcvMMqwmMfMBKQU9HMTgkIk7anSX9JDjIX+ faE8+vmunpmahr6D65T0pYNfLbnU8IPSOehFXJ+UqkPHcNsOxum0h1+tqaNIr2qZs5CS rT3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6MVOT7ev6J5lLl/iba6yrd0EhvDJDU0eNfpHSBAIuOY=; fh=Kw43BpXJuP7NxVSssNXuypolyXyxof6gz1AxCmrco+M=; b=lETMipQ5bwTpHnyk0SqYeYX3tz6ubsVptyEKTLMXGvIHcWQNdQlYeR03JaETPx3Suy ZyFuK8sNhaZB/jf5Z8KC0CifhNYWVtsObKFumhHhOb7WffEY+t1N5M5HlIqHgDfHDD+X pUyxPUaTD2tfnf3HskagiLGjCvynE+UMRyBKVl+pevWwS8K2G75cxnULNlm5EN08rjgs S5wGy/HbD7r/WKQyFuMrKvWs69Lp3THPBBIpCayLOBShusS5k69YcIjkOMZyNrVup3jG JYjtNbKP93xS6bx3T42F5jiRKHUO3K7zNWh7hDX1YaYyWQxiCb08fV4UUR96kamq5hyK h9NQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YZfXVTZA; arc=pass (i=1 spf=pass spfdomain=rasmusvillemoes.dk dkim=pass dkdomain=rasmusvillemoes.dk); spf=pass (google.com: domain of linux-kernel+bounces-208241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208241-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c68faf76asi2911897a12.615.2024.06.10.06.39.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 06:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YZfXVTZA; arc=pass (i=1 spf=pass spfdomain=rasmusvillemoes.dk dkim=pass dkdomain=rasmusvillemoes.dk); spf=pass (google.com: domain of linux-kernel+bounces-208241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208241-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D8BF71F21D3A for ; Mon, 10 Jun 2024 13:38:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8C288249B; Mon, 10 Jun 2024 13:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="YZfXVTZA" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 5A1974F5FA for ; Mon, 10 Jun 2024 13:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718026719; cv=none; b=hiOEkRelmB0taApplAC+gh7hKd4rFRcfYqe0n1zSYoRcmqNFKQTX8A3hlM7gXqq5cgh5iWWzU+dNaf0JC+vTuacf8gPv/uKwCVGNw0gTwvlUbh75vyP0aHS20Lvxyqv2KAe9eWjdoP0V6uMEhwok6VuEkC4i3XBly+IC6gq9kuI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718026719; c=relaxed/simple; bh=nNiMFN3UUVyLRK8hNS+Knebs+73HcK7zuHQH11+IUf4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AddwhGRmOTpnHiF7CPInXsF+FDRUZVg3ZkpH+UdoVw9go6xEz2wKMZ+AUpIvj0d34afK1fjDekBos3oOZAckBYQak/AOGUxkjg3CmiqGRw9VgK1A41qAO+ghirqyRKM0cwimJ8pDLdQViGwkA4vdjDmfzZ/tlwj0ypD6rX6L6KU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk; spf=pass smtp.mailfrom=rasmusvillemoes.dk; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b=YZfXVTZA; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52c89d6b4adso1062336e87.3 for ; Mon, 10 Jun 2024 06:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; t=1718026716; x=1718631516; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6MVOT7ev6J5lLl/iba6yrd0EhvDJDU0eNfpHSBAIuOY=; b=YZfXVTZAALZBsckulSZUV7g14E6MmT8NndgV0d2sZnmqeHlfdH/7H+gpxNtIH/E1gI GmsnAniYZlJuJZPjObXzgHCDpm2n/97HZQjJAaarmsAHVOoN/iKVTNhyjVoulTRmpCWF X2a8EGWQwyRDxzqkJtEzaeMmgJegKGZeBM5Ys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718026716; x=1718631516; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6MVOT7ev6J5lLl/iba6yrd0EhvDJDU0eNfpHSBAIuOY=; b=c6ARL7Ep5KjD3YG2gpKSBd13HhbXl9gdSTVXViqz4THNTXmpwiNxqb6NCfukNiTeEq 2de6eP3XnuPwBDwZBHxvYsYFheKsLQ3GeHeNQN/hfm0GSgnV5koo+hZMQPM7lDQ94YjT 2T7k4NKCCrDi0I0QN/4muwnSAitFvvJw2vMl1v7ecoyjdg4o/RW/0e1VZIjicCftMOnv cvZljTdo4yz0ChnRX2bz5ISf1uzyzo5lSjFiacS1658FhX6n8mY2AnTO2/Uc5JxcPwUU UaOaYF+950BSm+ES4HZGqzIzy7sG8Nnz4XfVf+zsG4GQHixOQwKfHNsePA5zJ61vnNPb OU3A== X-Forwarded-Encrypted: i=1; AJvYcCU3wO8qJxG/UzsF25IP3XmqSf9HCgDFNCnjFR2X5W1+yHgUu/7wALynHMRYZdlPHXlT7J5v7Z35w3GuhiJNlMC/d4vv0we8GbXMc7sZ X-Gm-Message-State: AOJu0Ywr62iII6zkKNxkS8dtbR3iO8muhYabKNLdnSLgnAELAxZPZFKd kL9rZQv6NikgWt2K7Cz9Klh9FvbCGgmoiKMVJIx+1L4sWz2gFtEZwxH8WBgzWZ8= X-Received: by 2002:a19:641a:0:b0:52b:797d:efd4 with SMTP id 2adb3069b0e04-52bb9f6deafmr5369729e87.16.1718026716105; Mon, 10 Jun 2024 06:38:36 -0700 (PDT) Received: from [172.16.11.116] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52bb41e1bd6sm1668882e87.48.2024.06.10.06.38.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 06:38:35 -0700 (PDT) Message-ID: Date: Mon, 10 Jun 2024 15:38:34 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86: add 'runtime constant' infrastructure To: Peter Zijlstra , Linus Torvalds Cc: Peter Anvin , Ingo Molnar , Borislav Petkov , Thomas Gleixner , Josh Poimboeuf , Linux Kernel Mailing List , the arch/x86 maintainers , linux-arch References: <20240608193504.429644-2-torvalds@linux-foundation.org> <20240610104352.GT8774@noisy.programming.kicks-ass.net> Content-Language: en-US, da From: Rasmus Villemoes In-Reply-To: <20240610104352.GT8774@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/06/2024 12.43, Peter Zijlstra wrote: > On Sat, Jun 08, 2024 at 12:35:05PM -0700, Linus Torvalds wrote: >> Comments? > > It obviously has the constraint of never running the code before the > corresponding runtime_const_init() has been done, otherwise things will > go sideways in a hurry, but this also makes the whole thing a *lot* > simpler. > > The only thing I'm not sure about is it having a section per symbol, > given how jump_label and static_call took off, this might not be > scalable. > > Yes, the approach is super simple and straight forward, but imagine > there being like a 100 symbols soon :/ > > The below hackery -- it very much needs cleanup and is only compiled on > x86_64 and does not support modules, boots for me. As can be seen in my other reply, yes, I'm also worried about the scalability and would like to see this applied to more stuff. But if we do this, surely that's what scripts/sorttable is for, right? Alternatively, if we just keep emitting to per-symbol __runtime_const_##sym sections but collect them in one __runtime_const, just using __runtime_const { *(SORT_BY_NAME(__runtime_const_*)) } in the linker script should already be enough to allow that binary search to work (with whatever : AT(ADDR() ... ) magic is also required), with no post-processing at build or runtime required. Rasmus