perf: Add new conditional branch filter PERF_SAMPLE_BRANCH_COND
Subsystems (2)
PATCH v6 1/4 perf: Add new conditional branch filter PERF_SAMPLE_BRANCH_COND
This patch introduces new branch filter PERF_SAMPLE_BRANCH_COND which will extend the existing perf ABI. This will filter branches which are conditional. Various architectures can provide this functionality either with HW filtering support (if present) or with SW filtering of captured branch instructions.
--- include/uapi/linux/perf_event.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/perf_event.h +2 -1
@@ -163,8 +163,9 @@ enum perf_branch_sample_type {PERF_SAMPLE_BRANCH_ABORT_TX =1U <<7 ,/* transaction aborts */ PERF_SAMPLE_BRANCH_IN_TX =1U <<8 ,/* in transaction */ PERF_SAMPLE_BRANCH_NO_TX =1U <<9 ,/* not in transaction */ +PERF_SAMPLE_BRANCH_COND =1U <<10 ,/* conditional branches */ - PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */ + PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */ };#define PERF_SAMPLE_BRANCH_PLM_ALL \
Signature · 1 line
1.7.11.7
PATCH v6 2/4 perf, tool: Conditional branch filter 'cond' added to perf record
Adding perf record support for new branch stack filter criteria PERF_SAMPLE_BRANCH_COND.
--- tools/perf/builtin-record.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-record.c +1 -0
@@ -583,6 +583,7 @@ static const struct branch_mode branch_modes[] = {BRANCH_OPT ("abort_tx" ,PERF_SAMPLE_BRANCH_ABORT_TX ),BRANCH_OPT ("in_tx" ,PERF_SAMPLE_BRANCH_IN_TX ),BRANCH_OPT ("no_tx" ,PERF_SAMPLE_BRANCH_NO_TX ), +BRANCH_OPT ("cond" ,PERF_SAMPLE_BRANCH_COND ), BRANCH_END };
Signature · 1 line
1.7.11.7
tip-bot for Anshuman Khandual
merge bot[tip:perf/core] perf/tool: Add conditional branch filter 'cond' to perf record
perf/tool: Add conditional branch filter 'cond' to perf record
Commit-ID: 0fffa5df4cf3e22be4f40f6698ab9e49f3ffd6fa Gitweb: http://git.kernel.org/tip/0fffa5df4cf3e22be4f40f6698ab9e49f3ffd6fa Author: Anshuman Khandual <[email protected]> AuthorDate: Thu, 22 May 2014 12:50:08 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 5 Jun 2014 12:30:19 +0200
perf/tool: Add conditional branch filter 'cond' to perf record
Adding perf record support for new branch stack filter criteria PERF_SAMPLE_BRANCH_COND.
--- tools/perf/builtin-record.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-record.c +1 -0
@@ -548,6 +548,7 @@ static const struct branch_mode branch_modes[] = {BRANCH_OPT ("abort_tx" ,PERF_SAMPLE_BRANCH_ABORT_TX ),BRANCH_OPT ("in_tx" ,PERF_SAMPLE_BRANCH_IN_TX ),BRANCH_OPT ("no_tx" ,PERF_SAMPLE_BRANCH_NO_TX ), +BRANCH_OPT ("cond" ,PERF_SAMPLE_BRANCH_COND ), BRANCH_END };
PATCH v6 3/4 x86, perf: Add conditional branch filtering support
In reply to Anshuman KhandualThis patch adds conditional branch filtering support, enabling it for PERF_SAMPLE_BRANCH_COND in perf branch stack sampling framework by utilizing an available software filter X86_BR_JCC.
--- arch/x86/kernel/cpu/perf_event_intel_lbr.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/cpu/perf_event_intel_lbr.c +5 -0
@@ -384,6 +384,9 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)if (br_type &PERF_SAMPLE_BRANCH_NO_TX ) mask |=X86_BR_NO_TX ; +if (br_type &PERF_SAMPLE_BRANCH_COND ) + mask |=X86_BR_JCC ; +/* * stash actual user request into reg, it may * be used by fixup code for some CPU
@@ -678,6 +681,7 @@ static const int nhm_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {* NHM/WSM erratum: must include IND_JMP to capture IND_CALL */ [PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL | LBR_IND_JMP, + [PERF_SAMPLE_BRANCH_COND] = LBR_JCC, };static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX ] = {
@@ -689,6 +693,7 @@ static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = { [PERF_SAMPLE_BRANCH_ANY_CALL ] =LBR_REL_CALL |LBR_IND_CALL | LBR_FAR, [PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL, + [PERF_SAMPLE_BRANCH_COND] = LBR_JCC, };/* core */
Signature · 1 line
1.7.11.7
tip-bot for Anshuman Khandual
merge bot[tip:perf/core] perf/x86: Add conditional branch filtering support
perf/x86: Add conditional branch filtering support
Commit-ID: 37548914fbfcd56e1955a9b7e55dc3b84a3e9e25 Gitweb: http://git.kernel.org/tip/37548914fbfcd56e1955a9b7e55dc3b84a3e9e25 Author: Anshuman Khandual <[email protected]> AuthorDate: Thu, 22 May 2014 12:50:09 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 5 Jun 2014 12:30:23 +0200
perf/x86: Add conditional branch filtering support
This patch adds conditional branch filtering support, enabling it for PERF_SAMPLE_BRANCH_COND in perf branch stack sampling framework by utilizing an available software filter X86_BR_JCC.
--- arch/x86/kernel/cpu/perf_event_intel_lbr.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/cpu/perf_event_intel_lbr.c +5 -0
@@ -384,6 +384,9 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)if (br_type &PERF_SAMPLE_BRANCH_NO_TX ) mask |=X86_BR_NO_TX ; +if (br_type &PERF_SAMPLE_BRANCH_COND ) + mask |=X86_BR_JCC ; +/* * stash actual user request into reg, it may * be used by fixup code for some CPU
@@ -678,6 +681,7 @@ static const int nhm_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {* NHM/WSM erratum: must include IND_JMP to capture IND_CALL */ [PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL | LBR_IND_JMP, + [PERF_SAMPLE_BRANCH_COND] = LBR_JCC, };static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX ] = {
@@ -689,6 +693,7 @@ static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = { [PERF_SAMPLE_BRANCH_ANY_CALL ] =LBR_REL_CALL |LBR_IND_CALL | LBR_FAR, [PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL, + [PERF_SAMPLE_BRANCH_COND] = LBR_JCC, };/* core */
PATCH v6 4/4 perf, documentation: Description for conditional branch filter
In reply to Anshuman KhandualAdding documentation support for conditional branch filter.
--- tools/perf/Documentation/perf-record.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-record.txt +2 -1
@@ -184,9 +184,10 @@ following filters are defined: - in_tx: only when the target is in a hardware transaction - no_tx: only when the target is not in a hardware transaction - abort_tx: only when the target is a hardware transaction abort + - cond: conditional branches + -The option requires at least one branch type among any, any_call, any_ret, ind_call. +The option requires at least one branch type among any, any_call, any_ret, ind_call, cond. The privilege levels may be omitted, in which case, the privilege levels of the associated event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege levels are subject to permissions. When sampling on multiple events, branch stack sampling
Signature · 1 line
1.7.11.7
tip-bot for Anshuman Khandual
merge bot[tip:perf/core] perf/documentation: Add description for conditional branch filter
perf/documentation: Add description for conditional branch filter
Commit-ID: 3e39db4ae2a92ae9e338e8066411b694b0edcb31 Gitweb: http://git.kernel.org/tip/3e39db4ae2a92ae9e338e8066411b694b0edcb31 Author: Anshuman Khandual <[email protected]> AuthorDate: Thu, 22 May 2014 12:50:10 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 5 Jun 2014 12:30:27 +0200
perf/documentation: Add description for conditional branch filter
--- tools/perf/Documentation/perf-record.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-record.txt +2 -1
@@ -184,9 +184,10 @@ following filters are defined: - in_tx: only when the target is in a hardware transaction - no_tx: only when the target is not in a hardware transaction - abort_tx: only when the target is a hardware transaction abort + - cond: conditional branches + -The option requires at least one branch type among any, any_call, any_ret, ind_call. +The option requires at least one branch type among any, any_call, any_ret, ind_call, cond. The privilege levels may be omitted, in which case, the privilege levels of the associated event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege levels are subject to permissions. When sampling on multiple events, branch stack sampling
tip-bot for Anshuman Khandual
merge bot[tip:perf/core] perf: Add new conditional branch filter ' PERF_SAMPLE_BRANCH_COND'
In reply to Anshuman Khandualperf: Add new conditional branch filter 'PERF_SAMPLE_BRANCH_COND'
Commit-ID: bac52139f0b7ab31330e98fd87fc5a2664951050 Gitweb: http://git.kernel.org/tip/bac52139f0b7ab31330e98fd87fc5a2664951050 Author: Anshuman Khandual <[email protected]> AuthorDate: Thu, 22 May 2014 12:50:07 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 5 Jun 2014 12:30:15 +0200
perf: Add new conditional branch filter 'PERF_SAMPLE_BRANCH_COND'
This patch introduces new branch filter PERF_SAMPLE_BRANCH_COND which will extend the existing perf ABI. This will filter branches which are conditional. Various architectures can provide this functionality either with HW filtering support (if present) or with SW filtering of captured branch instructions.
--- include/uapi/linux/perf_event.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/perf_event.h +2 -1
@@ -163,8 +163,9 @@ enum perf_branch_sample_type {PERF_SAMPLE_BRANCH_ABORT_TX =1U <<7 ,/* transaction aborts */ PERF_SAMPLE_BRANCH_IN_TX =1U <<8 ,/* in transaction */ PERF_SAMPLE_BRANCH_NO_TX =1U <<9 ,/* not in transaction */ +PERF_SAMPLE_BRANCH_COND =1U <<10 ,/* conditional branches */ - PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */ + PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */ };#define PERF_SAMPLE_BRANCH_PLM_ALL \