Commit 39fcfb91 authored by Denis Kirjanov's avatar Denis Kirjanov Committed by Michael Ellerman

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: default avatarDenis Kirjanov <kda@linux-powerpc.org>
[mpe: Minor change log editing, add skip to cpu_event_vs_ebb_test]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 20d09927
......@@ -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);
......
......@@ -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);
......
......@@ -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));
......
......@@ -41,6 +41,8 @@ int cpu_event_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));
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/auxvec.h>
#include "trace.h"
#include "reg.h"
......@@ -319,6 +320,16 @@ void ebb_global_disable(void)
mb();
}
bool ebb_is_supported(void)
{
#ifdef PPC_FEATURE2_EBB
/* EBB requires at least POWER8 */
return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_EBB);
#else
return false;
#endif
}
void event_ebb_init(struct event *e)
{
e->attr.config |= (1ull << 63);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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));
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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");
......
......@@ -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));
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment