Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp53021rdg; Wed, 11 Oct 2023 20:54:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEF7x6oMfdtDZpTc94s9akQQkObazOdYP5EcdFnomrTyzDwMkJXRHCe0E76aJmBE48MweGR X-Received: by 2002:a05:6a20:440a:b0:153:40c3:aa71 with SMTP id ce10-20020a056a20440a00b0015340c3aa71mr30010314pzb.43.1697082879851; Wed, 11 Oct 2023 20:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697082879; cv=none; d=google.com; s=arc-20160816; b=E7Hpm6alJRJlYAI8y8kNbD606Xyi3BN7HFfRoSIOkXR4O2at/hsquqfdJrRuLJRTEA 4odtjKJwfWRHOHWWQSZeGu4EWywqIXu8oxApMlFr7Bv8K8IINbT8skD6nNPZ1nHHyZv9 Vu0mayYeCsGRDwHlpyyPuuZLqbJwsKDmh5Iah6608EPnDMRjjtjyo2oOtorTGmPSSFCA JVBVc9LZozDO5s10CnG47a4VcdsCXZJzW5WZYrh5VowG63L2j8t2pf2TemoOdZesL7qB RvtO3JuCTTsI1QK8tD6zLSDm1yX3YELtXLH5RJ5j76O4ORCSIMOfY9uiyYwol/lqnAXm /Y9Q== 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=tHRD9kCjTkWVMzvqCRV9itspmVJvTLZ+rMPWUUQpDy0=; fh=7Id7wL2M+oCJXD4imOzx4OKioxBXSOZqypDprm7aO4E=; b=DKv3mHy7Ax9M9cDdlqupljuBItZEGSDa3VEOCVaK/m2FX1LcKJ8I2xNzMVdN0oWwBn Tu1PT4TuvixeOT6ox6QkWff89oLp6dRMkCrbBjmJpVSWdmrmF0KSTzcgGCmPfYldLJgA ofhd3IDpGtpsmKWYjvwqQRGmN+1UQlDMmo49ZNfL6PdC4p+/yuokjac5KDDrnQ8K1fWB a6FX4gfcZUvbgbeMLT4KbMce8/fokRcyX5aXzPuaynfKRYshh0iRJK78bjAFgMPrTdru g1qhWmJJh/FcGvXcIHsophhInSMIB806PfnD+4jECHMMlX9CejbKRup1nQRWrsc/lt/7 QhbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XINusBF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a19-20020a170902b59300b001bc553d16e0si1102660pls.507.2023.10.11.20.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XINusBF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id B8CF480F66AE; Wed, 11 Oct 2023 20:54:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377081AbjJLDyG (ORCPT + 99 others); Wed, 11 Oct 2023 23:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376920AbjJLDwy (ORCPT ); Wed, 11 Oct 2023 23:52:54 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05BE6D5D; Wed, 11 Oct 2023 20:51:48 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9d3a21f7aso4510215ad.2; Wed, 11 Oct 2023 20:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697082706; x=1697687506; 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=tHRD9kCjTkWVMzvqCRV9itspmVJvTLZ+rMPWUUQpDy0=; b=XINusBF0gHNj2rSlBlEKNCJQL6v1m3lkiON5G2iLAPI0iPBX+YAT+RwHnqKlvdWoXN cs6CHDboOCn9YiPjzGbX2cdLyp8uA/lvtc0JDwJUmD4XCg1ZO/7nicyAmxpzgdlJmLfo wz7QyDGpanJRNZweugZfPasBV2QvEUxFX+oGSkwEOQ2vDDRevXHBf5KkIHvicmrXfZbh hQ6FpKlid2nmIeS/BobA7vgRio6qaKS6Y1iJRHLtLpAE1YvF5tynrQrEU5Q2tgsBr5ND lFPm4kx0jiUYcxJjg4nooCLgj2ZOl9aoX/Fg2rDdgdRZ5j6Z7ySsSgcbAI5uOXpJxlQv UG3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697082706; x=1697687506; 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=tHRD9kCjTkWVMzvqCRV9itspmVJvTLZ+rMPWUUQpDy0=; b=O7rpZ+4Eu+XZ+DKI12f8VmwVyiDSx8REbRkvWB1IlBWMBA2O7wrJ+NnDVvrzJAA0po +edz6fuGQPPHJBfon0LI5K9cZTe2JwkeBdXIDsnS6NpCdrx5emNQy7Zb0i7HoKR6aPwD pUrxoBXILYuVt+h8BMDKWZjNS+aORN5aaO0MxOyw7xhd1okUhjdkRgkxhT1jh5DcP8hG KcIQqnVA8Iv2SvUQk9TCdlEPvCwGa0/ZHAGHGkRj/j38x8uDIJ0NER1SwoSCE3yRUE1y mii0dQTvCdU71r4iIXh7RBjQl5MzZ1fnD25Y85ChPIAJegzlAZAboIeRzQ/gKtsDqc5D ikAQ== X-Gm-Message-State: AOJu0Yw5Fqe5ShbSwoFKUd0dbQecetngfXtjKfsCkpJ03NH2BC+3EZtB tiDtCtWhFhhKpHq8sOVpL4g= X-Received: by 2002:a17:902:e84a:b0:1c2:218c:3754 with SMTP id t10-20020a170902e84a00b001c2218c3754mr28229405plg.53.1697082706299; Wed, 11 Oct 2023 20:51:46 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:42e0:b1b9:d490:2f5e:be06]) by smtp.gmail.com with ESMTPSA id w8-20020a170902d70800b001bc18e579aesm711374ply.101.2023.10.11.20.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:51:45 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra Cc: Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: [PATCH 24/48] perf annotate-data: Parse 'lock' prefix from llvm-objdump Date: Wed, 11 Oct 2023 20:50:47 -0700 Message-ID: <20231012035111.676789-25-namhyung@kernel.org> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog In-Reply-To: <20231012035111.676789-1-namhyung@kernel.org> References: <20231012035111.676789-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:54:37 -0700 (PDT) For the performance reason, I prefer llvm-objdump over GNU's. But I found that llvm-objdump puts x86 lock prefix in a separate line like below. ffffffff81000695: f0 lock ffffffff81000696: ff 83 54 0b 00 00 incl 2900(%rbx) This should be parsed properly, but I just changed to find the insn with next offset for now. This improves the statistics as it can process more instructions. Annotate data type stats: total 294, ok 144 (49.0%), bad 150 (51.0%) ----------------------------------------------------------- 30 : no_sym 35 : no_mem_ops 71 : no_var 6 : no_typeinfo 8 : bad_offset Signed-off-by: Namhyung Kim --- tools/perf/util/annotate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 3f3cc7ae751f..190489df0fb7 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -3624,8 +3624,17 @@ static struct disasm_line *find_disasm_line(struct symbol *sym, u64 ip) notes = symbol__annotation(sym); list_for_each_entry(dl, ¬es->src->source, al.node) { - if (sym->start + dl->al.offset == ip) + if (sym->start + dl->al.offset == ip) { + /* + * llvm-objdump places "lock" in a separate line and + * in that case, we want to get the next line. + */ + if (!strcmp(dl->ins.name, "lock") && *dl->ops.raw == '\0') { + ip++; + continue; + } return dl; + } } return NULL; } @@ -3717,6 +3726,9 @@ 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 */ + ip = ms->sym->start + dl->al.offset; + mem_type = find_data_type(ms, ip, op_loc->reg, op_loc->offset); if (mem_type) istat->good++; -- 2.42.0.655.g421f12c284-goog