Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp768397lqh; Thu, 28 Mar 2024 16:21:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX799q5IKSyCVPcg158YOwZeWqtD9QjwgRiUhhsQkCdWXXyVDS8y+pFOW/U4WHrIqyUTbqJro/TtuVVxrn3vuvJzkr/sO0Bv8SqtZsZfw== X-Google-Smtp-Source: AGHT+IFQNwi4M9zZ4ObogklBcBcGIvDYHtVqOUFeiqnBCi3iP2jb0xZZddZugsjk9Hh0AAXxVLp5 X-Received: by 2002:a05:6a20:549a:b0:1a3:6a6e:c4c1 with SMTP id i26-20020a056a20549a00b001a36a6ec4c1mr747533pzk.10.1711668091221; Thu, 28 Mar 2024 16:21:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711668091; cv=pass; d=google.com; s=arc-20160816; b=HZVmyJMEqOpVjn6/IsCEb7vT7gaVCZSgwBKMNdvDXgwH9OS+5Hfz8X6TO+1ry5B+a1 5Gqqz9pJtXDBxgbDK83sRlUynA0Uk5EVLRdF/3xNeO6E7YKOVn1SycYRI/XweBD8ZYHq 2DKm54J3WI+S8qLUhni/9bXpU2vYXmJ2qI6JEOZqtsGY2RKG1mcJfa8YPBU6boHDLqms 1M121jU0Y+n07W1iIopscMAbqda3dktxu5061a9NRB3MsJ/EA/m7RWNP0/GLGMfACbLt ZhK7vrzmWs8A8LiQ8xVXmJg0e2AXlasjwVMj1ulHTxbatMJK5djAKh0brV5wyxPl0V/R QYiQ== 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:cc:to :from:dkim-signature; bh=Bixlk/8Gzt6kMScram6amQ3b1MK3Bj7AXiswidu02F8=; fh=8Sv5nCPXMa4LXSOPSfwdAm5a0jrvTKlFawPSw9GHaY8=; b=sqyWxfPMry/8FOX2lmPObOZ4dgRcz+b9+TRpbhclA01erdxdL76pdL0WGrQEfHDwBs 4CBAjP43qOE6XWjm4f+T8scIlEa0dllvkGVI42omMa2vK7rucyl8HkUTRa1/Qj9Xof0r IYNv3F29r/v3MTBUDaAJgCmPVChyDV2gyZ+PEKfAhzCjmK4nL/RJVcuTXQSsmvZhwzic 5NDS/V49pIOEK7xIkYYPXy21fscskDxm73vxdJlJJHK80ri21Umkhpmxm+UcK2g1KANn psoGNMhnjQE1eiDOSJNMNQWc8RT7la/QsELBhNJakQuQgtbSqnsug31E2egejho4aBQ/ FMSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mzBZ/XQg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a26-20020a62bd1a000000b006eabc1d8cb9si2237361pff.232.2024.03.28.16.21.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 16:21:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mzBZ/XQg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123817-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 58014B2397B for ; Thu, 28 Mar 2024 23:20:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B805E7FBBA; Thu, 28 Mar 2024 23:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mzBZ/XQg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E09A01CAA4; Thu, 28 Mar 2024 23:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711668011; cv=none; b=cliERQY7hTMWMv2esfvnZ9HJAL73mGVOkv8/OgUxujxhSZqxuihf3eeqK6gyjnaL9ZHCn5apfu8J2myvYrWFZ7j6eCq0oQI26u/s9RNH5HZWYM38OIHGelfxsiD7spAiRT3otaAJ8Zm6mylAqft5TOxgu3o+Eb/1oGLu/0aaspQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711668011; c=relaxed/simple; bh=JdsS1Ph4X37kZPwaxpWEWGD43JuhTV198Fbqnu88sSw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mR2mErAy6MTjDNbbLk8h3xmiorzSDckqR9+NZ9cR3bmowcGr1UnORxhRYntuAqsHk5NoQxBwHdbLMx9rc5KIQeqIeSL3RVe3GRB9FNpqD3fvStjNRJKTHQsgW7wyfoBk/u8jbi0M1pRiPMkY9WlI4O4O35IWAaFp3JbwXn5Yckg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mzBZ/XQg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6846AC433C7; Thu, 28 Mar 2024 23:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711668010; bh=JdsS1Ph4X37kZPwaxpWEWGD43JuhTV198Fbqnu88sSw=; h=From:To:Cc:Subject:Date:From; b=mzBZ/XQgkj/kNnFMUahn5RCa6UYJNuKBI9W/+LWeWNyD2VhZttYaOC4QEC9fUHYoB usU6Lh99zYSSjBl/HucEspgd9sbbyDQtFPK2F16lWJWA+2MS8ylC6Qh0o/MNA0zvwq 4ZP5AaEs1I4kt3O+TajgPkkPOP/vfucEJskdtSViu7XI5iez92A54WWuXAo4KcgijD 1vSrfaoYEDPATCl9Q3/fe/RA9PuU5+QS62Abrek+SUpvYTFDy6dOWJeeH+iRhoRRiW xi3y6cesVzCiSf4RGHaFQ4lWzoySnnZk41enilMqW5eTgbSB8updgN5QoNAyjAzhlx O6phQNgWHBgNw== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Changbin Du Subject: [PATCH 0/4] perf annotate: Use libcapstone as a disasssembler Date: Thu, 28 Mar 2024 16:20:05 -0700 Message-ID: <20240328232009.466018-1-namhyung@kernel.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, As we've added libcapstone support, it's natural to use it for perf annotate as well. This change added the capstone support on x86 first. Other archs can be added later (by someone who can verify it doesn't break things). For now it tries to use capstone (if available) before objdump. But it doesn't support source file and line number info. So users should use the objdump (by passing --objdump=PATH option) if they need them. For example, this command line will keep the existing behavior (i.e. using objdump). # not to use capstone for disassembly $ perf annotate --objdump=objdump The capstone uses LLVM objdump style output which is slightly different than the GNU objdump. But it should not have differences besides that. I've verified the result of data type profiling and it produced the same output but gave me ~3x speedups. Thanks, Namhyung Cc: Changbin Du Namhyung Kim (4): perf annotate: Use ins__is_xxx() if possible perf annotate: Add and use ins__is_nop() perf annotate: Split out util/disasm.c perf annotate: Use libcapstone to disassemble tools/perf/util/Build | 1 + tools/perf/util/annotate.c | 1711 ++--------------------------------- tools/perf/util/annotate.h | 59 +- tools/perf/util/disasm.c | 1739 ++++++++++++++++++++++++++++++++++++ tools/perf/util/disasm.h | 112 +++ 5 files changed, 1914 insertions(+), 1708 deletions(-) create mode 100644 tools/perf/util/disasm.c create mode 100644 tools/perf/util/disasm.h -- 2.44.0.478.gd926399ef9-goog