From patchwork Tue Feb 28 08:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 62339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2894017wrd; Tue, 28 Feb 2023 00:43:59 -0800 (PST) X-Google-Smtp-Source: AK7set/+2ojrgrNkTgYIUEsdDiySqTi2TsBUnscSIjB3laqj8lwRzIeiwbycnc6Wnmz3WTY8J39A X-Received: by 2002:a17:903:11c9:b0:19c:aa09:c455 with SMTP id q9-20020a17090311c900b0019caa09c455mr2135936plh.25.1677573839447; Tue, 28 Feb 2023 00:43:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677573839; cv=none; d=google.com; s=arc-20160816; b=UREDm7l5v10zzT9HilyOrHywswR4wKYcrOwE0W+3PjSupG1tTi5Dgw8RbEq9ZikZyl vcwI1pqdUv4KcwZ/PEjUsSzjDlR8hDINowjVsBaf2RobaXrs2I5WcmQgWMv7JGN8cZD5 SXonxoyxiAILFhr9ObVQJW/Y5V/JINYjml8d/nv4uYqp6OEbvKlZtDz5+eB4TcxmmQ0C DDJkOIIBsWkxZRUZGNbNfn0d8ttaIpzdQsgoekdY+YaF/mopUXAZJwiIAQI5sqV387TX C5QK1iPzj4hVQqpz2a4aLK3zu1hPd2bO2feqXT6+gMeXS/FEq4xxSD6nPnzd6NiZYCdI 1TAw== 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 :dkim-signature; bh=JCXvY3VOyromxWZSsh4iONVhiGPWxZ3OU8P5j9wqMDM=; b=I73RMg3xb7CJvNEYEIA98Jck3i3uerobpDNE9jWML1nspzNX866YdCPyN31ZqR5nAA pY/z5Kh1ksTU0fVnE18RFCB+MOyUGdWMGU9aQUIN10ALEocPiBTF6Y7ej0Sg8KnqWW55 uPmB4DFkdkiEWmy5u0qTnHLHohQ1hocnJE/07P4zcTzchear8NzcBr7RUuvYDxu09XrZ MqA8VJAgLLpiwqbRTTyPK4/UZBf3lHK20ve8vGNaklwVP98VamZKRUBGTx/RElElJQOz 6GqkMjMf8h8nqubIMBjUo+G7Afu2madJU9jeM4Ro7wrcX8Y9/fW+odkR8O3aGVKoZMb2 8TRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHa3wZ4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kq15-20020a170903284f00b0019aa6d30d64si8831519plb.183.2023.02.28.00.43.47; Tue, 28 Feb 2023 00:43:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHa3wZ4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbjB1InQ (ORCPT + 99 others); Tue, 28 Feb 2023 03:43:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbjB1Imv (ORCPT ); Tue, 28 Feb 2023 03:42:51 -0500 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 86F7B2C679 for ; Tue, 28 Feb 2023 00:42:34 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id bh1so9598641plb.11 for ; Tue, 28 Feb 2023 00:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JCXvY3VOyromxWZSsh4iONVhiGPWxZ3OU8P5j9wqMDM=; b=mHa3wZ4GywafX9hnclLu9nn5NSKcgATH5FrysR3DIX0jEA8FhX8B2sADMTrve843Ad k8EMMHyMHGDBv7O3yhebbdoecjhSu6Zt9wBWuRRJsF8uKDCx5xFXwlH2N1t6tLpfMP2Z RvSYgr+m8PWRjzTBOF8ymbLHCbnrwyLzziNl/X4z1KLd2WvhvC0UEbQzOnZSZ7VFVyMC kD7k6G8Be4mi8pe5qgH1mNgZEzpKpgtUZtCfmrszQqTEH4Zz4PuqVEL8QkaHMG418wmh 3JUVbtBmA6PLZhWlRKrAagZcaeGzdxyPlxayIrsyzj2Y6fURu9WTcREIrGV5PB80v6UL AXxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JCXvY3VOyromxWZSsh4iONVhiGPWxZ3OU8P5j9wqMDM=; b=uQ81zZGmBDl9d90wxzWhsMruvhCybnCeuEim466ojo2ocl5V56V5AJnk2aEqyDJya6 eLIoOuds3R6T4qsYCXHZSd9WM81gWM4ADCeaj1od3dHg507tVP+8d+lIqWgfNJH8aZOs bv3SQ8aX8NZ/cWdmNExnAgCWro4dYRlOVpOClS0uMGxy6hzNK85ODp3RItfDQRtUvYDt a/BD4j2GqPzxLWf+YqqDHTW1Q7PDttBIZPj0UusnKwfs8KgNEIylr8WWMTUAbR8p8qvl sNsA9th3mHAg8+FwMWfHFWq7Ij1hBzO92Y6ulGP/yYkjDlzAfJTiRhzOjMWKtp2Gx665 F1ew== X-Gm-Message-State: AO0yUKXMmWEYhT9ph2rGzzdmDbwgg2/wiR3bt8FgfzEzUKzmX4yBGCNt B5nccT0g0iMfORHoAx+5TqrMRQ== X-Received: by 2002:a05:6a20:3d8c:b0:cc:f39:5094 with SMTP id s12-20020a056a203d8c00b000cc0f395094mr3032509pzi.30.1677573752594; Tue, 28 Feb 2023 00:42:32 -0800 (PST) Received: from leoy-huanghe.lan (n058152048225.netvigator.com. [58.152.48.225]) by smtp.gmail.com with ESMTPSA id u25-20020aa78499000000b005d6fcd8f9desm5681270pfn.94.2023.02.28.00.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 00:42:32 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 07/14] perf kvm: Parse address location for samples Date: Tue, 28 Feb 2023 16:41:40 +0800 Message-Id: <20230228084147.106167-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228084147.106167-1-leo.yan@linaro.org> References: <20230228084147.106167-1-leo.yan@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759063666679847470?= X-GMAIL-MSGID: =?utf-8?q?1759063666679847470?= Parse address location for samples and save it into the structure 'perf_kvm_stat', it is to be used by histograms entry. Signed-off-by: Leo Yan --- tools/perf/builtin-kvm.c | 5 +++++ tools/perf/util/kvm-stat.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 779881901a05..a9f467926bdd 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -704,6 +704,11 @@ static int process_sample_event(struct perf_tool *tool, if (skip_sample(kvm, sample)) return 0; + if (machine__resolve(machine, &kvm->al, sample) < 0) { + pr_warning("Fail to resolve address location, skip sample.\n"); + return 0; + } + thread = machine__findnew_thread(machine, sample->pid, sample->tid); if (thread == NULL) { pr_debug("problem processing %d event, skipping it.\n", diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index a3219829c448..80d5c5a9ae31 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h @@ -7,6 +7,7 @@ #include "tool.h" #include "sort.h" #include "stat.h" +#include "symbol.h" #include "record.h" struct evsel; @@ -86,6 +87,9 @@ struct perf_kvm_stat { const char *sort_key; int trace_vcpu; + /* Used when process events */ + struct addr_location al; + struct exit_reasons_table *exit_reasons; const char *exit_reasons_isa;