Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp234492lqz; Fri, 29 Mar 2024 14:58:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3wc/bcJFhL/lDmFz+/Ernaox0SP0Aj3hZX+QkjdesAY/27B2hjm/xOce4qFvNAEd4GMy2FBF0KvKSoKyiAwMMTVcMXn6YEb/FywqbsQ== X-Google-Smtp-Source: AGHT+IE51HmQWWyXW0RjgGE0Q8c8z+DIHoGJmdCFKNzE7BZ44XO1rZyJ9iqZrIqmB0c49Gk7RgEI X-Received: by 2002:ad4:5aa1:0:b0:698:9081:a958 with SMTP id u1-20020ad45aa1000000b006989081a958mr3761233qvg.15.1711749506289; Fri, 29 Mar 2024 14:58:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711749506; cv=pass; d=google.com; s=arc-20160816; b=IuUKjfNMF6+ooJFJh5BblgrgpV1nw9vBAQtu8ium5M05BNH1ih8ndkmIdJCoGzUyQ+ ywOgVpZOMKS1JrxcwMBGzK6V9HWBuwQv4WJ54Evoy0CfnCY081XgpocLkPpFo+tq38xk 8HueZVicNEu+lUGxXX+ojpMj+rDFCWIdSU0XgzpXTCiQK5mfEJ6D6cIiORL1ZFj7Rrxu cZ5qiYOjuXVLDpfda3vqt1UAissu/rnVXJhZ/iWDUQ+v9KbE2YsoA6iM0XKGj7D2Gm43 sp79qNBaYPHl1r6u0jew8qqSZeY+/PEiSf0b3YYLc8XUzq0ULqn63YiU0CAdCplRoktR SERQ== 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=+2iJdxdwFr29u8LYgGfz83d947svq5nOTdS5RurdAEk=; fh=fHhbvXgCev/wpffLVpfaAi8pPyv7hrTyhVPgsZ7HNrs=; b=acnNrfGEErJTOvFOC81NftH226DBqYa34lhltWhL+YzoonqoYfhFzhRb9OaYN14XLe Mw0Vvy0xMAHFjBN/KM/ygFJTz0nLalO25mL4nA0m81T5PZDzNIRA9DVqv6apvqfx7MSh YYMBWdphD6GBDGMZ8T5YNqsTEkib4ZbjI1diGeygdNcciq+nXK892WTXefK4iZv4rywn 1hX9Cfs7l3TVRUq8iW1AhhstpHJwHoirJPUcq2JPZTDIwID28zgFuYEN6OrYQfE0RDW1 TYtqYfrXooi7yJSLZ0SsAdfEo/zS/ATd+uEehyLU88APBGgjQ71Mr8qfzifiy5d0fm9s mMKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hp6T4qQv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h9-20020a0cb4c9000000b006969288f62asi4647668qvf.501.2024.03.29.14.58.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 14:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hp6T4qQv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125464-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 060CE1C20ED7 for ; Fri, 29 Mar 2024 21:58:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2488C13CF86; Fri, 29 Mar 2024 21:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hp6T4qQv" 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 4373413C67C; Fri, 29 Mar 2024 21:58:13 +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=1711749494; cv=none; b=FaEFEf4fIueTQhxeaIjHF4bXgrdW/n/3UCIud1n11FQhcHJwWIu+voonobLlL44RcEbfl1edjnbCpVfmgfRwZu6zYAxnGwlMdh3VyZlmkh1mf0bX8saX5SzHcLEan10qBjRZdkS+Kok7uKS5M10UI2fRbwGXWwOrPPkhZydoDzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711749494; c=relaxed/simple; bh=7/9SJAE0PB0hZ2kr9hir4oUxXdgdOk98SElceGoGKmQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Vp4GBlRT/+bOeSQLEgfPePVT4xdXanGhOzMqbt6CKIt6e2YfkBTaR+ek9pN9QpT8Gk/9NzoJDlkFn/Z/fZuO+53AC3LArrUvxQt5cOoPIREAUb+qqha5Nxk61YFLY36Mb0W2Da/J5Dk+MmRuvubX+GEVwmNajLrI59lHU62L/IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hp6T4qQv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73EE0C433F1; Fri, 29 Mar 2024 21:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711749493; bh=7/9SJAE0PB0hZ2kr9hir4oUxXdgdOk98SElceGoGKmQ=; h=From:To:Cc:Subject:Date:From; b=hp6T4qQvst5fN/PU/zJ2s/8oDLDa83TrXKYJk7JoKjnggCHEsCnJUTmZ6MVcXoUUk VRu0vXKIdsHvpB35hiCMUsakrVavRNsdg9TbaXgILTYgqTcPhola4qsKeswHTXm7fE DLxCnRW2+Zk+MKylVdlTtfvoXnmFdRIE79KcRAXCPJLIe9SPpFyn1SlfHBgBa/9nGY +KwMTjZfPt2isF+EGDbcSqgL/qcNPzOGSuvYi6X6tylTYE0CaS+Uf+lJdCogd5z8Mh r8f0b+Ew1DQn+qq32PVcVbEwEeULPVzJ+Ur9L3u6zw/0dyxv/nAcp1J99BVcvZssUB ktT7BqKUn3Mgw== 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 Subject: [PATCH v2 0/5] perf annotate: Use libcapstone as a disasssembler Date: Fri, 29 Mar 2024 14:58:07 -0700 Message-ID: <20240329215812.537846-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). * v2 changes - Show global symbols in the comment (Changbin) - Update the commit message for split (Ian) - Add Ian's Tested-by 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 Namhyung Kim (5): 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 perf annotate: Add symbol name when using capstone tools/perf/util/Build | 1 + tools/perf/util/annotate.c | 1711 ++-------------------------------- tools/perf/util/annotate.h | 59 +- tools/perf/util/disasm.c | 1814 ++++++++++++++++++++++++++++++++++++ tools/perf/util/disasm.h | 112 +++ 5 files changed, 1989 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