Message ID | 20231110000012.3538610-30-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp787532vqs; Thu, 9 Nov 2023 16:04:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvKUmlTKecJI5LANyuIUCTg30yV4m3aJpjyoZpo/+c0mThyhD0DLibEzu26Su0Gpuvm9QN X-Received: by 2002:a05:6a20:a121:b0:17b:7505:8ab7 with SMTP id q33-20020a056a20a12100b0017b75058ab7mr7412318pzk.46.1699574670914; Thu, 09 Nov 2023 16:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699574670; cv=none; d=google.com; s=arc-20160816; b=guJzD3WjtB+GNVCKiVRRB0xxZIOg3N8YCsVvijGWQl0154KfTv7T0Ohb23ze36n09z EaiaTmM5aKLUk6kbnNWFnmxVpjMgNmazp3m2cnOZaaSOfDDPfuhpJObh2kO1nEFUTen2 GBzVntjW663i47Pox1XxzRnvyyuGkOisJU3PgRwqRRkr1xxcIy9PR31T/hGtYY/L5Dtc C99V5KZPDOMoG+6DA7i5yHZuxi7FOiHboiewOctLPelYDHm+4RvMEy+wGNsF+j2x68aH 0G5Kh7kDoaMTaj+aGBW69fgCdKMP9TdXQyhNqnfMHCnCr6qNkpRkObv8yICDY7nShu+w c8ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=5ia7kvZ+eaGI+H0XOPg0NJ+OKOWxPEjxcavewxuznSI=; fh=K//si1Hi/RYC7s39rVvmvh0YbZGmBrdWWHQg3cPF7Xc=; b=VcGZpW+xH9A93TYovmd2MiOZalCemYr0p2eoKgHT15ie8U3HWkSYGEcY+tCcEzd1Cv dJY6HaUMaKBs3w87QW2mlof7jlQ5ASQw4uzWvD2wzGn5bYpXP81nlju9DvFk4jYQjqnJ 99nCXFXn7JEh0S5gL9e+2KIQeKrFKxefIPqYW8bSWIU+Wu7fsc6hbZ7PSbG3IDvOPH/V 3rYMfzq4Vcprx8uC8HOWB4C6scIs76HxG3fguDCkW97NVZuB1/l2OJeFHh+R5HwHHGCm C6st8j5yz02FODVS6f/UJROljSYVgtkofLr4qgk58jxXywI5YJyC5gsjww7P8LBkpYxU gPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cSqhRC+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x4-20020a63db44000000b0059b7f926c03si5295417pgi.771.2023.11.09.16.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 16:04:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cSqhRC+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9A5D4806820E; Thu, 9 Nov 2023 16:04:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345483AbjKJACs (ORCPT <rfc822;lhua1029@gmail.com> + 30 others); Thu, 9 Nov 2023 19:02:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345518AbjKJAB5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Nov 2023 19:01:57 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715B44ED0; Thu, 9 Nov 2023 16:01:00 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27ddc1b1652so1292884a91.2; Thu, 09 Nov 2023 16:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699574460; x=1700179260; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=5ia7kvZ+eaGI+H0XOPg0NJ+OKOWxPEjxcavewxuznSI=; b=cSqhRC+vmPv8UmB4RieRSId0DnW33fNO73dC2vF1mGLP+Vpf+ohOmIe3cI515CBHVy oeMni24x48r0zjf41tpkmDhNfFotq26wh26xdmPIl/8MwvUn3XJsSfi63qYUs03QX+Gv PpX6dBz4CY8QiiLVr5EdSkyve+mEDSiwugwFINyfta9oDQVDQ8mfuZE3QWULu20iGj1M YtnsRDO1Vj4l8f8xLQSLGN/Qkz6xE8h3Y7Jf+zhp3Yt0vAW8Ol093VAwEc8bU3mgHGiF F6u2Qic+4ZD2EakCMZXyLhWQ2D6Ry9L9RURDJ/5eGaow9bJ+8dgzMFKY/Z0tsdn51vQa fSOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699574460; x=1700179260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5ia7kvZ+eaGI+H0XOPg0NJ+OKOWxPEjxcavewxuznSI=; b=AfEmLYiivFHNcDFUTHWI57niLtYBWibTIBjS03mOspuyEsrby5WIQzozTQ+HbsRjyf 0IBCatQ/WwLA1Gjj+OlZSEGYVsP2bcZ97UtSYDPErutubBxN0SiuBSl0/B9JUdDQsDGC bZd/zCRPsn8SrRor2W6TjZ7PgeECVUk+ydXab4D1Okp0yOIK+qpUsubG8STodmiSMupV lDK5/QxKzPhYkXk/W3VeHysglPStdSgLi78caU8QOpUNfEF0M0GmzLUqiAjfHFZqAoa6 pAO8kCXRg00aYP8H7jNqLcHHADvopyesdEkwfbFv3fWqsxxhTVwBQlP59z7udhEBO73h Lk9Q== X-Gm-Message-State: AOJu0Yznp1iWEHFQ6n+mHodTbj9RCBdbq48ENVoFKmuYUUaCetl1xa+l oLqvHaxG/iV9llURld3CnnI= X-Received: by 2002:a17:90b:4c12:b0:280:3f33:64d8 with SMTP id na18-20020a17090b4c1200b002803f3364d8mr3606376pjb.21.1699574459747; Thu, 09 Nov 2023 16:00:59 -0800 (PST) Received: from bangji.corp.google.com ([2620:15c:2c0:5:d45c:ae16:d959:a5f1]) by smtp.gmail.com with ESMTPSA id k32-20020a17090a4ca300b002635db431a0sm371312pjh.45.2023.11.09.16.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 16:00:59 -0800 (PST) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>, Peter Zijlstra <peterz@infradead.org> Cc: Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Ingo Molnar <mingo@kernel.org>, LKML <linux-kernel@vger.kernel.org>, linux-perf-users@vger.kernel.org, Linus Torvalds <torvalds@linux-foundation.org>, Stephane Eranian <eranian@google.com>, Masami Hiramatsu <mhiramat@kernel.org>, Andi Kleen <ak@linux.intel.com>, linux-trace-devel@vger.kernel.org, linux-toolchains@vger.kernel.org Subject: [PATCH 29/52] perf annotate-data: Handle macro fusion on x86 Date: Thu, 9 Nov 2023 15:59:48 -0800 Message-ID: <20231110000012.3538610-30-namhyung@kernel.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231110000012.3538610-1-namhyung@kernel.org> References: <20231110000012.3538610-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 16:04:00 -0800 (PST) X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782133210332418081 X-GMAIL-MSGID: 1782133210332418081 |
Series |
perf tools: Introduce data type profiling (v2)
|
|
Commit Message
Namhyung Kim
Nov. 9, 2023, 11:59 p.m. UTC
When a sample was come from a conditional branch without a memory
operand, it could be due to a macro fusion with a previous instruction.
So it needs to check the memory operand in the previous one.
This improves the stat like below:
Annotate data type stats:
total 294, ok 147 (50.0%), bad 147 (50.0%)
-----------------------------------------------------------
30 : no_sym
32 : no_mem_ops
71 : no_var
6 : no_typeinfo
8 : bad_offset
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/annotate.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 2f325a9cf33a..7d733bc85c9a 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -3750,6 +3750,7 @@ struct annotated_data_type *hist_entry__get_data_type(struct hist_entry *he) return NULL; } +retry: istat = annotate_data_stat(&ann_insn_stat, dl->ins.name); if (istat == NULL) { ann_data_stat.no_insn++; @@ -3766,7 +3767,7 @@ struct annotated_data_type *hist_entry__get_data_type(struct hist_entry *he) if (!op_loc->mem_ref) continue; - /* Recalculate IP since it can be changed due to LOCK prefix */ + /* Recalculate IP because of LOCK prefix or insn fusion */ ip = ms->sym->start + dl->al.offset; mem_type = find_data_type(ms, ip, op_loc->reg, op_loc->offset); @@ -3785,6 +3786,20 @@ struct annotated_data_type *hist_entry__get_data_type(struct hist_entry *he) return mem_type; } + /* + * Some instructions can be fused and the actual memory access came + * from the previous instruction. + */ + if (dl->al.offset > 0) { + struct disasm_line *prev_dl; + + prev_dl = list_prev_entry(dl, al.node); + if (ins__is_fused(arch, prev_dl->ins.name, dl->ins.name)) { + dl = prev_dl; + goto retry; + } + } + ann_data_stat.no_mem_ops++; istat->bad++; return NULL;