Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp666050lql; Mon, 11 Mar 2024 13:40:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWBDVq4TSO2I4qwnteTj4cJyriTQd6DM5YbRnMVYiYf5TN1+3Ecxb7KPJbMYAwqFt4dHDrGVQcGg4ykruBYtQ9513YbeYJU/igTrLsSw== X-Google-Smtp-Source: AGHT+IFYGmHibsGzVGNk5YfnJTqb0XwtEubRU35fO4t2bl0oHsUwBBNFI8Lg9Ql6hrMkEuYscxyL X-Received: by 2002:ac2:4d95:0:b0:513:593c:163f with SMTP id g21-20020ac24d95000000b00513593c163fmr4407258lfe.66.1710189648503; Mon, 11 Mar 2024 13:40:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710189648; cv=pass; d=google.com; s=arc-20160816; b=GR1m8AyQ6Z/B8oe132k5j/kvAcyBgu8XH5Su0/mmvBDpoaTQoJogmM5vmZj7gF2yQB 3/lQfNvAtZwtZV/XI3iLV/+RL37NUBiyfyz3SpOLDXsQxGtv0dn287npoAG4zLPQfFTk vts6+wspNZExozo5QiOSGuJKvsUqvD3Ae9vEa4/1sP7FDTxgov9S9eZQUa6jrGIVR5IY +OLCcYjpX51aTethhZdjqJvbZ1VmTo/u4N6Uwjjv7NOIP/AfPJ4dq+IEM+2FCiVupn+Q DBiKoeyXtSqtv3J+5VsJ6f73Mf5RyXhcImOhLrrkbK5v3pylQhv0X6ySBICcpI4kmOyr sA6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=sOjg3BLEjFW2wr37AxjjUynACUi6JjowFfZ5pjF8XB0=; fh=DyuFw4yr9FJizsioHacqCSCMC1klohLQ+qzR9BDwg5U=; b=wQKEF8xtxCHbToiLWqq7tCTeSBKNygz2Z9MdjM2NE9zkkujPy6dEClvneEyNKn35PM 6eqeg69UwhaMq5pWFni5uedxJG9Q+yj+QzSTyoqlbEYGXrlmkSwvNTThUqh9Pt7/xzFM IOvgEsO9DN69mYP8Z5DaLjXN/nTg82++2HbD3A1VMpbSlKLdA/46+Tm/I9PyBs6dGzyU tCiSNfQ2+mjw/nYMVsppj3auieyl5yQIyFAzsgmM5cuXwhOxwvue9AuPVg5LwNStITwE R03Y2PSO8MMSoVulGWVXD82OZgQBHaoT4ilOPyid0l4avm737KmBqsMUWXpnwwsgnPzZ 9mBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="EiLszvZ/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id go44-20020a1709070dac00b00a448cd364easi2845390ejc.316.2024.03.11.13.40.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 13:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99520-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=@gmail.com header.s=20230601 header.b="EiLszvZ/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 3B4111F21CEA for ; Mon, 11 Mar 2024 20:40:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C00085579F; Mon, 11 Mar 2024 20:40:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EiLszvZ/" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 595CC5336D for ; Mon, 11 Mar 2024 20:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710189640; cv=none; b=BUbyDR/Qxy7DYKCf2CXTqvb79YpUipQCgL1jWFPk3iN54ecOKyE8d7SfnsG5+kd2iFDzIbfT5WfIDUQLoNw2wFwH5gZThfdc+tKy503BV0RFbf3dFlFuUuiX4HxiY+Zl0sXcNE4g+QMPiw8tvg/s6gfOfTvpucUm7bZvLIhGXKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710189640; c=relaxed/simple; bh=NgqlqguhW0ZM1ks6G3okpjVdXxcqLDNirpMQmEjgQI0=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; b=f0oN18sXyuVY5NGEjH1rR21/n9h3WrvoJGfVYAJO/bcpYgYvGe3c50DVOA1zv+IbaUbd1U3WBTXXEhfLLS88f1hKY46Ju2jvc/q5VtBhLDRukXU+N3qH9MbtOMYfdtymKMZhAjoarKszMbJn+9GheRzkghCO+8boSR3EFFllsYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EiLszvZ/; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4132f37e0acso5269025e9.2 for ; Mon, 11 Mar 2024 13:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710189636; x=1710794436; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sOjg3BLEjFW2wr37AxjjUynACUi6JjowFfZ5pjF8XB0=; b=EiLszvZ/a7rpz2isGe7v3h0OQT8z/7DZqLq8PgvuRfHdgXEQD/mgfQLBr2CBIcQP7m CX6QX1uYdrj6GohGke+CwqReh5aGrhfc08nC3xTgD7hXAzsviPUaBQSNNexHUeVgCcbr N8SQZTP/hekEmVbSIjRyhSUvDikU7Uzgukt/lEF2OpDA27z+EM/4tZtAM16IyEjDEDry yXP9p0iL8RfVrISc2nEogZpEijZ24uxgS1OV8yyfQOmGamlEwPZTU+M+Of08z+M1v4tf uxmFd1/5tUoFBmufOvXaDirUm+NCBrI4GzJCmlDLa8h2Vk2cp6pNTT4GWDaMGML7xMRD +QwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710189636; x=1710794436; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sOjg3BLEjFW2wr37AxjjUynACUi6JjowFfZ5pjF8XB0=; b=qaUVyrg2CQCeGGBZtJxkYjmWex6HNetxKBAMPbwnOdP67z1srXHuWB0l15uldlJrJD IygD4gXjYDsX8VwWmVrrQmvgwHkTcypuyHg6c+2RPCN/hObXPfboHyOGMXbF7AwpAb/3 yOfD7XqeFarPcvMEuL70P/Sz2YwQiSHAm4Xh1dmjcKYn4tZMIPu3zrIv6cIaWRwYmCNM vnVqFnTWXRJHKPBMumlOCxE8/NGPGpKVtAtZ9jUMbRJlHG+TeqvHQNekiAStkOZqY8wl 6Ctbfbbnks2IWzqYsfYewkKHPr/o4VT0UoUEKeVxx33tmmLd0JmgA8ElL59z5SvpvAfk tYMg== X-Forwarded-Encrypted: i=1; AJvYcCWomxGpj84+GOhyL14UNc70SZqRyZOUX+QqrLqWzVX2lo6FVlQfPbEVUbjDjBxn9d0ydhwBUTl6Nznl/0P1tgCsjeMzv0EfDmJR+JgM X-Gm-Message-State: AOJu0YwcWmtrBiCgU2UNnvQemOqmQmy1trheBotPcS81ZBBE3iRGPAel OsUTNMrpsf+/zEicG9IyVRcn3AGnSYKxPTU187KlKelQDLNmZOhK X-Received: by 2002:a5d:5505:0:b0:33d:277d:a2c7 with SMTP id b5-20020a5d5505000000b0033d277da2c7mr4383608wrv.16.1710189636160; Mon, 11 Mar 2024 13:40:36 -0700 (PDT) Received: from rex.hwlab.vusec.net (lab-4.lab.cs.vu.nl. [192.33.36.4]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c198e00b0041312c4865asm14929355wmq.2.2024.03.11.13.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 13:40:35 -0700 (PDT) From: Brian Johannesmeyer To: Josh Poimboeuf , linux-kernel@vger.kernel.org, Brian Johannesmeyer Subject: [PATCH 0/7] Improve performance of 'faddr2line' Date: Mon, 11 Mar 2024 21:40:12 +0100 Message-Id: <20240311204019.1183634-1-bjohannesmeyer@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, I was looking at the performance of faddr2line and noticed that it spends most of its time performing two tasks: - (1) Making redundant calls to readelf and addr2line for each address (e.g., it makes 7 readelf calls and 2 addr2line calls when converting 1 address, and it makes 252 readelf calls and 51 addr2line calls when converting 50 addresses); and - (2) Calculating a symbol’s size by unnecessarily looping through every symbol in a particular section. This patch series consists of the following parts: - Patches 1-2 reduce the total number of readelf calls to one, - Patches 3-4 make minor changes in preparation for the following patches, - Patches 5-6 reduce the total number of addr2line calls to one, and - Patch 7 modifies the symbol size calculation to only check two symbols. I evaluated the performance of the patch series by running faddr2line with a standard kernel image (X86_64 defconfig with CONFIG_DEBUG_INFO enabled). When converting only 1 address, the patch series gives a negligible speedup. When converting 50 addresses, however, it gives a 15x speedup. Cheers, Brian Brian Johannesmeyer (7): scripts/faddr2line: Reduce number of readelf calls to three scripts/faddr2line: Combine three readelf calls into one scripts/faddr2line: Check vmlinux only once scripts/faddr2line: Pass --addresses argument to addr2line scripts/faddr2line: Invoke addr2line as a single long-running process scripts/faddr2line: Remove call to addr2line from find_dir_prefix() scripts/faddr2line: Check only two symbols when calculating symbol size scripts/faddr2line | 110 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 84 insertions(+), 26 deletions(-) -- 2.34.1