linux-stable/arch/powerpc/perf
Kan Liang 2a6c6b7d7a perf/core: Add PERF_SAMPLE_WEIGHT_STRUCT
Current PERF_SAMPLE_WEIGHT sample type is very useful to expresses the
cost of an action represented by the sample. This allows the profiler
to scale the samples to be more informative to the programmer. It could
also help to locate a hotspot, e.g., when profiling by memory latencies,
the expensive load appear higher up in the histograms. But current
PERF_SAMPLE_WEIGHT sample type is solely determined by one factor. This
could be a problem, if users want two or more factors to contribute to
the weight. For example, Golden Cove core PMU can provide both the
instruction latency and the cache Latency information as factors for the
memory profiling.

For current X86 platforms, although meminfo::latency is defined as a
u64, only the lower 32 bits include the valid data in practice (No
memory access could last than 4G cycles). The higher 32 bits can be used
to store new factors.

Add a new sample type, PERF_SAMPLE_WEIGHT_STRUCT, to indicate the new
sample weight structure. It shares the same space as the
PERF_SAMPLE_WEIGHT sample type.

Users can apply either the PERF_SAMPLE_WEIGHT sample type or the
PERF_SAMPLE_WEIGHT_STRUCT sample type to retrieve the sample weight, but
they cannot apply both sample types simultaneously.

Currently, only X86 and PowerPC use the PERF_SAMPLE_WEIGHT sample type.
- For PowerPC, there is nothing changed for the PERF_SAMPLE_WEIGHT
  sample type. There is no effect for the new PERF_SAMPLE_WEIGHT_STRUCT
  sample type. PowerPC can re-struct the weight field similarly later.
- For X86, the same value will be dumped for the PERF_SAMPLE_WEIGHT
  sample type or the PERF_SAMPLE_WEIGHT_STRUCT sample type for now.
  The following patches will apply the new factors for the
  PERF_SAMPLE_WEIGHT_STRUCT sample type.

The field in the union perf_sample_weight should be shared among
different architectures. A generic name is required, but it's hard to
abstract a name that applies to all architectures. For example, on X86,
the fields are to store all kinds of latency. While on PowerPC, it
stores MMCRA[TECX/TECM], which should not be latency. So a general name
prefix 'var$NUM' is used here.

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1611873611-156687-2-git-send-email-kan.liang@linux.intel.com
2021-02-01 15:31:36 +01:00
..
req-gen powerpc: clean the inclusion of stringify.h 2018-07-30 22:48:17 +10:00
8xx-pmu.c powerpc/ppc-opcode: Add PPC_RAW_MFSPR() 2020-12-09 23:48:13 +11:00
bhrb.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
callchain.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
callchain.h powerpc/64s/perf: perf interrupt does not have to get_user_pages to access user memory 2020-11-19 16:56:52 +11:00
callchain_32.c powerpc/vdso: Retrieve sigtramp offsets at buildtime 2020-12-04 01:01:17 +11:00
callchain_64.c powerpc/vdso: Retrieve sigtramp offsets at buildtime 2020-12-04 01:01:17 +11:00
core-book3s.c perf/core: Add PERF_SAMPLE_WEIGHT_STRUCT 2021-02-01 15:31:36 +01:00
core-fsl-emb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
e500-pmu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
e6500-pmu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
generic-compat-pmu.c powerpc/perf: Update Power PMU cache_events to u64 type 2020-07-22 21:56:40 +10:00
hv-24x7-catalog.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-24x7-domains.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-24x7.c powerpc/perf/hv-24x7: Move cpumask file to top folder of hv-24x7 driver 2020-08-21 23:35:27 +10:00
hv-24x7.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-gpci-requests.h powerpc/perf/hv-gpci: Fix starting index value 2020-10-07 22:34:48 +11:00
hv-gpci.c powerpc/hv-gpci: Add sysfs files inside hv-gpci device to show cpumask 2020-10-07 22:34:49 +11:00
hv-gpci.h powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h 2020-09-02 11:00:20 +10:00
imc-pmu.c powerpc: fix -Wimplicit-fallthrough 2020-11-18 14:18:09 -06:00
internal.h powerpc/perf: power10 Performance Monitoring support 2020-07-22 21:56:41 +10:00
isa207-common.c powerpc/perf: Fix Threshold Event Counter Multiplier width for P10 2020-12-15 22:50:04 +11:00
isa207-common.h powerpc/perf: Fix Threshold Event Counter Multiplier width for P10 2020-12-15 22:50:04 +11:00
Makefile powerpc/perf: power10 Performance Monitoring support 2020-07-22 21:56:41 +10:00
mpc7450-pmu.c powerpc/perf: Update Power PMU cache_events to u64 type 2020-07-22 21:56:40 +10:00
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
power5+-pmu.c powerpc/perf: Add declarations to fix sparse warnings 2020-09-18 19:59:43 +10:00
power5-pmu.c powerpc/perf: Add declarations to fix sparse warnings 2020-09-18 19:59:43 +10:00
power6-pmu.c powerpc/perf: Add declarations to fix sparse warnings 2020-09-18 19:59:43 +10:00
power7-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power7-pmu.c powerpc/perf: Add declarations to fix sparse warnings 2020-09-18 19:59:43 +10:00
power8-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power8-pmu.c powerpc/perf: Update Power PMU cache_events to u64 type 2020-07-22 21:56:40 +10:00
power9-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power9-pmu.c powerpc/perf: Add support for outputting extended regs in perf intr_regs 2020-08-17 13:11:22 +10:00
power10-events-list.h powerpc/perf: Fix to update cache events with l2l3 events in power10 2020-12-04 01:01:29 +11:00
power10-pmu.c powerpc/perf: Fix to update cache events with l2l3 events in power10 2020-12-04 01:01:29 +11:00
ppc970-pmu.c powerpc/perf: Add declarations to fix sparse warnings 2020-09-18 19:59:43 +10:00