selftests/powerpc: run eeb tests only on POWER8
PATCH 1/1 selftests/powerpc: run eeb tests only on POWER8
Event Based Branches currenly available on POWER8. so we can skip them on other CPUs.
I've found that at least one test loops forever
on 970MP (cycles_with_freeze_test).
--- .../selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/close_clears_pmcc_test.c | 2 ++ .../powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c | 2 ++ tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c | 2 ++ tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 13 +++++++++++++ tools/testing/selftests/powerpc/pmu/ebb/ebb.h | 1 + tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/event_attributes_test.c | 2 ++ tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/instruction_count_test.c | 2 ++ .../testing/selftests/powerpc/pmu/ebb/lost_exception_test.c | 2 ++ .../testing/selftests/powerpc/pmu/ebb/multi_counter_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c | 2 ++ tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 2 ++ .../testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c | 2 ++ .../testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c | 2 ++ tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c | 2 ++ .../powerpc/pmu/ebb/task_event_pinned_vs_ebb_test.c | 2 ++ .../selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c | 2 ++ 23 files changed, 56 insertions(+)
tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c +2 -0
@@ -63,6 +63,8 @@ int back_to_back_ebbs(void) {struct event event; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/close_clears_pmcc_test.c +2 -0
@@ -20,6 +20,8 @@ int close_clears_pmcc(void) {struct event event; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c +2 -0
@@ -43,6 +43,8 @@ int cpu_event_pinned_vs_ebb(void)int cpu, rc;pid_t pid; +SKIP_IF (!ebb_is_supported ()); + cpu =pick_online_cpu ();FAIL_IF (cpu <0 );FAIL_IF (bind_to_cpu (cpu));
tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c +2 -0
@@ -16,6 +16,8 @@ int cycles(void) {struct event event; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c +2 -0
@@ -56,6 +56,8 @@ int cycles_with_freeze(void)uint64_t val;bool fc_cleared; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c +2 -0
@@ -26,6 +26,8 @@ int cycles_with_mmcr2(void)int i;bool bad_mmcr2; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +13 -0
@@ -319,6 +319,19 @@ void ebb_global_disable(void)mb (); } +#define PVR_VER (pvr) (((pvr) >> 16) & 0xFFFF) +bool ebb_is_supported (void ) +{ +unsigned long pvr; + + __asm__ __volatile__("mfpvr %0" :"=b" (pvr)); +/* EBB requires at least POWER8 */ +if (PVR_VER (pvr) >=0x004D ) +return true; + +return false; +} +void event_ebb_init (struct event *e) { e->attr.config |= (1ull <<63 );
tools/testing/selftests/powerpc/pmu/ebb/ebb.h +1 -0
@@ -52,6 +52,7 @@ void standard_ebb_callee(void);int ebb_event_enable (struct event *e);void ebb_global_enable (void );void ebb_global_disable (void ); +bool ebb_is_supported (void );void ebb_freeze_pmcs (void );void ebb_unfreeze_pmcs (void );void event_ebb_init (struct event *e);
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c +2 -0
@@ -47,6 +47,8 @@ int ebb_on_child(void)struct event event;pid_t pid; +SKIP_IF (!ebb_is_supported ()); +FAIL_IF (pipe (read_pipe.fds) ==-1 );FAIL_IF (pipe (write_pipe.fds) ==-1 );
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c +2 -0
@@ -54,6 +54,8 @@ int ebb_on_willing_child(void)struct event event;pid_t pid; +SKIP_IF (!ebb_is_supported ()); +FAIL_IF (pipe (read_pipe.fds) ==-1 );FAIL_IF (pipe (write_pipe.fds) ==-1 );
tools/testing/selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c +2 -0
@@ -41,6 +41,8 @@ int ebb_vs_cpu_event(void)int cpu, rc;pid_t pid; +SKIP_IF (!ebb_is_supported ()); + cpu =pick_online_cpu ();FAIL_IF (cpu <0 );FAIL_IF (bind_to_cpu (cpu));
tools/testing/selftests/powerpc/pmu/ebb/event_attributes_test.c +2 -0
@@ -16,6 +16,8 @@ int event_attributes(void) {struct event event, leader; +SKIP_IF (!ebb_is_supported ()); +event_init (&event,0x1001e );event_leader_ebb_init (&event);/* Expected to succeed */
tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c +2 -0
@@ -44,6 +44,8 @@ int fork_cleanup(void) {pid_t pid; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c +2 -0
@@ -111,6 +111,8 @@ int instruction_count(void)struct event event;uint64_t overhead; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x400FA ,"PM_RUN_INST_CMPL" );event_leader_ebb_init (&event); event.attr.exclude_kernel =1 ;
tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c +2 -0
@@ -23,6 +23,8 @@ static int test_body(void)int i, orig_period, max_period;struct event event; +SKIP_IF (!ebb_is_supported ()); +/* We use PMC4 to make sure the kernel switches all counters correctly */ event_init_named (&event,0x40002 ,"instructions" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c +2 -0
@@ -18,6 +18,8 @@ int multi_counter(void)struct event events[6 ];int i, group_fd; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&events[0 ],0x1001C ,"PM_CMPLU_STALL_THRD" );event_init_named (&events[1 ],0x2D016 ,"PM_CMPLU_STALL_FXU" );event_init_named (&events[2 ],0x30006 ,"PM_CMPLU_STALL_OTHER_CMPL" );
tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c +2 -0
@@ -79,6 +79,8 @@ int multi_ebb_procs(void)pid_t pids[NR_CHILDREN ];int cpu, rc, i; +SKIP_IF (!ebb_is_supported ()); + cpu =pick_online_cpu ();FAIL_IF (cpu <0 );FAIL_IF (bind_to_cpu (cpu));
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +2 -0
@@ -19,6 +19,8 @@ static int no_handler_test(void)u64 val;int i; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c +2 -0
@@ -58,6 +58,8 @@ static int test_body(void) {struct event event; +SKIP_IF (!ebb_is_supported ()); +event_init_named (&event,0x1001e ,"cycles" );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c +2 -0
@@ -49,6 +49,8 @@ int pmc56_overflow(void) {struct event event; +SKIP_IF (!ebb_is_supported ()); +/* Use PMC2 so we set PMCjCE, which enables PMC5/6 */ event_init (&event,0x2001e );event_leader_ebb_init (&event);
tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c +2 -0
@@ -18,6 +18,8 @@ int reg_access(void) {uint64_t val, expected; +SKIP_IF (!ebb_is_supported ()); + expected =0x8000000100000000ull ;mtspr (SPRN_BESCR , expected); val =mfspr (SPRN_BESCR );
tools/testing/selftests/powerpc/pmu/ebb/task_event_pinned_vs_ebb_test.c +2 -0
@@ -42,6 +42,8 @@ int task_event_pinned_vs_ebb(void)pid_t pid;int rc; +SKIP_IF (!ebb_is_supported ()); +FAIL_IF (pipe (read_pipe.fds) ==-1 );FAIL_IF (pipe (write_pipe.fds) ==-1 );
tools/testing/selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c +2 -0
@@ -40,6 +40,8 @@ int task_event_vs_ebb(void)pid_t pid;int rc; +SKIP_IF (!ebb_is_supported ()); +FAIL_IF (pipe (read_pipe.fds) ==-1 );FAIL_IF (pipe (write_pipe.fds) ==-1 );
Signature · 1 line
2.4.0
Michael Ellerman
reviewerQuoted 2 lines · Denis Kirjanov
Event Based Branches currenly available on POWER8. so we can skip them on other CPUs.
Thanks for the patch, but ..
Quoted 2 lines
I've found that at least one test loops forever
on 970MP (cycles_with_freeze_test).
Ooo interesting. The harness should kill it after a timeout.
Quoted 10 lines
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +2
-0@@ -319,6 +319,19 @@ void ebb_global_disable(void)mb (); } +#define PVR_VER (pvr) (((pvr) >> 16) & 0xFFFF) +bool ebb_is_supported (void )
tools/testing/selftests/powerpc/pmu/ebb/ebb.c void ebb_global_disable(void) · line 333
Quoted 10 lines
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +10
-0+{ +unsigned long pvr; + + __asm__ __volatile__("mfpvr %0" :"=b" (pvr)); +/* EBB requires at least POWER8 */ +if (PVR_VER (pvr) >=0x004D ) +return true; + +return false; +}
The right way to do this is not to look at the PVR but instead look at AT_HWCAP2, and see if it contains PPC_FEATURE2_EBB.
You can see an example in tm-syscall.c
Can you please respin with that change?
cheers
Quoted 37 lines · Michael Ellerman
Quoted 2 lines · Denis Kirjanov
Event Based Branches currenly available on POWER8. so we can skip them on other CPUs.
Thanks for the patch, but ..
Quoted 2 lines
I've found that at least one test loops forever
on 970MP (cycles_with_freeze_test).Ooo interesting. The harness should kill it after a timeout.
Quoted 11 lines
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +2
-0@@ -319,6 +319,19 @@ void ebb_global_disable(void)mb (); } +#define PVR_VER (pvr) (((pvr) >> 16) & 0xFFFF) +bool ebb_is_supported (void )tools/testing/selftests/powerpc/pmu/ebb/ebb.c void ebb_global_disable(void) · line 333
Quoted 10 lines
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +10
-0+{ +unsigned long pvr; + + __asm__ __volatile__("mfpvr %0" :"=b" (pvr)); +/* EBB requires at least POWER8 */ +if (PVR_VER (pvr) >=0x004D ) +return true; + +return false; +}The right way to do this is not to look at the PVR but instead look at
AT_HWCAP2, and see if it containsPPC_FEATURE2_EBB.
Quoted 3 lines
You can see an example in
tm-syscall.cCan you please respin with that change?
Sure, no problem!
Thanks!
Quoted 4 lines
cheers