selftests/powerpc/pmu: Fix sample field check in the mmcra_thresh_marked_sample_test
PATCH 1/2 selftests/powerpc/pmu: Fix sample field check in the mmcra_thresh_marked_sample_test
The testcase verifies the setting of different fields in Monitor Mode Control Register A (MMCRA). In the current code, EV_CODE_EXTRACT macro is used to extract the "sample" field, which then needs to be further processed to fetch rand_samp_elig and rand_samp_mode bits. But the current code is not passing valid sample field to EV_CODE_EXTRACT macro. Patch addresses this by fixing the input for EV_CODE_EXTRACT.
--- .../pmu/sampling_tests/mmcra_thresh_marked_sample_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_marked_sample_test.c +2 -2
@@ -63,9 +63,9 @@ static int mmcra_thresh_marked_sample(void) get_mmcra_thd_stop(get_reg_value(intr_regs, "MMCRA"), 4));FAIL_IF (EV_CODE_EXTRACT (event.attr.config, marked) !=get_mmcra_marked (get_reg_value (intr_regs,"MMCRA" ),4 )); -FAIL_IF (EV_CODE_EXTRACT (event.attr.config, sample >>2 ) != +FAIL_IF ((EV_CODE_EXTRACT (event.attr.config, sample) >>2 ) !=get_mmcra_rand_samp_elig (get_reg_value (intr_regs,"MMCRA" ),4 )); -FAIL_IF (EV_CODE_EXTRACT (event.attr.config, sample &0x3 ) != +FAIL_IF ((EV_CODE_EXTRACT (event.attr.config, sample) &0x3 ) !=get_mmcra_sample_mode (get_reg_value (intr_regs,"MMCRA" ),4 ));FAIL_IF (EV_CODE_EXTRACT (event.attr.config, sm) !=get_mmcra_sm (get_reg_value (intr_regs,"MMCRA" ),4 ));
Signature · 1 line
2.39.1
PATCH 2/2 selftests/powerpc/pmu: fix including of utils.h when event.h is included
From: Madhavan Srinivasan <[email protected]>
event.h header already includes utlis.h. Avoid including the same explicitly in the code when event.h included.
--- tools/testing/selftests/powerpc/pmu/count_instructions.c | 1 - tools/testing/selftests/powerpc/pmu/count_stcx_fail.c | 1 - .../powerpc/pmu/event_code_tests/group_constraint_cache_test.c | 1 - .../pmu/event_code_tests/group_constraint_l2l3_sel_test.c | 1 - .../pmu/event_code_tests/group_constraint_thresh_cmp_test.c | 1 - .../pmu/event_code_tests/group_constraint_thresh_ctl_test.c | 1 - .../pmu/event_code_tests/group_constraint_thresh_sel_test.c | 1 - .../powerpc/pmu/event_code_tests/group_constraint_unit_test.c | 1 - .../powerpc/pmu/event_code_tests/hw_cache_event_type_test.c | 1 - tools/testing/selftests/powerpc/pmu/l3_bank_test.c | 1 - tools/testing/selftests/powerpc/pmu/per_event_excludes.c | 1 - .../selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c | 1 - .../powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c | 1 - .../powerpc/pmu/sampling_tests/intr_regs_no_crash_wo_pmu_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr0_cc56run_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcr0_exceptionbits_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcr0_fc56_pmc1ce_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr0_fc56_pmc56_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr0_pmccext_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr0_pmcjce_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr1_comb_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcr1_sel_unit_cache_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr2_fcs_fch_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr2_l2l3_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcr3_src_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_cond_test.c | 1 - .../pmu/sampling_tests/mmcra_bhrb_disable_no_branch_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c | 1 - .../selftests/powerpc/pmu/sampling_tests/mmcra_thresh_cmp_test.c | 1 - .../powerpc/pmu/sampling_tests/mmcra_thresh_marked_sample_test.c | 1 - 32 files changed, 32 deletions(-)
tools/testing/selftests/powerpc/pmu/count_instructions.c +0 -1
@@ -11,7 +11,6 @@#include <sys/prctl.h> #include "event.h" -#include "utils.h" #include "lib.h" extern void thirty_two_instruction_loop (u64 loops);
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c +0 -1
@@ -11,7 +11,6 @@#include <sys/prctl.h> #include "event.h" -#include "utils.h" #include "lib.h" extern void thirty_two_instruction_loop_with_ll_sc (u64 loops,u64 *ll_sc_target);
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_cache_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /* All L1 D cache load references counted at finish, gated by reject */
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_l2l3_sel_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /* All successful D-side store dispatches for this thread */
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_cmp_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /*
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_ctl_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /*
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_sel_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /*
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_unit_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /* All successful D-side store dispatches for this thread with PMC 2 */
tools/testing/selftests/powerpc/pmu/event_code_tests/hw_cache_event_type_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "../event.h" -#include "utils.h" #include "../sampling_tests/misc.h" /*
tools/testing/selftests/powerpc/pmu/l3_bank_test.c +0 -1
@@ -7,7 +7,6 @@#include <stdlib.h> #include "event.h" -#include "utils.h" #define MALLOC_SIZE (0x10000 * 10)/* Ought to be enough .. */
tools/testing/selftests/powerpc/pmu/per_event_excludes.c +0 -1
@@ -14,7 +14,6 @@#include "event.h" #include "lib.h" -#include "utils.h" /* * Test that per-event excludes work.
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* * A perf sampling test to check bhrb filter
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* * A perf sampling test for making sure
tools/testing/selftests/powerpc/pmu/sampling_tests/intr_regs_no_crash_wo_pmu_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* * A perf sampling test for making sure
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_cc56run_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_exceptionbits_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_fc56_pmc1ce_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_fc56_pmc56_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmccext_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmcjce_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_comb_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* All successful D-side store dispatches for this thread that were L2 Miss */ #define EventCode 0x46880
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_sel_unit_cache_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" #define MALLOC_SIZE (0x10000 * 10)/* Ought to be enough .. */
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr2_fcs_fch_test.c +0 -1
@@ -10,7 +10,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr2_l2l3_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* All successful D-side store dispatches for this thread */ #define EventCode 0x010000046080
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr3_src_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop_with_ll_sc (u64 loops,u64 *ll_sc_target);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_cond_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_no_branch_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void thirty_two_instruction_loop (int loops);
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" extern void indirect_branch_loop (void );
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_cmp_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* * Primary PMU event used here is PM_MRK_INST_CMPL (0x401e0)
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_marked_sample_test.c +0 -1
@@ -8,7 +8,6 @@#include "../event.h" #include "misc.h" -#include "utils.h" /* * Primary PMU event used here is PM_MRK_INST_CMPL (0x401e0)
Signature · 1 line
2.39.1
Re: [PATCH 2/2] selftests/powerpc/pmu: fix including of utils.h when event.h is included
Quoted 6 lines · Kajol Jain
From: Madhavan Srinivasan <[email protected]>
event.hheader already includesutlis.h. Avoid including the same explicitly in the code whenevent.hincluded.Signed-off-by Madhavan Srinivasan <[email protected]>
As I understand, transitive includes should not be depended upon. If you use a thing, and the thing is declared in a header, you should include _that_ header. Anything else is a recipe for weird include dependencies, ordering of the includes, etc.
These files all use FAIL_IF, etc., which are declared in utils.h. So utils.h is a legitimate include. The fact that events.h also includes it (for u64) is a coincidence. If the u64 type def gets moved to, e.g., types.h, and utils.h is removed from events.h, suddenly all these files stop compiling.
Madhavan Srinivasan
maintainerRe: [PATCH 2/2] selftests/powerpc/pmu: fix including of utils.h when event.h is included
Quoted 12 lines · Benjamin Gray
Quoted 6 lines · Kajol Jain
From: Madhavan Srinivasan <[email protected]>
event.hheader already includesutlis.h. Avoid including the same explicitly in the code whenevent.hincluded.Signed-off-by Madhavan Srinivasan <[email protected]>As I understand, transitive includes should not be depended upon. If you use a thing, and the thing is declared in a header, you should include _that_ header. Anything else is a recipe for weird include dependencies, ordering of the includes, etc.
Quoted 5 lines
These files all use
FAIL_IF, etc., which are declared inutils.h. Soutils.his a legitimate include. The fact thatevents.halso includes it (for u64) is a coincidence. If the u64 type def gets moved to, e.g.,types.h, andutils.his removed fromevents.h, suddenly all these files stop compiling.
thanks for the review. IIUC utils.h also carries the some test harness func declarations, also some of these tests does not use type defs anyway. I should have had a better commit message, my bad. But i will try out the suggested case.
Maddy
Madhavan Srinivasan
maintainerRe: [PATCH 2/2] selftests/powerpc/pmu: fix including of utils.h when event.h is included
Quoted 14 lines · Madhavan Srinivasan
Quoted 12 lines · Benjamin Gray
Quoted 6 lines · Kajol Jain
From: Madhavan Srinivasan <[email protected]>
event.hheader already includesutlis.h. Avoid including the same explicitly in the code whenevent.hincluded.Signed-off-by Madhavan Srinivasan <[email protected]>As I understand, transitive includes should not be depended upon. If you use a thing, and the thing is declared in a header, you should include _that_ header. Anything else is a recipe for weird include dependencies, ordering of the includes, etc.
Quoted 7 lines
Quoted 5 lines
These files all use
FAIL_IF, etc., which are declared inutils.h. Soutils.his a legitimate include. The fact thatevents.halso includes it (for u64) is a coincidence. If the u64 type def gets moved to, e.g.,types.h, andutils.his removed fromevents.h, suddenly all these files stop compiling.thanks for the review. IIUC
utils.halso carries the some test harness func declarations, also some of these tests does not use type defs anyway. I should have had a better commit message, my bad. But i will try out the suggested case.
yeah, "utils.h" included in the testcase files are for the tast_harness declarations. So we could get typedef moved from utils.h. Good catch. Thanks.
Kajol, kindly drop this patch.
Maddy
Quoted 2 lines
Maddy
Re: (subset) [PATCH 1/2] selftests/powerpc/pmu: Fix sample field check in the mmcra_thresh_marked_sample_test
In reply to Kajol JainQuoted 8 lines · Kajol Jain
The testcase verifies the setting of different fields in Monitor Mode Control Register A (MMCRA). In the current code,
EV_CODE_EXTRACTmacro is used to extract the "sample" field, which then needs to be further processed to fetchrand_samp_eligandrand_samp_modebits. But the current code is not passing valid sample field toEV_CODE_EXTRACTmacro. Patch addresses this by fixing the input forEV_CODE_EXTRACT.[...]
Patch 1 applied to powerpc/next.
[1/2] selftests/powerpc/pmu: Fix sample field check in the mmcra_thresh_marked_sample_test
https://git.kernel.org/powerpc/c/8a32341cf04ba05974931b4664683c2c9fb84e56
cheers