From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6015EC433E0 for ; Thu, 6 Aug 2020 02:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37AA322B40 for ; Thu, 6 Aug 2020 02:41:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Nz5onXxr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbgHFClf (ORCPT ); Wed, 5 Aug 2020 22:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbgHFClb (ORCPT ); Wed, 5 Aug 2020 22:41:31 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27C0C061574 for ; Wed, 5 Aug 2020 19:41:28 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id r4so16118067pls.2 for ; Wed, 05 Aug 2020 19:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RU78NQx1PS87rKw1B6pRtoGaZl6+eAt/ZvZRlGLVgEU=; b=Nz5onXxrAvvNXl9MYRVLc5oWix8hwJRMynO82htQPDFtDWcmQIJeCTNwe8uEOHbEbo x7uufxE8LgnvkREPzyyJnhBEwyifBUEhGRbv72lVNGUx6aaZUYVU3KaE9TD5oBZ/VsyB PKY/X40J33gydDranVCIr/MMEpnR9541vdIafgGn20JMmJJNl90mr+j/fpvotp7mCeYY 0b7S3VA4bfUvZKg40meJeW9r8UEDx8sIjh2uuHr1OhsEcm3J0V5SGPa6uXWq86rsFZyd +BkvhVpPiKqkbt2rXf9K5fKnA+Fw8r+ck61IstHykT+5hEdaiScZUInGArRs1TlrnI2i 4zFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RU78NQx1PS87rKw1B6pRtoGaZl6+eAt/ZvZRlGLVgEU=; b=JoH4XqOcV8icnmWs2Y1T0q6LVZ4LjyLacPduu+J+pA0oAuOVZOJQVmJE1ZOlCbvU2v zN3ANN0rei3rtEVRqoLR7i1HrnDo2AWTuzM9oaVPiNiDB2kqGgKrvqXQolc9aQTgPCwW NvLx8WoqJIhApgZWKx3aNE8RvPXw8Tfz2Tyr/7J9d5WAGLNYlYYLgDYI9Gy3KZvhkBvR mUBm4e53eTSF4afrtgHgoNqSveFawLvNAb1kc4dNxG5l7H918QCdm/cX4fAXTQGkKEqz pQ3mhtzF2/L1YMk8sbhimfotNsY3wKIIXXM1uIr4UNrgQB60w+Q8d9gfCjxgLO+DcDQ2 hyiQ== X-Gm-Message-State: AOAM533H4zaypGiQfbKC0I+1UIdomHFoGpVnQ7QBZdSx2h5fSgSSgioz cOjLCRnlQHqoGSBKeGotquZACg== X-Google-Smtp-Source: ABdhPJxNuI3ERXYRpnzr4/J9SjxQvf1b67HRFwVVZg0gBjAMx+QRNYNKMmLZQSvV0Y5q015fJ9moDw== X-Received: by 2002:a17:90a:2224:: with SMTP id c33mr5954377pje.56.1596681688127; Wed, 05 Aug 2020 19:41:28 -0700 (PDT) Received: from localhost ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id r28sm5279479pfg.158.2020.08.05.19.41.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 19:41:27 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Nick Desaulniers , "Naveen N. Rao" , Ian Rogers , Kemeng Shi , James Clark , Wei Li , Adrian Hunter , Al Grant , linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 05/11] perf mem: Support AUX trace Date: Thu, 6 Aug 2020 10:40:35 +0800 Message-Id: <20200806024041.27475-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806024041.27475-1-leo.yan@linaro.org> References: <20200806024041.27475-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Perf memory profiling doesn't support aux trace data so the tool cannot receive the synthesized samples from hardware tracing data. On the Arm64 platform, though it doesn't support PMU events for memory load and store, but Armv8's SPE is a good candidate for memory profiling, the hardware tracer can record memory accessing operations with physical address and virtual address for different cache level and it also stats the memory operations for remote access and TLB. To allow the perf memory tool to support AUX trace, this patches adds the aux callbacks for session structure. It passes the predefined synth options (like llc, flc, remote_access, tlb, etc) so this notifies the tracing decoder to generate corresponding samples. This patch also invokes the standard API perf_event__process_attr() to register sample IDs into evlist. Signed-off-by: Leo Yan --- tools/perf/builtin-mem.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index a7204634893c..6c8b5e956a4a 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -7,6 +7,7 @@ #include "perf.h" #include +#include "util/auxtrace.h" #include "util/trace-event.h" #include "util/tool.h" #include "util/session.h" @@ -249,6 +250,15 @@ static int process_sample_event(struct perf_tool *tool, static int report_raw_events(struct perf_mem *mem) { + struct itrace_synth_opts itrace_synth_opts = { + .set = true, + .flc = true, /* First level cache samples */ + .llc = true, /* Last level cache samples */ + .tlb = true, /* TLB samples */ + .remote_access = true, /* Remote access samples */ + .default_no_sample = true, + }; + struct perf_data data = { .path = input_name, .mode = PERF_DATA_MODE_READ, @@ -261,6 +271,8 @@ static int report_raw_events(struct perf_mem *mem) if (IS_ERR(session)) return PTR_ERR(session); + session->itrace_synth_opts = &itrace_synth_opts; + if (mem->cpu_list) { ret = perf_session__cpu_bitmap(session, mem->cpu_list, mem->cpu_bitmap); @@ -394,6 +406,19 @@ parse_mem_ops(const struct option *opt, const char *str, int unset) return ret; } +static int process_attr(struct perf_tool *tool __maybe_unused, + union perf_event *event, + struct evlist **pevlist) +{ + int err; + + err = perf_event__process_attr(tool, event, pevlist); + if (err) + return err; + + return 0; +} + int cmd_mem(int argc, const char **argv) { struct stat st; @@ -405,8 +430,12 @@ int cmd_mem(int argc, const char **argv) .comm = perf_event__process_comm, .lost = perf_event__process_lost, .fork = perf_event__process_fork, + .attr = process_attr, .build_id = perf_event__process_build_id, .namespaces = perf_event__process_namespaces, + .auxtrace_info = perf_event__process_auxtrace_info, + .auxtrace = perf_event__process_auxtrace, + .auxtrace_error = perf_event__process_auxtrace_error, .ordered_events = true, }, .input_name = "perf.data", -- 2.17.1