Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp648502lqt; Thu, 6 Jun 2024 14:11:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXK26jVpeEslpDg2eNu8yRumg6NzYHS5ioE+uoplfktQCLD6Qm8b1tCSPsBOwN1eJiWKW1nf2CRq/xqJgo5MOl9k/nXGyZY1jaCByQ7KQ== X-Google-Smtp-Source: AGHT+IEdk6h58CSHXLagheRIBS3fpqQDT+pX8sAyg16TgNKSAxK2VHT7sd/sxpOs2Y9GncoZliOK X-Received: by 2002:a05:6e02:1a69:b0:374:a5f0:d580 with SMTP id e9e14a558f8ab-37580309953mr11158945ab.5.1717708268055; Thu, 06 Jun 2024 14:11:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717708268; cv=pass; d=google.com; s=arc-20160816; b=rpYOIVRpHCyTGiyY4XkChKIO1f/lglH0OyRuKZCXKO/WFArKf0oFsoJyUUG5wIBGbh inFd08TFbPcVxfDbrbjNOXRkKUOoUZpQHpfn1rHbFCIHIL8EEYhNZHl+BPJ2c+qhz339 Wbcjjkcq6T1rcw5PDKHB75Rlt3GagYVskXgaoCC7PQjNEbKAEi4lvt3JH5VrlwsPlJB3 WrslkSUkk4FF7+d8Qb36VQRYxLpTyG6ONwP82dZjBbkZYnHjWpNhC9ir3zuckNuHO23c V0QDAstnpm9R6XzG0B8W07U6zGDbC4JyhVepw1il3Ze11d9xzjfvgj23zwhYkACo3Dqg 28Gg== 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=8TjgBjt57C936onmGqCK9GXQjMks7PTUKgl/Z6/JtaU=; fh=si72vENd47ksWDBGDGei6aeDR1Zy32dNCHN4L6jN4mI=; b=Kxq9XJEVyqjGjCfyl7WXkL1mYCCXINDPKaUjBY8pBGbkXY8bCpDtHIf9Zu+OI5o8Ka rBn6LJO9tRfG4pi0FeeuJ77HdEAF4HiO6IDJXRo3nr8Ghul4NilS46ALEcdPwNWNcXap xD77PTT2AHlLkZoj9V5J80R6A+gujxdaTTlGFrlc17MHqyi5fQbenh4/D6NvxgNg/iC4 0TL6t3i3sHJjkUycYXJ/sTDoB1bor2W58S6l/hA6b/TFzj2qI1hGXOsgMo4YgibmZ23U 3sGxg70kr+eFtgRRLSH0ePhmss0B+xtZfaWLQnGnpxznzT462m15h5NSDeq6bFoi23FZ VP8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Qleoegue; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-205034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205034-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-6de8ca50b52si1521016a12.484.2024.06.06.14.11.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 14:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205034-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=Qleoegue; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-205034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205034-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 B54392863CE for ; Thu, 6 Jun 2024 21:11:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9BF8197A68; Thu, 6 Jun 2024 21:10:53 +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="Qleoegue" Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 4C65F196449 for ; Thu, 6 Jun 2024 21:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717708252; cv=none; b=qtQ25CVq0Lpbb7peCXhe+FBGoTjJM11sDZumcNUJeztuknkcgzlJeWgBA8C348o3l6Ye0ZTKRSiglKokPFvSh/5eq5X6isUkJ8Sx3hvX0j0gzpLqiXnU3j4LhQuoR7WkeXBMnm8Who/V9zeo5WlQL+Y+xnfUvwoEqI5cavQ2UUc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717708252; c=relaxed/simple; bh=AUHnthjxhvSfZt1T5NTkzWwZswiKcMJtW7KrT1ABp7Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XIpKXfHheks3RCBOhCemAlilxoDch3ZTyFPxmBnMnEr4zNGa4nmmcIOa3CieKcKOBcMhj3Tl9KaSpvKadOL2bLfHvR3LRm4m6h3zGYXcMOZdobUhlEAHdwbHfhaEDOaiYuzIqPxAHdbLgh9Ou14zX+XManLAIfiszUZRXEWkKOI= 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=Qleoegue; arc=none smtp.client-ip=209.85.208.174 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-lj1-f174.google.com with SMTP id 38308e7fff4ca-2eadaac1d28so8541241fa.3 for ; Thu, 06 Jun 2024 14:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1717708248; x=1718313048; 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=8TjgBjt57C936onmGqCK9GXQjMks7PTUKgl/Z6/JtaU=; b=QleoegueDBMmbfgGAKMJE3mOmI25sjdOU0wZAUndzcyXNd75pblKCoD36zYwtEQRDQ R+rKJ5pKcuedBsC5fiyne7iq/a12dEpOLZTvpvEtvPIU2XgRwDg2Sfagwc7Hc6RzFd2F QovBS+vIknSfwpYkev1Kbfnuty6enkm/ICL/s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717708248; x=1718313048; 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=8TjgBjt57C936onmGqCK9GXQjMks7PTUKgl/Z6/JtaU=; b=RTwZGS0/5iCl9TXvi8Oar2ZLpXEel/d5VcFH0pn8SXCkoMVbabuBqtuuac57kp8S40 1lJuVmXZBIHJGpq4z03Z0XrAqx/4KM7G0ArcJwtiAuNRzuGuIg4GTHYwUghan5+cYNWT m3kBlSmieITC4uSnXotk0qObHUeNeb56UWE4+iCxqBl5pq3e02GoVQBXIV75iSbnUorb 7uX/Df8ZvPcjNlh5HjDKo4lYy3rDhpwwjGoivDc41XvSKoaqqYvpnuA+YGjWz5PjTXaV Go0/4/j7ASgSjXBFisi+2Oc+eEkpooXSUtNnWQ8CATn/nkR9qFSKw2nEGF7t5EfCvxr5 dJZA== X-Forwarded-Encrypted: i=1; AJvYcCXHfl8uVnA71UZYxK6WgsQtPwqjOX4WP0dX6kkGHHVpL9CTDrtTF8jU1W1tlAVbFUOf7asfVFV1oJ+L14/0RO0rRRqDMJJT/qpTy8Ep X-Gm-Message-State: AOJu0YwUCo3bMLz9D/F3tXq5Wz5Fcq1b0agvkp//Y/M2oZ5ZibusTrNh gxENUKwDQiC3iSV1fl+n9tSLc4aOQyVWacXKO8s6Yc+tbXNd6mjBaE9PuJH9s7/sleTMCBaEcoT w X-Received: by 2002:a2e:351a:0:b0:2ea:c0ad:f974 with SMTP id 38308e7fff4ca-2eadce78587mr5599251fa.36.1717708248088; Thu, 06 Jun 2024 14:10:48 -0700 (PDT) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com. [209.85.208.44]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae0ca5e3sm1660224a12.25.2024.06.06.14.10.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jun 2024 14:10:47 -0700 (PDT) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-57a31d63b6bso1984141a12.0 for ; Thu, 06 Jun 2024 14:10:47 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXl/ixrIP3sT+zjNccb0eskjy+mUkQIV0lrO5mztHOg1yp6SH+DdBbg9vSAFCgkcvxB8ZZ6sNf/Nw1NJcA3aOghUOY4U5/LgC7xlnq9 X-Received: by 2002:a17:906:26d8:b0:a68:f43f:6f31 with SMTP id a640c23a62f3a-a6cdc0e40e4mr47636166b.64.1717708247141; Thu, 06 Jun 2024 14:10:47 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240606194525.cdnnidxurejsjtx4@treble> In-Reply-To: <20240606194525.cdnnidxurejsjtx4@treble> From: Linus Torvalds Date: Thu, 6 Jun 2024 14:10:30 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: objtool query: section start/end symbols? To: Josh Poimboeuf Cc: Peter Zijlstra , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" On Thu, 6 Jun 2024 at 12:45, Josh Poimboeuf wrote: > > That should be trivial. But ideally the interface would be less magical > and wouldn't need objtool to sprinkle any pixie dust. Could it be > implemented similar to static keys by making the static const variable > an opaque structure instead of just a "normal" variable? So I will absolutely add some wrappers - we'll need them just to make the "no static constants" case work. I doubt I'll need any more than a simple wrapper, because there is no equivalent of a trampoline when it comes to static constants - the whole point is avoiding any indirection at all, and generating better code. So the only "wrapper" needed is the "different architectures will have to have different ways to generate the runtime constant operations" and the "with no support, it will just use the variable as before". But the data itself is fundamentally embedded in the inline asm that generates the constant op (note that I say "op" - it's not just loading a constant, it's using a constant as *part* of the instruction). IOW, think of this more as an "alternative asm", where the alternative is about the constants used in order to avoid memory loads and extra registers. I did name it after the "static call" model, but it's actually pretty different. For example, if we ever extend this to modules, then any constants will be fixed up by the module loader. There will not ever be any dynamic rewriting like static calls support. This would be for some very core constants only. Not random code that wants to avoid an indirect call. My code did the dentry hash table and size, but I would envision it would be for pseudo-constants like __VIRTUAL_MASK_SHIFT etc (which _used_ to be a big pain for put_user() and friends, but we solved it with a different model). Things that depend purely on boot time stuff. > DEFINE_STATIC_CONST(dentry_hashtable); > > That could create something similar to 'struct static_key' which > correlates the const variable with all its use sites. Oh, honestly, I don't need the disgusting things that static_calls() do. The patch I already have is better than that. IOW, already have the list of where the static call data is (the thing that the .static_call_sites section contains). Sure, it's not a "single" array of sites, because my sections are partitioned by size (the static calls use a flag value instead), and my "key" for the array traversal is just the address of the runtime constant that they deal with. It all works fine, although it will need some abstraction to deal with different architectures. I'm not at all interested in creating some fancy linked list of those things like static calls do in __static_call_init() at runtime., This is literally for a one-time constant for built-in code, I think the static call code is completely over-designed and inappropriate for this. So what I'm interested in would be to simplify things, and get rid of the "key" entirely, because with a good symbol for the start and end of the array of users (for _each_ pseudo-constant symbol), it all makes the code a lot more straightforward. In particular, it would make the architecture side much more straightforward, because instead of traversing some "array of keys and types" and pick up the ones that match, it would just traverse an array that is already pre-matched, because each key goes into its own section. So I want to *simplify* the code, not make it the horrendous complicated mess that is static calls. No "build up that list of sites" at run-time. Now, I actually suspect that doing this thing would then allow *other* cases - like possibly static calls - to simplify their code too. I think the static calls could easily use this to simplify the code. So I would throw your question back at you and say "No! I'm asking for this support because it would allow me to *not* do even a simplified version of the horrible things that static calls do". Linus