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 D1CDA1A9FB7 for ; Mon, 6 Apr 2026 17:16:39 +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=1775495801; cv=none; b=W8nCBYXmxxTtIM5Km+aHMluZ6oa/2TIpnxmEBfNVXoyWBSlmOLRUh9Fa0JIDXmA2VhpRQk2fHyUUtfmXcO6t5scWAMW5D3dVDwIEASwSS7ki1XGonjU7hsZhhqo9GDG2TP7SJR74lv0UiLTEVNtSsUgM9JLAoz7YxxElKfuE1dQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775495801; c=relaxed/simple; bh=DsenSwK/NwNsVQofpl4gtUWjwJhYnStVDFl38jee1hU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=etR3xHq7F4jnNgHsWooZIHtuy8LBtbzp6rOpsmf2OE/548uZ0sSHj+3hues8gdkz+i+q0DkDmvcoLJuY5DdUEh/vLnrk+ArH5mUfttHwmYzy9/sqa8ZvzCMiDtwCXMsy8avfYkFIXiY6FZb51QnjvAZWiTiLP9Ts7E9y+5F3Zjs= 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=dIPRBIG2; 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="dIPRBIG2" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-12721cd1a2aso26846469c88.1 for ; Mon, 06 Apr 2026 10:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775495799; x=1776100599; 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=KMCKiIhN9/73e2LsQXZ6rcdnXOer2akl+Pj9NWbWVh0=; b=dIPRBIG201yetj5zQfLmhx4pNfh6co6oT991Lz9Tw/gTAHcAzg/qE2XJNBsRhtLuor IhpLMUyin2BZnsOJgnXVOy36eXZ1Vbn5f4Mf50iq3NpwrKmsRVCaVLo+heBDNLgN1qRr LBB7gDZCc39n5r3TjHt/TyA9jWeZiHFZ3p/XslHjtdv/3lz69c8v2fEHN5J9R7f9EUEh 7Td7/dPAJw3ra9jNsRFWm0Y5nrz+NEDa6GHegr6zK5c116L2ELbKKIsBBxZYhJ00MIqf VMSPi35q3GciaIlv6I4teFCja0UD+wrMSxxQIQRp0XvFVjUpWA4nRKh1v08MZpoI35Ff n9gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775495799; x=1776100599; 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=KMCKiIhN9/73e2LsQXZ6rcdnXOer2akl+Pj9NWbWVh0=; b=sfXkhyGc/eRMymEhEBprsF3TLhgTycZJwBG7O2AaDfubgTpsXP6RftEJGepD/eq7Lp u8c9f6ITOhgkHyymtCRyqRN8//xkCX+KmmG7aeUlNKwU5bKG4k082Lky5HOmtiRNkDrb AnWmle7tDcDCN1u3dfX+BqLNuFvMrqB/lKcuMrcb3NHWHbhbzUzdiqaO+pWbDXfLIzaS jFYDdqSvTiOybFiFrfruhEURPvo2hEj6OolE4/DeW+3qLTu5mEC/69M5JHTsDxW4OLMk vPeCL/QGOcTnPwCVViqs0c161KEEcDZQ9/VddT5YBjVdYw28KwaeVZgo7R7JwgPDytee YXvw== X-Forwarded-Encrypted: i=1; AJvYcCUl3URyNdsQDJ0JxnCx+Pg9TmS/OiFiVJDZsEEoSUkdnTD1U7Z25eKM3h4rlS+nDbm1g/l7vjCaNbIMKok=@vger.kernel.org X-Gm-Message-State: AOJu0YzYpwgmzdp5jKk70GP/KVcvw1jFx7qH98N73viJBcTddk1YjGDc zJH2dVJ+ci+kiHg9Pg4Q9G1vMvpozccRyMzWZiR5RcEfIV4GH716LGMi2jZpwJp4RY1zKxezc8b HYabkDcTS/A== X-Received: from dys23.prod.google.com ([2002:a05:693c:8017:b0:2c6:fcf:21bd]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:4090:b0:2c8:6361:ab58 with SMTP id 5a478bee46e88-2cbfaaaaf92mr6467000eec.13.1775495348644; Mon, 06 Apr 2026 10:09:08 -0700 (PDT) Date: Mon, 6 Apr 2026 10:09:02 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260406170905.2614260-1-irogers@google.com> Subject: [PATCH v5 0/3] perf symbol/env: ELF machine clean up and lazy idle computation From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, 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. v5: Add perf_env os_release helper (Namhyung/Sashiko) 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/session.c | 14 +- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 107 ++++++++++------ tools/perf/util/symbol.h | 15 ++- 8 files changed, 264 insertions(+), 90 deletions(-) -- 2.53.0.1213.gd9a14994de-goog