Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf mem/c2c: Set PERF_SAMPLE_WEIGHT for LOAD_STORE events

Currently perf sets PERF_SAMPLE_WEIGHT flag only for mem load events.
Set it for combined load-store event as well which will enable recording
of load latency by default on arch that does not support independent
mem load event.

Also document missing -W in perf-record man page.

Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Ananth Narayan <ananth.narayan@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Kim Phillips <kim.phillips@amd.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Santosh Shukla <santosh.shukla@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Link: https://lore.kernel.org/r/20221006153946.7816-5-ravi.bangoria@amd.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ravi Bangoria and committed by
Arnaldo Carvalho de Melo
4173cc05 923396f6

+3
+1
tools/perf/Documentation/perf-record.txt
··· 411 411 The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k 412 412 Note that this feature may not be available on all processors. 413 413 414 + -W:: 414 415 --weight:: 415 416 Enable weightened sampling. An additional weight is recorded per sample and can be 416 417 displayed with the weight and local_weight sort keys. This currently works for TSX
+1
tools/perf/builtin-c2c.c
··· 3281 3281 */ 3282 3282 if (e->tag) { 3283 3283 e->record = true; 3284 + rec_argv[i++] = "-W"; 3284 3285 } else { 3285 3286 e = perf_mem_events__ptr(PERF_MEM_EVENTS__LOAD); 3286 3287 e->record = true;
+1
tools/perf/builtin-mem.c
··· 122 122 (mem->operation & MEM_OPERATION_LOAD) && 123 123 (mem->operation & MEM_OPERATION_STORE)) { 124 124 e->record = true; 125 + rec_argv[i++] = "-W"; 125 126 } else { 126 127 if (mem->operation & MEM_OPERATION_LOAD) { 127 128 e = perf_mem_events__ptr(PERF_MEM_EVENTS__LOAD);