From patchwork Fri Nov 6 09:48:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 11886677 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 D0EE9C2D0A3 for ; Fri, 6 Nov 2020 09:53:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DFDF2087E for ; Fri, 6 Nov 2020 09:53:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D+b4pi9T"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zFFNR1KN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DFDF2087E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NH0/Aze03IqHeeW7YHx9J3OFdT+708cv4oQe6zlehzc=; b=D+b4pi9T4Zeou9rSEr3uFvzSpw QU2DPpc1lmP/y36h9as0s9k01UeVpCR04imm+YtCLoSzniDfWzxD6AnQAl+CECObDSfj9Jv3n/NzV a4hFrE40pCm3odUjCbd4ZRQEaieluzC5vO+Kot3X3DpA87aZYWMK734nrQIntzFPNxVO15aqdFZB3 yEDFvJfgxEwIuYP8ISJ4VQGT/Sa6CxxlaKo9W8zRxSksgoCeR59z8A9UFjyfRaFSjo5N5aFZVhQVf IjY/RgJq0sU/HIEuEWfKt2DeS5gkAx/M15IlvX7XvSYMMlrH95pstVd6dh9iwpqcmZZCcvx6rwwM6 xPtCvU3Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayPm-00006e-L7; Fri, 06 Nov 2020 09:52:14 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayNh-0007Xl-55 for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2020 09:50:06 +0000 Received: by mail-pl1-x642.google.com with SMTP id u2so415143pls.10 for ; Fri, 06 Nov 2020 01:50:01 -0800 (PST) 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=7f0Xbxp0l73CuXczuH9NbSRse7uN6mi3bE07Itm9aPI=; b=zFFNR1KN2QlUPHVWR6Bjs4PbEW3xToifk2UhHKY6vBbX8e6VFqmElcGRzGufKq+5Us IxFbi6zgFsA5eCV9S3Y2iFUUGmcNRMttb/6OmuNr5fwa47KH5AHwgWqbXXc6FVYszxHO cC4Q51FPBYgvo3LJEBMMYeEMLHg52f171tZo6n4vVxfvYeIJnBjIzb78nF6CklV5SR7D GB299YTnIUpE0/4WExrNN4xAGRHHvSc4KVpX/WAM5+6q1ode6ruZPVjO7OPQ4sUrO8sJ 1eFwUczb1kuXeXYQgqHpXFhyaZz8W8wkJDGLB8gATudTp+r2SC0x1NS3HlNj10d6KHWX UiSQ== 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=7f0Xbxp0l73CuXczuH9NbSRse7uN6mi3bE07Itm9aPI=; b=oxbm/LPLeAe+T/7Gy/MZ+d3z+WQC9vB2exPbs0KAjMot3/AwNHxou/ZFspLZgVWMqy FYqMSdX32qdQwD1m5gAyB1NaHpjROjfgTRx1Qy+uATX4I5wwmTm6oWyAQTGaJWRt+4GI 33oMgNLJJe2Gl2OWKLUhTGfs6D4zTvMQpZnPTHcMBFuc+CdBs/Eg4TtULU4sfhpyoD0c /IV+wVIa/zRLiLjarR/x/qMlWMTWt073iMOsdLKaMgW31sAVXuaHBMmeTaNmd8m3VxYK GKRv1iJ+fSWfIXNVNdecGk4GYMPcHciWsQq2coEKhDE3S6nGjw6avsSftiYld93mC77p l6+g== X-Gm-Message-State: AOAM531yh/CcgfdhjjSQ5kBbIg6Wkn5DdBckic0CLn4E5SJOyZwY+87Y y+vvx+oFrIx2xbTPXJ9bl5LyXA== X-Google-Smtp-Source: ABdhPJyZY9T7mOxSSsA5QwOWZe8P1lSV1dNtbi2VzATehH/0vFnnhUkJJmhqdylvS8v8kMMdHJS7VA== X-Received: by 2002:a17:902:b789:b029:d6:d543:bd14 with SMTP id e9-20020a170902b789b02900d6d543bd14mr1269444pls.16.1604656199457; Fri, 06 Nov 2020 01:49:59 -0800 (PST) Received: from localhost ([2400:8904::f03c:91ff:fe8a:adf7]) by smtp.gmail.com with ESMTPSA id w22sm1230549pge.25.2020.11.06.01.49.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Nov 2020 01:49:58 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Jiri Olsa , Ian Rogers , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , John Garry , Will Deacon , Mathieu Poirier , Adrian Hunter , Andi Kleen , Kemeng Shi , Sergey Senozhatsky , Al Grant , James Clark , Wei Li , Andre Przywara , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 7/9] perf mem: Support AUX trace Date: Fri, 6 Nov 2020 17:48:51 +0800 Message-Id: <20201106094853.21082-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106094853.21082-1-leo.yan@linaro.org> References: <20201106094853.21082-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_045005_300955_3EF8CCC8 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Perf memory tool doesn't support AUX trace data so it cannot receive the hardware tracing data. On Arm64, although it doesn't support PMU events for memory load and store, but Arm SPE is a good candidate for memory profiling, the hardware tracer can record memory accessing operations with affiliated information (e.g. physical address and virtual address for accessing, cache levels, TLB walking, latency, etc). To allow "perf mem" tool to support AUX trace, this patch adds the AUX callbacks for session structure; make itrace memory event as default for "perf mem", this tells the AUX trace decoder to synthesize memory samples. Signed-off-by: Leo Yan --- tools/perf/builtin-mem.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 72ce4b8fbb0f..fdfbff7592f4 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" @@ -255,6 +256,12 @@ 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, + .mem = true, /* Only enable memory event */ + .default_no_sample = true, + }; + struct perf_data data = { .path = input_name, .mode = PERF_DATA_MODE_READ, @@ -267,6 +274,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); @@ -410,8 +419,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 = perf_event__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",