Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c
int main(void) { return test_harness(test_main, "hugetlb_vs_thp"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c
static int test(void) { int p2c[2], c2p[2], rc, status, c, *p; unsigned long page_size; pid_t pid; page_size = sysconf(_SC_PAGESIZE); SKIP_IF(page_size != 65536); p = mmap((void *)(512ul << 40), page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0); if (...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c
static int touch_mappings(void) { unsigned long r9_orig, r10_orig, r11_orig, r12_orig, r13_orig; unsigned long r9, r10, r11, r12, r13; unsigned long addr, *p; int i; for (i = 0; i < NR_MAPPINGS; i++) { addr = BASE_ADDRESS + (i * STRIDE); p = (unsigned long *)addr; asm volatile("mr %0, %%r9 ;" ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c
int main(void) { return test_harness(test, "large_vm_gpr_corruption"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
static void segv_handler(int signum, siginfo_t *sinfo, void *ctx) { int signal_pkey; signal_pkey = siginfo_pkey(sinfo); fault_code = sinfo->si_code; if (sinfo->si_addr != (void *)fault_addr) { sigsafe_err("got a fault for an unexpected address\n"); _exit(1); } /* Check if too many faults have occ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
int main(void) { return test_harness(test, "pkey_exec_prot"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/pkey_siginfo.c
static void segv_handler(int signum, siginfo_t *sinfo, void *ctx) { void *pgstart; size_t pgsize; int pkey; pkey = siginfo_pkey(sinfo); if (sinfo->si_code != SEGV_PKUERR) { sigsafe_err("got a fault for an unexpected reason\n"); _exit(1); } /* Check if this fault originated from the expected add...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/pkey_siginfo.c
static void *protect(void *p) { unsigned long rights; unsigned int *base; size_t size; int tid, i; tid = gettid(); base = ((struct region *)p)->base; size = ((struct region *)p)->size; FAIL_IF_EXIT(!base); rights = 0; printf("tid %d, pkey permissions are %s\n", tid, pkey_rights(rights)); /* Al...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/pkey_siginfo.c
static void reset_pkeys(unsigned long rights) { int pkeys[NR_PKEYS], i; for (i = 0; i < NR_PKEYS; i++) pkeys[i] = sys_pkey_alloc(0, rights); /* Free all allocated pkeys */ for (i = 0; i < NR_PKEYS; i++) sys_pkey_free(pkeys[i]); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c
int consume_stack(unsigned long target_sp, unsigned long stack_high, int delta, enum access_type type) { unsigned long target; char stack_cur; if ((unsigned long)&stack_cur > target_sp) return consume_stack(target_sp, stack_high, delta, type); else { // generate a recursive call abov...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c
int child(unsigned int stack_used, int delta, enum access_type type) { unsigned long low, stack_high; assert(search_proc_maps("[stack]", &low, &stack_high) == 0); assert(consume_stack(stack_high - stack_used, stack_high, delta, type) == 0); printf("Access OK: %s delta %-7d used size 0x%06x stack high 0x%lx ...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c
static int test_one(unsigned int stack_used, int delta, enum access_type type) { pid_t pid; int rc; pid = fork(); if (pid == 0) exit(child(stack_used, delta, type)); assert(waitpid(pid, &rc, 0) != -1); if (WIFEXITED(rc) && WEXITSTATUS(rc) == 0) return 0; assert(!WIFEXITED(rc)); printf("Faul...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c
static void test_one_type(enum access_type type, unsigned long page_size, unsigned long rlim_cur) { unsigned long delta; for (delta = page_size; delta <= rlim_cur; delta += page_size) assert(test_one(DEFAULT_SIZE, delta, type) == 0); assert(test_one(DEFAULT_SIZE, rlim_cur, type) ==...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_signal.c
static int consume_stack(unsigned int stack_size, union pipe write_pipe) { char stack_cur; if ((stack_base_ptr - &stack_cur) < stack_size) return consume_stack(stack_size, write_pipe); else { stack_top_ptr = &stack_cur; FAIL_IF(notify_parent(write_pipe)); while (!sig_occurred) barrier();...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/stack_expansion_signal.c
int test(void) { unsigned int i, size; // Increment by 64 to get more coverage of odd sizes for (i = 0; i < (128 * _KB); i += 64) { size = i + (1 * _MB) - (64 * _KB); FAIL_IF(test_one_size(size)); } return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/subpage_prot.c
static inline void do_read(const volatile void *addr) { int ret; asm volatile("lwz %0,0(%1); twi 0,%0,0; isync;\n" : "=r"(ret) : "r"(addr) : "memory"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/subpage_prot.c
int test_anon(void) { unsigned long align; struct sigaction act = {.sa_sigaction = segv, .sa_flags = SA_SIGINFO}; void *mallocblock; unsigned long mallocsize; SKIP_IF(!syscall_available()); if (getpagesize() != 0x10000) { fprintf(stderr, "Kernel page size must be 64K!\n"); return 1; } sigact...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/tlbie_test.c
static inline void log_anamoly(unsigned int tid, unsigned int *addr, unsigned int expected, unsigned int observed) { FILE *f = fp[tid]; fprintf(f, "Thread %02d: Addr 0x%lx: Expected 0x%x, Observed 0x%x\n", tid, (unsigned long)addr, expected, observed); fprintf(f, "Thread...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/tlbie_test.c
static inline void end_verification_log(unsigned int tid, unsigned nr_anamolies) { FILE *f = fp[tid]; char logfile[30]; char path[LOGDIR_NAME_SIZE + 30]; char separator[] = "/"; fclose(f); if (nr_anamolies == 0) { remove(path); return; } sprintf(logfil...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/tlbie_test.c
static void set_pthread_cpu(pthread_t th, int cpu) { cpu_set_t run_cpu_mask; struct sched_param param; CPU_ZERO(&run_cpu_mask); CPU_SET(cpu, &run_cpu_mask); pthread_setaffinity_np(th, sizeof(cpu_set_t), &run_cpu_mask); param.sched_priority = 1; if (0 && sched_setscheduler(0, SCHED_FIFO, &param) == -1) {...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/wild_bctr.c
static void save_regs(ucontext_t *ctxt) { struct pt_regs *regs = ctxt->uc_mcontext.regs; memcpy(&signal_regs, regs, sizeof(signal_regs)); }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/wild_bctr.c
static inline void poison_regs(void) { #define POISON_REG(n) \ "lis " __stringify(n) "," __stringify( \ REG_POISON) ";" \ ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/wild_bctr.c
static void dump_regs(void) { for (int i = 0; i < 32; i += 4) { printf("r%02d 0x%016lx r%02d 0x%016lx " "r%02d 0x%016lx r%02d 0x%016lx\n", i, signal_regs.gpr[i], i + 1, signal_regs.gpr[i + 1], i + 2, signal_regs.gpr[i + 2], i + 3, signal_regs.gpr[i + 3]); } }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/mm/wild_bctr.c
int test_wild_bctr(void) { int (*func_ptr)(void); struct sigaction segv = {.sa_sigaction = segv_handler, .sa_flags = SA_SIGINFO}; struct sigaction usr2 = {.sa_sigaction = usr2_handler, .sa_flags = SA_SIGINFO}; FAIL_IF(sigaction(SIGSEGV, &segv, NULL)); FAI...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/nx-gzip/gzfht_test.c
int write_output_file(char *fname, char *buf, size_t bufsize) { FILE *fp; size_t num_bytes; fp = fopen(fname, "w"); if (fp == NULL) { perror(fname); return (-1); } num_bytes = fwrite(buf, 1, bufsize, fp); if (ferror(fp) || (num_bytes != bufsize)) { perror(fname); return (-1); } fclose...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/nx-gzip/gzip_vas.c
static int open_device_nodes(char *devname, int pri, struct nx_handle *handle) { int rc, fd; void *addr; struct vas_tx_win_open_attr txattr; fd = open(devname, O_RDWR); if (fd < 0) { fprintf(stderr, " open device name %s\n", devname); return -errno; } memset(&txattr, 0, sizeof(txattr)); txatt...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/nx-gzip/gzip_vas.c
int nxu_submit_job(struct nx_gzip_crb_cpb_t *cmdp, void *handle) { int cc; cc = nxu_run_job(cmdp, handle); if (!cc) cc = getnn(cmdp->crb.csb, csb_cc); return cc; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/nx-gzip/include/copy-paste.h
static inline int vas_copy(void *crb, int offset) { asm volatile(PPC_COPY(% 0, % 1) ";" : : "b"(offset), "b"(crb) : "memory"); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/nx-gzip/include/copy-paste.h
static inline int vas_paste(void *paste_address, int offset) { __u32 cr; cr = 0; asm volatile(PPC_PASTE(% 1, % 2) ";" "mfocrf %0, 0x80;" : "=r"(cr) : "b"(offset), "b"(paste_address) : "memory", "cr0"); return (cr >> CR0_SHIFT) & ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/count_instructions.c
static void setup_event(struct event *e, u64 config, char *name) { event_init_opts(e, config, PERF_TYPE_HARDWARE, name); e->attr.disabled = 1; e->attr.exclude_kernel = 1; e->attr.exclude_hv = 1; e->attr.exclude_idle = 1; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
static void setup_event(struct event *e, u64 config, int type, char *name) { event_init_opts(e, config, type, name); e->attr.disabled = 1; e->attr.exclude_kernel = 1; e->attr.exclude_hv = 1; e->attr.exclude_idle = 1; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
static int count_ll_sc(void) { return eat_cpu(test_body); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
int main(void) { return test_harness(count_ll_sc, "count_ll_sc"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
int main(void) { return test_harness(back_to_back_ebbs, "back_to_back_ebbs"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/close_clears_pmcc_test.c
int close_clears_pmcc(void) { struct event event; SKIP_IF(!ebb_is_supported()); event_init_named(&event, 0x1001e, "cycles"); event_leader_ebb_init(&event); FAIL_IF(event_open(&event)); ebb_enable_pmc_counting(1); setup_ebb_handler(standard_ebb_callee); ebb_global_enable(); FAIL_IF(ebb_event_enable...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c
static int setup_cpu_event(struct event *event, int cpu) { event_init_named(event, 0x400FA, "PM_RUN_INST_CMPL"); event->attr.pinned = 1; event->attr.exclude_kernel = 1; event->attr.exclude_hv = 1; event->attr.exclude_idle = 1; SKIP_IF(require_paranoia_below(1)); FAIL_IF(event_open_with_cpu(event, cpu))...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c
int cpu_event_pinned_vs_ebb(void) { union pipe read_pipe, write_pipe; struct event event; 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)); FAIL_IF(pipe(read_pipe.fds) == -1); FAIL_IF(pipe(write_pipe.fds) == -1); pid = f...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c
int main(void) { return test_harness(cpu_event_pinned_vs_ebb, "cpu_event_pinned_vs_ebb"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cpu_event_vs_ebb_test.c
int cpu_event_vs_ebb(void) { union pipe read_pipe, write_pipe; struct event event; 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)); FAIL_IF(pipe(read_pipe.fds) == -1); FAIL_IF(pipe(write_pipe.fds) == -1); pid = fork(); ...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
int cycles(void) { struct event event; SKIP_IF(!ebb_is_supported()); event_init_named(&event, 0x1001e, "cycles"); event_leader_ebb_init(&event); event.attr.exclude_kernel = 1; event.attr.exclude_hv = 1; event.attr.exclude_idle = 1; FAIL_IF(event_open(&event)); ebb_enable_pmc_counting(1); setup_...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
int main(void) { return test_harness(cycles_with_freeze, "cycles_with_freeze"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
int cycles_with_mmcr2(void) { struct event event; uint64_t val, expected[2], actual; int i; bool bad_mmcr2; SKIP_IF(!ebb_is_supported()); event_init_named(&event, 0x1001e, "cycles"); event_leader_ebb_init(&event); event.attr.exclude_kernel = 1; event.attr.exclude_hv = 1; event.attr.exclude_idle =...
[ 1, 1 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
void reset_ebb_with_clear_mask(unsigned long mmcr0_clear_mask) { u64 val; /* 3) set MMCR0[PMAE] - docs say BESCR[PME] should do this */ val = mfspr(SPRN_MMCR0); mtspr(SPRN_MMCR0, (val & ~mmcr0_clear_mask) | MMCR0_PMAE); /* 4) clear BESCR[PMEO] */ mtspr(SPRN_BESCRR, BESCR_PMEO); /* 5) set BESCR[PME] */ ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
int ebb_check_mmcr0(void) { u64 val; val = mfspr(SPRN_MMCR0); if ((val & (MMCR0_FC | MMCR0_PMAO)) == MMCR0_FC) { printf("Outside of loop, only FC set 0x%llx\n", val); return 1; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
void clear_ebb_stats(void) { memset(&ebb_state.stats, 0, sizeof(ebb_state.stats)); }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
void dump_summary_ebb_state(void) { printf("ebb_state:\n" " ebb_count = %d\n" " spurious = %d\n" " negative = %d\n" " no_overflow = %d\n" " pmc[1] count = 0x%llx\n" " pmc[2] count = 0x%llx\n" " pmc[3] count = 0x%llx\n" " pmc[...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
static char *decode_mmcr0(u32 value) { static char buf[16]; buf[0] = '\0'; if (value & (1 << 31)) strcat(buf, "FC "); if (value & (1 << 26)) strcat(buf, "PMAE "); if (value & (1 << 7)) strcat(buf, "PMAO "); return buf; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
static char *decode_bescr(u64 value) { static char buf[16]; buf[0] = '\0'; if (value & (1ull << 63)) strcat(buf, "GE "); if (value & (1ull << 32)) strcat(buf, "PMAE "); if (value & 1) strcat(buf, "PMAO "); return buf; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
void ebb_global_disable(void) { mtspr(SPRN_BESCRR, BESCR_PME); mb(); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
bool ebb_is_supported(void) { #ifdef PPC_FEATURE2_EBB return have_hwcap2(PPC_FEATURE2_EBB); #else return false; #endif }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
int catch_sigill(void (*func)(void)) { if (sigaction(SIGILL, &sigill_action, NULL)) { perror("sigaction"); return 1; } if (setjmp(setjmp_env) == 0) { func(); return 1; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
void write_pmc1(void) { mtspr(SPRN_PMC1, 0); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
u64 read_pmc(int pmc) { switch (pmc) { case 1: return mfspr(SPRN_PMC1); case 2: return mfspr(SPRN_PMC2); case 3: return mfspr(SPRN_PMC3); case 4: return mfspr(SPRN_PMC4); case 5: return mfspr(SPRN_PMC5); case 6: return mfspr(SPRN_PMC6); } return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c
int ebb_on_child(void) { union pipe read_pipe, write_pipe; 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); pid = fork(); if (pid == 0) { exit(victim_child(write_pipe, read_pipe)); } FAIL_IF(sync_with_child...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c
int main(void) { return test_harness(ebb_on_child, "ebb_on_child"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
int ebb_on_willing_child(void) { union pipe read_pipe, write_pipe; 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); pid = fork(); if (pid == 0) { exit(victim_child(write_pipe, read_pipe)); } /* Signal the c...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c
static int setup_cpu_event(struct event *event, int cpu) { event_init_named(event, 0x400FA, "PM_RUN_INST_CMPL"); event->attr.exclude_kernel = 1; event->attr.exclude_hv = 1; event->attr.exclude_idle = 1; SKIP_IF(require_paranoia_below(1)); FAIL_IF(event_open_with_cpu(event, cpu)); FAIL_IF(event_enable(ev...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c
int main(void) { return test_harness(ebb_vs_cpu_event, "ebb_vs_cpu_event"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
static uint64_t determine_overhead(struct event *event) { uint64_t current, overhead; int i; do_count_loop(event, 0, 0, false); overhead = event->result.value; for (i = 0; i < 100; i++) { do_count_loop(event, 0, 0, false); current = event->result.value; if (current < overhead) { printf("Re...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
static int lost_exception(void) { return eat_cpu(test_body); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
int main(void) { return test_harness(multi_counter, "multi_counter"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c
static int no_handler_test(void) { struct event event; u64 val; int i; SKIP_IF(!ebb_is_supported()); event_init_named(&event, 0x1001e, "cycles"); event_leader_ebb_init(&event); event.attr.exclude_kernel = 1; event.attr.exclude_hv = 1; event.attr.exclude_idle = 1; FAIL_IF(event_open(&event)); F...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c
int main(void) { return test_harness(no_handler_test, "no_handler_test"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
static int test_body(void) { struct event event; SKIP_IF(!ebb_is_supported()); event_init_named(&event, 0x1001e, "cycles"); event_leader_ebb_init(&event); event.attr.exclude_kernel = 1; event.attr.exclude_hv = 1; event.attr.exclude_idle = 1; FAIL_IF(event_open(&event)); setup_ebb_handler(syscall...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
int pmae_handling(void) { return eat_cpu(test_body); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c
int reg_access(void) { uint64_t val, expected; SKIP_IF(!ebb_is_supported()); expected = 0x8000000100000000ull; mtspr(SPRN_BESCR, expected); val = mfspr(SPRN_BESCR); FAIL_IF(val != expected); expected = 0x0000000001000000ull; mtspr(SPRN_EBBHR, expected); val = mfspr(SPRN_EBBHR); FAIL_IF(val != e...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c
int main(void) { return test_harness(reg_access, "reg_access"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/task_event_pinned_vs_ebb_test.c
static int setup_child_event(struct event *event, pid_t child_pid) { event_init_named(event, 0x400FA, "PM_RUN_INST_CMPL"); event->attr.pinned = 1; event->attr.exclude_kernel = 1; event->attr.exclude_hv = 1; event->attr.exclude_idle = 1; FAIL_IF(event_open_with_pid(event, child_pid)); FAIL_IF(event_enab...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c
static int setup_child_event(struct event *event, pid_t child_pid) { event_init_named(event, 0x400FA, "PM_RUN_INST_CMPL"); event->attr.exclude_kernel = 1; event->attr.exclude_hv = 1; event->attr.exclude_idle = 1; FAIL_IF(event_open_with_pid(event, child_pid)); FAIL_IF(event_enable(event)); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c
int task_event_vs_ebb(void) { union pipe read_pipe, write_pipe; struct event event; pid_t pid; int rc; SKIP_IF(!ebb_is_supported()); FAIL_IF(pipe(read_pipe.fds) == -1); FAIL_IF(pipe(write_pipe.fds) == -1); pid = fork(); if (pid == 0) { exit(ebb_child(write_pipe, read_pipe)); } /* We setup...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/trace.c
static bool trace_check_bounds(struct trace_buffer *tb, void *p) { return p < ((void *)tb + tb->size); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/trace.c
static bool trace_check_alloc(struct trace_buffer *tb, void *p) { if (tb->overflow) return false; if (!trace_check_bounds(tb, p)) { tb->overflow = true; return false; } return true; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/trace.c
static void *trace_alloc(struct trace_buffer *tb, int bytes) { void *p, *newtail; p = tb->tail; newtail = tb->tail + bytes; if (!trace_check_alloc(tb, newtail)) return NULL; tb->tail = newtail; return p; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/trace.c
static struct trace_entry *trace_alloc_entry(struct trace_buffer *tb, int payload_size) { struct trace_entry *e; e = trace_alloc(tb, sizeof(*e) + payload_size); if (e) e->length = payload_size; return e; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/ebb/trace.c
static char *trace_decode_reg(int reg) { switch (reg) { case 769: return "SPRN_MMCR2"; break; case 770: return "SPRN_MMCRA"; break; case 779: return "SPRN_MMCR0"; break; case 804: return "SPRN_EBBHR"; break; case 805: return "SPRN_EBBRR"; break; case 806: retur...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event.c
int event_open_with_pid(struct event *e, pid_t pid) { return event_open_with_options(e, pid, PERF_NO_CPU, PERF_NO_GROUP); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event.c
void event_report_justified(struct event *e, int name_width, int result_width) { printf("%*s: result %*llu ", name_width, e->name, result_width, e->result.value); if (e->result.running == e->result.enabled) printf("running/enabled %llu\n", e->result.running); else printf("running %llu enabled %...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_mmcra_sample_test.c
int main(void) { return test_harness(group_constraint_mmcra_sample, "group_constraint_mmcra_sample"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_repeat_test.c
static int group_constraint_repeat(void) { struct event event, leader; SKIP_IF(platform_check_for_tests()); /* * Two events in a group using same PMC * should fail to get scheduled. Usei same PMC2 * for leader and sibling event which is expected * to fail. */ event_init(&leader, EventCode1); ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_cmp_test.c
int main(void) { return test_harness(group_constraint_thresh_cmp, "group_constraint_thresh_cmp"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_unit_test.c
int main(void) { return test_harness(group_constraint_unit, "group_constraint_unit"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/group_pmc56_exclude_constraints_test.c
int main(void) { return test_harness(group_pmc56_exclude_constraints, "group_pmc56_exclude_constraints"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/hw_cache_event_type_test.c
int main(void) { return test_harness(hw_cache_event_type_test, "hw_cache_event_type_test"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c
static int reserved_bits_mmcra_sample_elig_mode(void) { struct event event; SKIP_IF(platform_check_for_tests()); /* Skip for Generic compat PMU */ SKIP_IF(check_for_generic_compat_pmu()); /* * MMCRA Random Sampling Mode (SM) values: 0x5 * 0x9, 0xD, 0x19, 0x1D, 0x1A, 0x1E is reserved. * Expected to...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c
int main(void) { return test_harness(reserved_bits_mmcra_thresh_ctl, "reserved_bits_mmcra_thresh_ctl"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/lib.c
int notify_parent(union pipe write_pipe) { char c = CHILD_TOKEN; FAIL_IF(write(write_pipe.write_fd, &c, 1) != 1); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/lib.c
int notify_parent_of_error(union pipe write_pipe) { char c = ~CHILD_TOKEN; FAIL_IF(write(write_pipe.write_fd, &c, 1) != 1); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/lib.c
int wait_for_child(pid_t child_pid) { int rc; if (waitpid(child_pid, &rc, 0) == -1) { perror("waitpid"); return 1; } if (WIFEXITED(rc)) rc = WEXITSTATUS(rc); else rc = 1; return rc; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c
static int bhrb_no_crash_wo_pmu_test(void) { struct event event; event_init_opts(&event, 0, PERF_TYPE_SOFTWARE, "cycles"); event.attr.sample_period = 1000; event.attr.sample_type = PERF_SAMPLE_BRANCH_STACK; event.attr.disabled = 1; /* * Return code of event_open is not * considered since test just ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c
int main(void) { return test_harness(bhrb_no_crash_wo_pmu_test, "bhrb_no_crash_wo_pmu_test"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
static void init_ev_encodes(void) { ev_mask_pmcxsel = 0xff; ev_shift_pmcxsel = 0; ev_mask_marked = 1; ev_shift_marked = 8; ev_mask_unit = 0xf; ev_shift_unit = 12; ev_mask_pmc = 0xf; ev_shift_pmc = 16; ev_mask_sample = 0x1f; ev_shift_sample = 24; ev_mask_thd_sel = 0x7; ev_shift_thd_sel = 29; e...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
static u64 perf_get_platform_reg_mask(void) { if (have_hwcap2(PPC_FEATURE2_ARCH_3_1)) return PERF_POWER10_MASK; if (have_hwcap2(PPC_FEATURE2_ARCH_3_00)) return PERF_POWER9_MASK; return -1; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
void *event_sample_buf_mmap(int fd, int mmap_pages) { size_t page_size = sysconf(_SC_PAGESIZE); size_t mmap_size; void *buff; if (mmap_pages <= 0) return NULL; if (fd <= 0) return NULL; mmap_size = page_size * (1 + mmap_pages); buff = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
void *__event_read_samples(void *sample_buff, size_t *size, u64 *sample_count) { size_t page_size = sysconf(_SC_PAGESIZE); struct perf_event_header *header = sample_buff + page_size; struct perf_event_mmap_page *metadata_page = sample_buff; unsigned long data_head, data_tail; data_head = metadata_page->data_...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
static void *perf_read_first_sample(void *sample_buff, size_t *size) { return __event_read_samples(sample_buff, size, NULL); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
u64 *get_intr_regs(struct event *event, void *sample_buff) { u64 type = event->attr.sample_type; u64 *intr_regs; size_t size = 0; if ((type ^ (PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_BRANCH_STACK)) && (type ^ PERF_SAMPLE_REGS_INTR)) return NULL; intr_regs = (u64 *)perf_read_first_sample(sample_buff, &...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
int get_thresh_cmp_val(struct event event) { int exp = 0; u64 result = 0; u64 value; if (!have_hwcap2(PPC_FEATURE2_ARCH_3_1)) return EV_CODE_EXTRACT(event.attr.config, thd_cmp); value = EV_CODE_EXTRACT(event.attr.config1, thd_cmp); if (!value) return value; if (value > 261120) value = 2611...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
static bool auxv_generic_compat_pmu(void) { int base_pvr = 0; if (!strcmp(auxv_base_platform(), "power9")) base_pvr = POWER9; else if (!strcmp(auxv_base_platform(), "power10")) base_pvr = POWER10; return (!base_pvr); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
static inline int get_mmcr0_pmccext(u64 mmcr0, int pmc) { return (mmcr0 & MMCR0_PMCCEXT); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
static inline int get_mmcr2_fcp(u64 mmcr2, int pmc) { return ((mmcr2 & (1ull << (62 - (((pmc)-1) * 9)))) >> (62 - (((pmc)-1) * 9))); }
[ 0, 0 ]