From patchwork Wed Mar 15 14:51:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13175986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C219C61DA4 for ; Wed, 15 Mar 2023 14:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fG5ALFEx9mWhB/4voCzIDe9SPRqab+1zrpu5oUzpfjU=; b=UpsXolF6GSOAWf TSrovsFbeVazGEQfbn6bblk74TAW5pb6DGJpREGqQx3VcWlwFqggx69tuKeuuTw8sEN/kahWU6r4o 4oQV0oNIFZ6Uyo0YyIQUWmqhihLRb7E4WkLMECCMNaidn2fC0pERfTzaBO34RopF+j+GN+3iVcHmt 2oM2BQQc39abJjemoB+n0Zq+z7AwY54HWoAA+TAcCIEJbk91O5xjjgZL1d7xskOToddIFXO1X6680 vjLRschy9nBzcB+vVuZy5rEE7M/piuyIjwy2mPxX0rar1mwWPsrAGzr5N4fPWUWoTRPZpqR9Yyy26 NSOICRnZKleFuO+unr/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcSUG-00DfRS-08; Wed, 15 Mar 2023 14:52:20 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcSUC-00DfOw-1g for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 14:52:18 +0000 Received: by mail-pl1-x62b.google.com with SMTP id ix20so13784416plb.3 for ; Wed, 15 Mar 2023 07:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678891936; 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=BxPULJO486xqHJLRx8ubmkrWzwK0iscBf1dUdchHcWA=; b=ZG/EslB6f9/yZgtygYyLalr/i45+cTyqD6wRGVjTxOdd7TWk/8vE9TdItJGBNewgvh 3KbsUsgRWQXrncEp3I3jNl3GYazW55VQF/E1YK7YcNix0tfCf+T4GCHgNBOTkIoeavo5 152APIwoh4PuPEuyfV2T+1L0ZlK9MmzttdZHQATRNTyFQ9JzwrIl7bBMLnV1DdGZvk7R n0MiLIGN+11YRriy+F6haDjrxnbBu2fXfDIp2XP/rlLlZL1dFunykx1yMhHmEU02sriM W9dPj2mht+HhvdEYnC+8cqXLqvyIDe/sfVGBaxlezH+Nh0T14MX4032pNzqW9nstfYDD MBBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678891936; 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=BxPULJO486xqHJLRx8ubmkrWzwK0iscBf1dUdchHcWA=; b=6KVBrG5F6wNcDm90MTUVcFYYkx/sY+fCIIwE8Rv2JWC/M+f962P2a0cFSYYD57eBEH p91irHHYbrxPO+w5ToblvAUAe92wwbXs/k1FMtXecAr6WLnaPc00on9H1egji1sCFBNC 7blcjQ7yk9NXO8YGW3fSZfPd0AcuNE2l4E5fKJcWZku3ldXFsxtEsya/52tkUC7i8qQE JcwLnqT1aItcpbCS6HpjdD/A+GN46wADYuW+vXAvGe1OWQB4C1UIF99aHEPCZYPZKnpT 1czwr9XDDM0bdappbdlVYYkZMO/HaByxCznLNH7LArVI//R9Ihjnf4ROqadqPyQgREOC YJ2g== X-Gm-Message-State: AO0yUKUj6MvrpgiNGVmedeWUrNG6mPQI2hlCSsCQqLoU3EvIWTJ+X8K/ da7iejf5wbOo6HBzVjOIoiwitw== X-Google-Smtp-Source: AK7set8ko9n4ei4Die1EmIH61gaaEgOSpmUg0Rela+nxsidAZyB6jjslXFnUZTGMDc+45BGJhugZOQ== X-Received: by 2002:a17:902:da8d:b0:1a0:6bd4:ea78 with SMTP id j13-20020a170902da8d00b001a06bd4ea78mr3242115plx.31.1678891935892; Wed, 15 Mar 2023 07:52:15 -0700 (PDT) Received: from leoy-huanghe.lan ([107.151.177.133]) by smtp.gmail.com with ESMTPSA id kh3-20020a170903064300b0019926c77577sm3781587plb.90.2023.03.15.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 07:52:15 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , James Clark , Adrian Hunter , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 08/16] perf kvm: Parse address location for samples Date: Wed, 15 Mar 2023 22:51:04 +0800 Message-Id: <20230315145112.186603-9-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230315145112.186603-1-leo.yan@linaro.org> References: <20230315145112.186603-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230315_075216_599620_757970F9 X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: James Clark --- 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 5ea723fd45a4..fa91c8deb628 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 e2c17662bac7..3b2eab91a9be 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" #define KVM_EVENT_NAME_LEN 40 @@ -88,6 +89,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;