Skip to contentSkip to conversation

x86/events/intel/ds: Enable large PEBS for PERF_SAMPLE_WEIGHT_TYPE

PATCH Applied Like Xu 3 participants 3 messages May 19, 2022 – Jun 13, 2022

Subsystems (2)
lore
Share & tools
lore

Like Xu

author
#0 lore raw

PATCH v2 1/1 x86/events/intel/ds: Enable large PEBS for PERF_SAMPLE_WEIGHT_TYPE

From: Like Xu <[email protected]>

All the information required by the PERF_SAMPLE_WEIGHT is available in the pebs record. Thus large PEBS could be enabled for PERF_SAMPLE_WEIGHT sample type to save PMIs overhead until other non-compatible flags such as PERF_SAMPLE_DATA_PAGE_SIZE (due to lack of munmap tracking) stop it.

To cover new weight extension, add PERF_SAMPLE_WEIGHT_TYPE to the guardian LARGE_PEBS_FLAGS.

Tested it with:

$ perf mem record -c 1000 workload
Before: Captured and wrote 0.126 MB perf.data (958 samples) [958 PMIs]
After: Captured and wrote 0.313 MB perf.data (4859 samples) [3 PMIs]
Cc Kan Liang <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Jiri Olsa <[email protected]>

---
v1: https://lore.kernel.org/lkml/[email protected]/
v1 -> v2 Changelog:
- Use the PERF_SAMPLE_WEIGHT_TYPE instead (Kan);

 arch/x86/events/perf_event.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/perf_event.h +2 -1
index 21a5482bcf84..1ca6200ca135 100644
@@ -136,7 +136,8 @@ struct amd_nb {
 	PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \
 	PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \
 	PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
-	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE)
+	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE | \
+	PERF_SAMPLE_WEIGHT_TYPE)
 
 #define PEBS_GP_REGS			\
 	((1ULL << PERF_REG_X86_AX)    | \
Signature · 1 line
2.36.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 lines · Like Xu

From: Like Xu <[email protected]>

All the information required by the PERF_SAMPLE_WEIGHT is available in the pebs record. Thus large PEBS could be enabled for PERF_SAMPLE_WEIGHT sample type to save PMIs overhead until other non-compatible flags such as PERF_SAMPLE_DATA_PAGE_SIZE (due to lack of munmap tracking) stop it.

To cover new weight extension, add PERF_SAMPLE_WEIGHT_TYPE to the guardian LARGE_PEBS_FLAGS.

Tested it with:

$ perf mem record -c 1000 workload
Before: Captured and wrote 0.126 MB perf.data (958 samples) [958 PMIs]
After: Captured and wrote 0.313 MB perf.data (4859 samples) [3 PMIs]
Quoted 5 lines
Cc Kan Liang <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Jiri Olsa <[email protected]>

Thanks,
Kan

Quoted 22 lines

---
v1: https://lore.kernel.org/lkml/[email protected]/
v1 -> v2 Changelog:
- Use the PERF_SAMPLE_WEIGHT_TYPE instead (Kan);

  arch/x86/events/perf_event.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/perf_event.h +2 -1
index 21a5482bcf84..1ca6200ca135 100644
@@ -136,7 +136,8 @@ struct amd_nb {
  	PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \
  	PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \
  	PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
-	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE)
+	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE | \
+	PERF_SAMPLE_WEIGHT_TYPE)
 
  #define PEBS_GP_REGS			\
  	((1ULL << PERF_REG_X86_AX)    | \
merge bot Applied
#2 lore raw
In reply to Like Xu
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     e60b7cb089f216a26d478f5ad8f811a1de65f382
Gitweb:        https://git.kernel.org/tip/e60b7cb089f216a26d478f5ad8f811a1de65f382
Author:        Like Xu <[email protected]>
AuthorDate:    Thu, 19 May 2022 23:19:13 +08:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Mon, 13 Jun 2022 10:15:13 +02:00

x86/events/intel/ds: Enable large PEBS for PERF_SAMPLE_WEIGHT_TYPE

All the information required by the PERF_SAMPLE_WEIGHT is available in the pebs record. Thus large PEBS could be enabled for PERF_SAMPLE_WEIGHT sample type to save PMIs overhead until other non-compatible flags such as PERF_SAMPLE_DATA_PAGE_SIZE (due to lack of munmap tracking) stop it.

To cover new weight extension, add PERF_SAMPLE_WEIGHT_TYPE to the guardian LARGE_PEBS_FLAGS.

Tested it with:

$ perf mem record -c 1000 workload
Before: Captured and wrote 0.126 MB perf.data (958 samples) [958 PMIs]
After: Captured and wrote 0.313 MB perf.data (4859 samples) [3 PMIs]
---
 arch/x86/events/perf_event.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/perf_event.h +2 -1
index 21a5482..1ca6200 100644
@@ -136,7 +136,8 @@ struct amd_nb {
 	PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \
 	PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \
 	PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
-	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE)
+	PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE | \
+	PERF_SAMPLE_WEIGHT_TYPE)
 
 #define PEBS_GP_REGS			\
 	((1ULL << PERF_REG_X86_AX)    | \