Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp76625imm; Fri, 10 Aug 2018 07:53:36 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxXTAJ1hJvxFPrzf9JisvBN6XzBKtfCVTi/o9R0uprD9QJi+jSIjTDyPQdmW8be5OrCzbPr X-Received: by 2002:a63:5d09:: with SMTP id r9-v6mr6702960pgb.303.1533912816120; Fri, 10 Aug 2018 07:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533912816; cv=none; d=google.com; s=arc-20160816; b=lOMavvJbVH6/zgcFIUxAEj2S8CgOnyDCAy0UVxOqbuIWd7w2EwXBsBqvY1OypWKA6+ nfUXEXnlLYKShQn5vRGZfB0DNOLQxOfGwtOKALj+uF20+QzH4BgTJAm0NgjCjAkesS+v fVUhRZVC8SBUdXuJZy1+qe7AXqzhPX+fsaZAmfopwuc/iABQDsOGcUlA7gqtv6M5PKS2 b7Fb1c6shCWCxU+XT1TidPvKqnmZB1TNcvHHz/RhDXWFF7gkPXKCZ8hBFVcwQSeCcKL6 xfOQFbhZhmk8O9wnw2LInfWdwVK7cZCcU/WlAvYdosAdIraY4EI91YqiNFc7Z3Vkqdl5 EsJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=aHnPCANa9ROHtrWsCessFdNGJJX7atRt7KBTvWIah1g=; b=W+YkZCJQ9MfapwA5YETrUYY4xWgQ7rWQlwHt7CVZBKjGM2LTZPJjI2UYLttqpzAc0h ykqxaY7XcTLsHbwzHwngAZSQ/tb8beZOR55UWn5f+dxkkPIMmbjlrxvduc0DSF2zsX9h eb6o/gwMmN96OrJM8cEHFGyMF/squYhSSNHehxeqSaNTk2185ZCPsC95dVrFNYvSAkMc 4NhC0UtXv1SMgV5SFwoqjiZPBExArVxx9QHVJ6lcavJKNr/3os/QWU7hYzOEmavtWlyZ B+9ZhTr4WOYXBTMRwGFimELKm9urFKT2KkVMcZljZkowaH+sCvFcaHJIRPsDn3HzYDqT qZ9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8-v6si10442288pgj.33.2018.08.10.07.53.21; Fri, 10 Aug 2018 07:53:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729180AbeHJQIB (ORCPT + 99 others); Fri, 10 Aug 2018 12:08:01 -0400 Received: from mga12.intel.com ([192.55.52.136]:31368 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728089AbeHJQIA (ORCPT ); Fri, 10 Aug 2018 12:08:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Aug 2018 06:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,219,1531810800"; d="scan'208";a="80633160" Received: from otc-lr-04.jf.intel.com ([10.54.39.114]) by orsmga001.jf.intel.com with ESMTP; 10 Aug 2018 06:37:59 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@kernel.org, tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: eranian@google.com, jolsa@redhat.com, namhyung@kernel.org, ak@linux.intel.com, Kan Liang Subject: [PATCH RFC 6/7] perf mem: Support page size Date: Fri, 10 Aug 2018 06:36:26 -0700 Message-Id: <1533908187-25204-6-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533908187-25204-1-git-send-email-kan.liang@linux.intel.com> References: <1533908187-25204-1-git-send-email-kan.liang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang Add option --page-size in "perf mem" to record/report page size. Here are some examples. perf mem --phys-data --page-size report -D # PID, TID, IP, ADDR, PHYS ADDR, PAGE SIZE, LOCAL WEIGHT, DSRC, SYMBOL 20134 20134 0xffffffffb5bd2fd0 0x016ffff9a274e96a308 0x000000044e96a308 4K 1168 0x5080144 /lib/modules/4.18.0-rc7+/build/vmlinux:perf_ctx_unlock 20134 20134 0xffffffffb63f645c 0xffffffffb752b814 0xcfb52b814 2M 225 0x26a100142 /lib/modules/4.18.0-rc7+/build/vmlinux:_raw_spin_lock 20134 20134 0xffffffffb660300c 0xfffffe00016b8bb0 0x0 4K 0 0x5080144 /lib/modules/4.18.0-rc7+/build/vmlinux:__x86_indirect_thunk_rax perf mem --phys-data --page-size report --stdio # To display the perf.data header info, please use # --header/--header-only options. # # # Total Lost Samples: 0 # # Samples: 5K of event 'cpu/mem-loads,ldlat=30/P' # Total weight : 281234 # Sort order : # mem,sym,dso,symbol_daddr,dso_daddr,tlb,locked,phys_daddr,page_size # # Overhead Samples Memory access Symbol # Shared Object Data Symbol Data # Object TLB access Locked Data Physical # Address Page Size # ........ ............ ........................ # ................................ ................ # ........................................... ....................... # ...................... ...... ...................... # ...................... # 28.54% 1826 L1 or L1 hit [k] __x86_indirect_thunk_rax [kernel.vmlinux] [k] 0xffffb0df31b0ff28 [unknown] L1 or L2 hit No [k] 0000000000000000 4K 6.02% 256 L1 or L1 hit [.] touch_buffer dtlb [.] 0x00007ffd50109da8 [stack] L1 or L2 hit No [.] 0x000000042454ada8 4K 3.23% 5 L1 or L1 hit [k] clear_huge_page [kernel.vmlinux] [k] 0xffff9a2753b8ce60 [unknown] L1 or L2 hit No [k] 0x0000000453b8ce60 2M 2.98% 4 L1 or L1 hit [k] clear_page_erms [kernel.vmlinux] [k] 0xffffb0df31b0fd00 [unknown] L1 or L2 hit No [k] 0000000000000000 4K Signed-off-by: Kan Liang --- tools/perf/Documentation/perf-mem.txt | 4 ++++ tools/perf/builtin-mem.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt index f8d2167..1708689 100644 --- a/tools/perf/Documentation/perf-mem.txt +++ b/tools/perf/Documentation/perf-mem.txt @@ -63,6 +63,10 @@ OPTIONS --phys-data:: Record/Report sample physical addresses +-s:: +--page-size:: + Record/Report sample page size + RECORD OPTIONS -------------- -e:: diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 6048fca..0dad6c2 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -26,6 +26,7 @@ struct perf_mem { bool dump_raw; bool force; bool phys_addr; + bool page_size; int operation; const char *cpu_list; DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); @@ -107,6 +108,9 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) if (mem->phys_addr) rec_argv[i++] = "--phys-data"; + if (mem->phys_addr) + rec_argv[i++] = "--page-size"; + for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) { if (!perf_mem_events[j].record) continue; @@ -195,6 +199,12 @@ dump_raw_samples(struct perf_tool *tool, symbol_conf.field_sep); } + if (mem->page_size) { + printf("%s%s", + get_page_size_name(sample->page_size), + symbol_conf.field_sep); + } + if (field_sep) fmt = "%"PRIu64"%s0x%"PRIx64"%s%s:%s\n"; else @@ -253,6 +263,9 @@ static int report_raw_events(struct perf_mem *mem) if (mem->phys_addr) printf("PHYS ADDR, "); + if (mem->page_size) + printf("PAGE SIZE, "); + printf("LOCAL WEIGHT, DSRC, SYMBOL\n"); ret = perf_session__process_events(session); @@ -277,6 +290,9 @@ static char *get_sort_order(struct perf_mem *mem) if (mem->phys_addr) strcat(sort, ",phys_daddr"); + if (mem->page_size) + strcat(sort, ",page_size"); + return strdup(sort); } @@ -418,6 +434,7 @@ int cmd_mem(int argc, const char **argv) " between columns '.' is reserved."), OPT_BOOLEAN('f', "force", &mem.force, "don't complain, do it"), OPT_BOOLEAN('p', "phys-data", &mem.phys_addr, "Record/Report sample physical addresses"), + OPT_BOOLEAN('s', "page-size", &mem.page_size, "Record/Report sample page size"), OPT_END() }; const char *const mem_subcommands[] = { "record", "report", NULL }; -- 2.7.4