Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc: Run EBB tests only on POWER8

EBB (Event Based Branches) are currently only available on POWER8, so we
should skip them on other CPUs.

I've found that at least one test loops forever on 970MP (cycles_with_freeze_test).

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
[mpe: Minor change log editing, add skip to cpu_event_vs_ebb_test]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Denis Kirjanov and committed by
Michael Ellerman
39fcfb91 20d09927

+56
+2
tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
··· 63 63 { 64 64 struct event event; 65 65 66 + SKIP_IF(!ebb_is_supported()); 67 + 66 68 event_init_named(&event, 0x1001e, "cycles"); 67 69 event_leader_ebb_init(&event); 68 70
+2
tools/testing/selftests/powerpc/pmu/ebb/close_clears_pmcc_test.c
··· 20 20 { 21 21 struct event event; 22 22 23 + SKIP_IF(!ebb_is_supported()); 24 + 23 25 event_init_named(&event, 0x1001e, "cycles"); 24 26 event_leader_ebb_init(&event); 25 27
+2
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c
··· 43 43 int cpu, rc; 44 44 pid_t pid; 45 45 46 + SKIP_IF(!ebb_is_supported()); 47 + 46 48 cpu = pick_online_cpu(); 47 49 FAIL_IF(cpu < 0); 48 50 FAIL_IF(bind_to_cpu(cpu));
+2
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_vs_ebb_test.c
··· 41 41 int cpu, rc; 42 42 pid_t pid; 43 43 44 + SKIP_IF(!ebb_is_supported()); 45 + 44 46 cpu = pick_online_cpu(); 45 47 FAIL_IF(cpu < 0); 46 48 FAIL_IF(bind_to_cpu(cpu));
+2
tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
··· 16 16 { 17 17 struct event event; 18 18 19 + SKIP_IF(!ebb_is_supported()); 20 + 19 21 event_init_named(&event, 0x1001e, "cycles"); 20 22 event_leader_ebb_init(&event); 21 23
+2
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
··· 56 56 uint64_t val; 57 57 bool fc_cleared; 58 58 59 + SKIP_IF(!ebb_is_supported()); 60 + 59 61 event_init_named(&event, 0x1001e, "cycles"); 60 62 event_leader_ebb_init(&event); 61 63
+2
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
··· 26 26 int i; 27 27 bool bad_mmcr2; 28 28 29 + SKIP_IF(!ebb_is_supported()); 30 + 29 31 event_init_named(&event, 0x1001e, "cycles"); 30 32 event_leader_ebb_init(&event); 31 33
+11
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
··· 13 13 #include <stdlib.h> 14 14 #include <string.h> 15 15 #include <sys/ioctl.h> 16 + #include <linux/auxvec.h> 16 17 17 18 #include "trace.h" 18 19 #include "reg.h" ··· 318 317 /* Disable EBBs & freeze counters, events are still scheduled */ 319 318 mtspr(SPRN_BESCRR, BESCR_PME); 320 319 mb(); 320 + } 321 + 322 + bool ebb_is_supported(void) 323 + { 324 + #ifdef PPC_FEATURE2_EBB 325 + /* EBB requires at least POWER8 */ 326 + return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_EBB); 327 + #else 328 + return false; 329 + #endif 321 330 } 322 331 323 332 void event_ebb_init(struct event *e)
+1
tools/testing/selftests/powerpc/pmu/ebb/ebb.h
··· 52 52 int ebb_event_enable(struct event *e); 53 53 void ebb_global_enable(void); 54 54 void ebb_global_disable(void); 55 + bool ebb_is_supported(void); 55 56 void ebb_freeze_pmcs(void); 56 57 void ebb_unfreeze_pmcs(void); 57 58 void event_ebb_init(struct event *e);
+2
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c
··· 47 47 struct event event; 48 48 pid_t pid; 49 49 50 + SKIP_IF(!ebb_is_supported()); 51 + 50 52 FAIL_IF(pipe(read_pipe.fds) == -1); 51 53 FAIL_IF(pipe(write_pipe.fds) == -1); 52 54
+2
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
··· 54 54 struct event event; 55 55 pid_t pid; 56 56 57 + SKIP_IF(!ebb_is_supported()); 58 + 57 59 FAIL_IF(pipe(read_pipe.fds) == -1); 58 60 FAIL_IF(pipe(write_pipe.fds) == -1); 59 61
+2
tools/testing/selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c
··· 41 41 int cpu, rc; 42 42 pid_t pid; 43 43 44 + SKIP_IF(!ebb_is_supported()); 45 + 44 46 cpu = pick_online_cpu(); 45 47 FAIL_IF(cpu < 0); 46 48 FAIL_IF(bind_to_cpu(cpu));
+2
tools/testing/selftests/powerpc/pmu/ebb/event_attributes_test.c
··· 16 16 { 17 17 struct event event, leader; 18 18 19 + SKIP_IF(!ebb_is_supported()); 20 + 19 21 event_init(&event, 0x1001e); 20 22 event_leader_ebb_init(&event); 21 23 /* Expected to succeed */
+2
tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c
··· 44 44 { 45 45 pid_t pid; 46 46 47 + SKIP_IF(!ebb_is_supported()); 48 + 47 49 event_init_named(&event, 0x1001e, "cycles"); 48 50 event_leader_ebb_init(&event); 49 51
+2
tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
··· 111 111 struct event event; 112 112 uint64_t overhead; 113 113 114 + SKIP_IF(!ebb_is_supported()); 115 + 114 116 event_init_named(&event, 0x400FA, "PM_RUN_INST_CMPL"); 115 117 event_leader_ebb_init(&event); 116 118 event.attr.exclude_kernel = 1;
+2
tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
··· 23 23 int i, orig_period, max_period; 24 24 struct event event; 25 25 26 + SKIP_IF(!ebb_is_supported()); 27 + 26 28 /* We use PMC4 to make sure the kernel switches all counters correctly */ 27 29 event_init_named(&event, 0x40002, "instructions"); 28 30 event_leader_ebb_init(&event);
+2
tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
··· 18 18 struct event events[6]; 19 19 int i, group_fd; 20 20 21 + SKIP_IF(!ebb_is_supported()); 22 + 21 23 event_init_named(&events[0], 0x1001C, "PM_CMPLU_STALL_THRD"); 22 24 event_init_named(&events[1], 0x2D016, "PM_CMPLU_STALL_FXU"); 23 25 event_init_named(&events[2], 0x30006, "PM_CMPLU_STALL_OTHER_CMPL");
+2
tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
··· 79 79 pid_t pids[NR_CHILDREN]; 80 80 int cpu, rc, i; 81 81 82 + SKIP_IF(!ebb_is_supported()); 83 + 82 84 cpu = pick_online_cpu(); 83 85 FAIL_IF(cpu < 0); 84 86 FAIL_IF(bind_to_cpu(cpu));
+2
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c
··· 19 19 u64 val; 20 20 int i; 21 21 22 + SKIP_IF(!ebb_is_supported()); 23 + 22 24 event_init_named(&event, 0x1001e, "cycles"); 23 25 event_leader_ebb_init(&event); 24 26
+2
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
··· 58 58 { 59 59 struct event event; 60 60 61 + SKIP_IF(!ebb_is_supported()); 62 + 61 63 event_init_named(&event, 0x1001e, "cycles"); 62 64 event_leader_ebb_init(&event); 63 65
+2
tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
··· 49 49 { 50 50 struct event event; 51 51 52 + SKIP_IF(!ebb_is_supported()); 53 + 52 54 /* Use PMC2 so we set PMCjCE, which enables PMC5/6 */ 53 55 event_init(&event, 0x2001e); 54 56 event_leader_ebb_init(&event);
+2
tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c
··· 18 18 { 19 19 uint64_t val, expected; 20 20 21 + SKIP_IF(!ebb_is_supported()); 22 + 21 23 expected = 0x8000000100000000ull; 22 24 mtspr(SPRN_BESCR, expected); 23 25 val = mfspr(SPRN_BESCR);
+2
tools/testing/selftests/powerpc/pmu/ebb/task_event_pinned_vs_ebb_test.c
··· 42 42 pid_t pid; 43 43 int rc; 44 44 45 + SKIP_IF(!ebb_is_supported()); 46 + 45 47 FAIL_IF(pipe(read_pipe.fds) == -1); 46 48 FAIL_IF(pipe(write_pipe.fds) == -1); 47 49
+2
tools/testing/selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c
··· 40 40 pid_t pid; 41 41 int rc; 42 42 43 + SKIP_IF(!ebb_is_supported()); 44 + 43 45 FAIL_IF(pipe(read_pipe.fds) == -1); 44 46 FAIL_IF(pipe(write_pipe.fds) == -1); 45 47