Lines Matching +full:up +full:- +full:counter

1 // SPDX-License-Identifier: GPL-2.0+
126 attr->type = PERF_TYPE_BREAKPOINT; in perf_user_event_attr_set()
127 attr->size = sizeof(struct perf_event_attr); in perf_user_event_attr_set()
128 attr->bp_type = HW_BREAKPOINT_R; in perf_user_event_attr_set()
129 attr->bp_addr = (u64)addr; in perf_user_event_attr_set()
130 attr->bp_len = len; in perf_user_event_attr_set()
131 attr->exclude_kernel = 1; in perf_user_event_attr_set()
132 attr->exclude_hv = 1; in perf_user_event_attr_set()
140 return perf_event_open(&attr, child_pid, -1, -1, 0); in perf_watchpoint_open()
146 * A perf counter is retrieved by the read() syscall. It contains in perf_read_counter()
152 return -1; in perf_read_counter()
160 info->version = 1; in ppc_ptrace_init_breakpoint()
161 info->trigger_type = type; in ppc_ptrace_init_breakpoint()
162 info->condition_mode = PPC_BREAKPOINT_CONDITION_NONE; in ppc_ptrace_init_breakpoint()
163 info->addr = (u64)addr; in ppc_ptrace_init_breakpoint()
164 info->addr2 = (u64)addr + len; in ppc_ptrace_init_breakpoint()
165 info->condition_value = 0; in ppc_ptrace_init_breakpoint()
167 info->addr_mode = PPC_BREAKPOINT_MODE_EXACT; in ppc_ptrace_init_breakpoint()
169 info->addr_mode = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE; in ppc_ptrace_init_breakpoint()
186 * Wrapper around a plain fork() call that sets up the child for
187 * ptrace-ing. Both the parent and child return from this, though
204 FAIL_IF_MSG(waitpid(*pid, &status, 0) == -1, "Failed to wait for child"); in ptrace_fork_child()
214 * We expect ptrace to take 'priority', as it is has before-execute
217 * The perf counter should not be incremented yet because perf has after-execute
222 * Both should increment the perf counter. We also test changing the PC somewhere
223 * different and stepping, which should not increment the perf counter.
229 int perf_fd; /* File descriptor of perf performance counter */ in same_watch_addr_test()
230 u64 perf_count; /* Most recently fetched perf performance counter value */ in same_watch_addr_test()
250 /* Place a perf watchpoint counter on value */ in same_watch_addr_test()
252 FAIL_IF_MSG(perf_fd < 0, "Failed to open perf performance counter"); in same_watch_addr_test()
262 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
271 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
274 /* Single stepping over the load should increment the perf counter */ in same_watch_addr_test()
277 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
281 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
282 FAIL_IF_MSG(perf_count != 1, "perf counter did not increment"); in same_watch_addr_test()
285 * Set up a ptrace watchpoint on the value again and trigger it. in same_watch_addr_test()
286 * The perf counter should not have incremented because we do not in same_watch_addr_test()
295 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
299 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
300 FAIL_IF_MSG(perf_count != 1, "perf counter should not have changed"); in same_watch_addr_test()
302 /* Continuing over the load should increment the perf counter */ in same_watch_addr_test()
305 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
309 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
310 FAIL_IF_MSG(perf_count != 2, "perf counter did not increment"); in same_watch_addr_test()
314 * we should reach the end trap (because ptrace is one-shot) and have in same_watch_addr_test()
320 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
324 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
325 FAIL_IF_MSG(perf_count != 3, "perf counter did not increment"); in same_watch_addr_test()
330 * the ptrace trap without incrementing the perf counter in same_watch_addr_test()
338 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
342 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
343 FAIL_IF_MSG(perf_count != 3, "perf counter should not have changed"); in same_watch_addr_test()
347 * not increment the perf counter (because ptrace is before-execute, in same_watch_addr_test()
348 * perf is after-execute). in same_watch_addr_test()
353 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
357 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in same_watch_addr_test()
358 FAIL_IF_MSG(perf_count != 3, "perf counter should not have changed"); in same_watch_addr_test()
360 /* Clean up child */ in same_watch_addr_test()
376 * We expect the perf counter to increment before the ptrace watchpoint
383 int perf_fd; /* File descriptor of perf performance counter */ in perf_then_ptrace_test()
384 u64 perf_count; /* Most recently fetched perf performance counter value */ in perf_then_ptrace_test()
409 /* Place a perf watchpoint counter */ in perf_then_ptrace_test()
411 FAIL_IF_MSG(perf_fd < 0, "Failed to open perf performance counter"); in perf_then_ptrace_test()
422 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in perf_then_ptrace_test()
428 FAIL_IF_MSG(perf_read_counter(perf_fd, &perf_count), "Failed to read perf counter"); in perf_then_ptrace_test()
429 FAIL_IF_MSG(perf_count != 1, "perf counter did not increment"); in perf_then_ptrace_test()
431 /* Clean up child */ in perf_then_ptrace_test()