From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (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 150C539E182 for ; Thu, 9 Apr 2026 23:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775775990; cv=none; b=UdYelRDnMaNscj+sV/4pbmoMfSLw/zvAfgYon+WvJ4uqpABv7B/UIRpis6NAAI769flmUhsx8MQBxmUknfCWN9Qf9UpCotTQCnadmPtrl3tzlip2cJJtjUQ/UI/dySmqv7a6UO31pxhzE/b6m9lY/Gw5avnB3NpW45f2osSgnI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775775990; c=relaxed/simple; bh=DB/JCvQuzg0uvlhXm+oz0eVsqbSIkaRHhQAFtbMAapE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BIKwytE/JOzx5Ln/CQqu4tSs/AbOs/4ixc/q4/xY7QV0HTICw/G5vy+5vUTe6IjLFggLDtQ5KdJWjhq7rS4vLGGnAfx4yKIZq5hGyCAF318z4oENVC/dkeF4zL6W/tsqcRfmjLv4O8EjXAippD7rbXN3aAhb88wGsT4B8lfxSxA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZpCouREx; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZpCouREx" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-1276e71652fso2071172c88.0 for ; Thu, 09 Apr 2026 16:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775775988; x=1776380788; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KxVDh2eRaCzt/S7N8luyaTOnSvmjRTK+RZcJFsYtPbA=; b=ZpCouRExS2OCZoV2uDXMJtsUjeHV1yK1L3xP6Xz5GqYeWznF/ae5sbkUT0NEjZiJVR HKm2wsTcVPjR9rzfHypOpcJr6/EUfZZVDpf3KPOMx7HikKRGJEx3lfCfDuC5szAs5+h7 iXWg/jtGH7MVKoO1OLJL3w1mYBhFm+GTts9kX/TIM/xtHq1m4NXtWH+veNvu7/RzEAI9 tvfbGwunZCA+a8XeescJ2AlNRdovYiXpgkpgMgH9YmnCfOyKrBN5d/ZHbcFvcaZgt6yL 6qKmUlvPx6weOHZ6RiXeHiN+0lY3MNRzh29chTUOKVZnj6knqXQuJ6cfc26KxGI3FRSq enTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775775988; x=1776380788; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KxVDh2eRaCzt/S7N8luyaTOnSvmjRTK+RZcJFsYtPbA=; b=dTrsvOxSiYc79pphAzRcFRAoJTFbJ4677kah71WnCytOCfRknVK+FRgwxcdQbZNYct WK3fVowj5r2p9I35C/J/+M/HEYjQt56QLaGnhXkoJzuKpkRlp2loD4C0rmzRaoT933yI L9hrF5mG8cVd+9ANA5n7Ben1HfasYpJp9l71Rk+1vLaj3VPxv2+icUdQgZZ6IgtrbkKd LWk3GBEjasDMMyu4Bs6u1e6NHAI82KRkBWq11o8RkpB1+Gc0bGvpCkpRNWgIl0agPuh8 V0SnMsuq2CzoSaaYpOsoWkCCSVou5OZjDzr13IHxRrHHno17TSMw2OckmI1UAccPnISk /baQ== X-Forwarded-Encrypted: i=1; AJvYcCUi6UYmTbD3EoeAsW5XoFdNu7MuEOx7ngO7lWiptolt4FrM/WthBCA/8mGqy9Ia06JrYlGT5IxDMfl/yg0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3PAO+8e4Lud27eOAxs8gaI2IFXyvrjmmyZPSaXhywZt9aDrV3 aXINJxx56fs1IOg/A33pfeVJFS5jyf0zMbLhSVSOXemX2AulMTroi+daRmQ8lDqVc9wg0gNIyLv 8fW8hiXKVrw== X-Received: from dlbrh20.prod.google.com ([2002:a05:7022:f314:b0:12a:c608:a29b]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:4a2:b0:127:9ece:c47a with SMTP id a92af1059eb24-12c34f160e8mr452729c88.36.1775775987959; Thu, 09 Apr 2026 16:06:27 -0700 (PDT) Date: Thu, 9 Apr 2026 16:06:17 -0700 In-Reply-To: <20260406170905.2614260-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260406170905.2614260-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260409230620.4176210-1-irogers@google.com> Subject: [PATCH v6 0/3] perf symbol/env: ELF machine clean up and lazy idle computation From: Ian Rogers To: namhyung@kernel.org Cc: irogers@google.com, acme@kernel.org, agordeev@linux.ibm.com, gor@linux.ibm.com, hca@linux.ibm.com, jameshongleiwang@126.com, japo@linux.ibm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-s390@vger.kernel.org, sumanthk@linux.ibm.com, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Add a helper to perf_env to compute the e_machine if it is EM_NONE. Derive the value from the arch string if available. Similarly derive the arch string from the ELF machine if available, for consistency. This means perf's arch (machine type) is no longer determined by uname but set to match that of the perf ELF executable. Switch the idle computation to the point of use and lazily compute it, rather than computing it for every symbol. The current only user is `perf top`. At the point of use the perf_env is available and this can be used to make sure the idle function computation is machine and kernel version dependent. v6: Ensure arch is canonical by going to e_machine and back (Sashiko) v5: Add perf_env os_release helper (Namhyung/Sashiko) https://lore.kernel.org/lkml/20260406170905.2614260-1-irogers@google.com/ v4: Fix Sashiko issues where an array element wasn't sorted properly, the e_flags weren't returned properly, the idle type is change to a u8 rather than an enum value and the s390 version check for psw_idle is slightly reordered and tweaked. https://lore.kernel.org/lkml/20260327045025.2276517-1-irogers@google.com/ v3: Properly set up the e_machine coming from the perf_env as reported by Honglei Wang. https://lore.kernel.org/lkml/20260326174521.1829203-1-irogers@google.com/ v2: Some minor white space clean up: https://lore.kernel.org/lkml/20260325161836.1029457-1-irogers@google.com/ v1: https://lore.kernel.org/lkml/20260302234343.564937-1-irogers@google.com/ Ian Rogers (3): perf env: Add perf_env__e_machine helper and use in perf_env__arch perf env: Add helper to lazily compute the os_release perf symbol: Lazily compute idle and use the perf_env tools/perf/builtin-top.c | 6 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/env.c | 206 ++++++++++++++++++++++++------ tools/perf/util/env.h | 2 + tools/perf/util/header.c | 60 ++++++--- tools/perf/util/session.c | 14 +- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 107 ++++++++++------ tools/perf/util/symbol.h | 15 ++- 9 files changed, 309 insertions(+), 105 deletions(-) -- 2.53.0.1213.gd9a14994de-goog